use Tree::Simple qw/use_weak_refs/;
use Tree::Simple::Visitor::FindByUID;
use attributes;
-use JSON;
-use File::Slurp;
__PACKAGE__->mk_accessors(
qw/counter request response state action stack namespace/
require Module::Pluggable::Fast;
# Helper script generation
-our $CATALYST_SCRIPT_GEN = 25;
+our $CATALYST_SCRIPT_GEN = 26;
__PACKAGE__->mk_classdata($_)
for qw/components arguments dispatcher engine log dispatcher_class
if ( exists $c->components->{$try} ) {
my $comp = $c->components->{$try};
- if ( ref $comp && $comp->can('ACCEPT_CONTEXT') ) {
+ if ( eval { $comp->can('ACCEPT_CONTEXT'); } ) {
return $comp->ACCEPT_CONTEXT($c);
}
else { return $comp }
Returns or takes a hashref containing the application's configuration.
- __PACKAGE__->config({ db => 'dsn:SQLite:foo.db' });
-
-You can also use a L<JSON> config file like myapp.json in your
-applications home directory.
-
- {
- "db": "dsn:SQLite:foo.db"
- }
+ __PACKAGE__->config( { db => 'dsn:SQLite:foo.db' } );
=head2 $c->debug
$class->setup_home( delete $flags->{home} );
- # JSON config support
- my $confpath = $class->config->{file}
- || $class->path_to(
- ( Catalyst::Utils::appprefix( ref $class || $class ) . '.json' ) );
- my $conf = {};
- if ( -f $confpath ) {
- my $content = read_file("$confpath");
- $conf = jsonToObj($content);
- }
- my $oldconf = $class->config;
- $class->config( { %$oldconf, %$conf } );
-
$class->setup_log( delete $flags->{log} );
$class->setup_plugins( delete $flags->{plugins} );
$class->setup_dispatcher( delete $flags->{dispatcher} );
}
Catalyst::Exception->throw( message =>
-qq/Couldn't instantiate component "$component", "new() didn't return a object"/
+qq/Couldn't instantiate component "$component", "COMPONENT() didn't return a object"/
)
unless ref $instance;
return $instance;