has _method_action_class => (is => 'rw', default => 'Catalyst::Action');
has _action_hash => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
has _container_hash => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
-has preload_dispatch_types => (is => 'rw', required => 1, lazy => 1, default => sub { [@PRELOAD] });
-has postload_dispatch_types => (is => 'rw', required => 1, lazy => 1, default => sub { [@POSTLOAD] });
-
-# Wrap accessors so you can assign a list and it will capture a list ref.
-around qw/preload_dispatch_types postload_dispatch_types/ => sub {
- my $orig = shift;
- my $self = shift;
- return $self->$orig([@_]) if (scalar @_ && ref $_[0] ne 'ARRAY');
- return $self->$orig(@_);
-};
+my %dispatch_types = ( pre => \@PRELOAD, post => \@POSTLOAD );
+foreach my $type (keys %dispatch_types) {
+ has $type . "load_dispatch_types" => (
+ is => 'rw', required => 1, lazy => 1, default => sub { $dispatch_types{$type} },
+ traits => ['MooseX::Emulate::Class::Accessor::Fast::Meta::Role::Attribute'], # List assignment is CAF style
+ );
+}
=head1 NAME
sub go {
my $self = shift;
$self->_do_visit('go', @_);
- die $Catalyst::GO;
+ Catalyst::Exception::Go->throw;
}
=head2 $self->forward( $c, $command [, \@arguments ] )
sub detach {
my ( $self, $c, $command, @args ) = @_;
$self->_do_forward(detach => $c, $command, @args ) if $command;
- die $Catalyst::DETACH;
+ Catalyst::Exception::Detach->throw;
}
sub _action_rel2abs {
sub dispatch_type {
my ($self, $name) = @_;
-
+
# first param is undef because we cannot get the appclass
$name = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $name);