X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FBase.pm;h=64848c076f0b5709d5204bc0d5bbae7a70a4a300;hb=812a28c90c5b43bdf5ce87f1b2a688725e552429;hp=ec25476b1b70be7a35ff129bd0f34eaba48c71fa;hpb=4f6748f101647dd3344339b19510947df6836412;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Base.pm b/lib/Catalyst/Base.pm index ec25476..64848c0 100644 --- a/lib/Catalyst/Base.pm +++ b/lib/Catalyst/Base.pm @@ -5,19 +5,19 @@ use base qw/Class::Data::Inheritable Class::Accessor::Fast/; use Catalyst::Utils; use NEXT; -__PACKAGE__->mk_classdata($_) for qw/_attrcache _cache _config/; -__PACKAGE__->_attrcache( {} ); -__PACKAGE__->_cache( [] ); +__PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache _config/; +__PACKAGE__->_attr_cache( {} ); +__PACKAGE__->_action_cache( [] ); # note - see attributes(3pm) sub MODIFY_CODE_ATTRIBUTES { my ( $class, $code, @attrs ) = @_; - $class->_attrcache->{$code} = [@attrs]; - push @{ $class->_cache }, [ $code, [@attrs] ]; + $class->_attr_cache->{$code} = [@attrs]; + push @{ $class->_action_cache }, [ $code, [@attrs] ]; return (); } -sub FETCH_CODE_ATTRIBUTES { $_[0]->_attrcache->{ $_[1] } || () } +sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () } =head1 NAME @@ -92,8 +92,8 @@ sub new { sub config { my $self = shift; $self->_config( {} ) unless $self->_config; - if ( $_[0] ) { - my $config = $_[1] ? {@_} : $_[0]; + if (@_) { + my $config = @_ > 1 ? {@_} : $_[0]; while ( my ( $key, $val ) = each %$config ) { $self->_config->{$key} = $val; }