C:A:Plugin::ActionDispatch
这个模块是使用attributes的特性来判断runmode的
有个问题是
例如:
when I define some runmode in parent class.
just like
package Myparentclass;
use base qw/CGI::Applicatin/;
use CGI::Application::plugin::
ActionDispatch;
sub cgiapp_prerun {
my $this = shift;
if ( some condition ) {
$this->prerun_mode('mode1');
}
}
sub mode1:Runmode {
it is here
}
1;
and in
Child Class
package MyChild;
use base qw/Myparentclass/;
1;
when the "some condition" true, in parent class, it will be run mode1,
but it doesn't work:
said:
sub cgiapp_prerun {
my $this = shift;
if ( some condition ) {
$this->prerun_mode('mode1');
}
}
sub mode1:Runmode {
it is here
}
1;
and in
Child Class
package MyChild;
use base qw/Myparentclass/;
1;
when the "some condition" true, in parent class, it will be run mode1,
but it doesn't work:
said:
No such run mode 'showcity' at /home/ghw/myperl/in-marry/app/store line 13
但是把这个runmode定义在store的模块中可以的。
所以我猜测是C:A:Plugin::ActionDispatch中有问题了。
打开源代码看了一下。发现整个核心是使用attributes来做的。
一直没明白attributes的作用。
哪位大大可以讲讲?
看了一下perldoc,不太明白。
谢谢
Mike.G
没有评论:
发表评论