- Read AUTHOR from passwd or $ENV{AUTHOR} when
generating code.
- extended attribute handling
+ - added global config for components
5.00 Fri Apr 15 18:00:00 2005
- new core to support inheritance trees
=head1 THANK YOU
-Andy Grundman, Andrew Ford, Andrew Ruthven, Christian Hansen,
+Andy Grundman, Andrew Ford, Andrew Ruthven, Autrijus Tang, Christian Hansen,
Christopher Hicks, Dan Sully, Danijel Milicevic, David Naughton,
Gary Ashton Jones, Jesse Sheidlower, Johan Lindstrom, Marcus Ramberg,
Tatsuhiko Miyagawa and all the others who've helped.
use strict;
use base qw/Class::Data::Inheritable Class::Accessor::Fast/;
+use Catalyst::Utils;
use NEXT;
__PACKAGE__->mk_classdata($_) for qw/_attrcache _cache _config/;
sub new {
my ( $self, $c ) = @_;
- return $self->NEXT::new( $self->config );
+ my $class = ref $self || $self;
+ my $appname = Catalyst::Utils::class2appclass($class);
+ my $suffix = Catalyst::Utils::class2classsuffix($class);
+ my $appconfig = $appname->config->{$suffix} || {};
+ my $config = { %{ $self->config }, %{$appconfig} };
+ return $self->NEXT::new($config);
}
# remember to leave blank lines between the consecutive =item's
return $name;
}
+=item class2appclass($class);
+
+Returns the appclass for class.
+
+=cut
+
+sub class2appclass {
+ my $class = shift || '';
+ my $appname = '';
+ if ( $class =~ /^(.*)::([MVC]|Model|View|Controller)?::.*$/ ) {
+ $appname = $1;
+ }
+ return $appname;
+}
+
=item class2classprefix($class);
Returns the classprefix for class.
return $prefix;
}
+=item class2classsuffix($class);
+
+Returns the classsuffix for class.
+
+=cut
+
+sub class2classsuffix {
+ my $class = shift || '';
+ my $prefix = class2appclass($class) || '';
+ $class =~ s/$prefix\:\://;
+ return $class;
+}
+
=item class2prefix($class);
Returns the prefix for class.