ferz has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I'm reading http://willert.livejournal.com/2008/09/09/ and http://bricas.vox.com/library/post/catalyst-exceptionclass.html

In the first I don't understand how $subclass can have a Fields method (or accessor).

  for my $field ( grep{ exists $def->{$_} } $subclass->Fields ) {

I've tried to use it and I got following error:

Can't locate object method "Fields" via package "AccessDenied" at (eva +l 25)[/usr/pkg/lib/perl5/site_perl/5.10.0/Exception/Class.pm:170] lin +e 15. at (eval 25)[/usr/pkg/lib/perl5/site_perl/5.10.0/Exception/Class.pm:1 +70] line 15 AccessDenied::Fields('AccessDenied') called at /home/fer/arancia/s +cript/../lib/Exception/Class/WithDefaults.pm line 40 Exception::Class::WithDefaults::_make_subclass('Exception::Class:: +WithDefaults', 'subclass', 'AccessDenied', 'def', 'HASH(0x28874dc0)') + called at /usr/pkg/lib/perl5/site_perl/5.10.0/Exception/Class.pm lin +e 55 Exception::Class::import('Exception::Class::WithDefaults', 'Conten +tNotFound', 'HASH(0x28874d10)', 'AccessDenied', 'HASH(0x28874dc0)', ' +ProjectNotFound', 'HASH(0x28874cd0)', 'RevisionNotFound', 'HASH(0x288 +74d50)', ...) called at /home/fer/arancia/script/../lib/arancia/Excep +tions.pm line 45 arancia::Exceptions::BEGIN() called at /usr/pkg/lib/perl5/site_per +l/5.10.0/Sub/Exporter.pm line 47 eval {...} called at /usr/pkg/lib/perl5/site_perl/5.10.0/Sub/Expor +ter.pm line 47 require arancia/Exceptions.pm called at /home/fer/arancia/script/. +./lib/arancia.pm line 7 arancia::BEGIN() called at /usr/pkg/lib/perl5/site_perl/5.10.0/Sub +/Exporter.pm line 47 eval {...} called at /usr/pkg/lib/perl5/site_perl/5.10.0/Sub/Expor +ter.pm line 47 require arancia.pm called at /home/fer/arancia/script/arancia_fast +cgi.pl line 11 main::BEGIN() called at /usr/pkg/lib/perl5/site_perl/5.10.0/Sub/Ex +porter.pm line 47 eval {...} called at /usr/pkg/lib/perl5/site_perl/5.10.0/Sub/Expor +ter.pm line 47

Replies are listed 'Best First'.
Re: Catalyst and Excpetion::Class
by Anonymous Monk on Apr 11, 2009 at 08:53 UTC