attributes的用法还是不太明白。<br>还是得需要各位提点一下。主要是到底是怎么用的。<br>其实C:A::Plugin::ActionDispatch倒是一个实例,可惜没怎么看明白。<br>好像是根据attributes调用相应的设置好的子过程。<br>主要是attributes会取得一个列表,然后匹配。<br><br>另外代码里需要的功能倒是搞定了。<br><br>主要是C:A::Plugin::ActionDispatch没有打断原来的model<br>
<br><br><div class="gmail_quote">2009/9/7 Mike.G <span dir="ltr"><<a href="mailto:hylinux@gmail.com">hylinux@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
今天在使用一个C:A的插件的时候碰到一个问题:<br>C:A:Plugin::ActionDispatch<br><br>这个模块是使用attributes的特性来判断runmode的<br><br>有个问题是<br>例如:<br>when I define some runmode in parent class.<br>just like <br><br>package Myparentclass;<br>
use base qw/CGI::Applicatin/;<br>use CGI::Application::plugin::<div>ActionDispatch;<br><br>sub cgiapp_prerun {<br> my $this = shift;<br> if ( some condition ) {<br> $this->prerun_mode('mode1');<br>
<br>
}<br><br>}<br><br><br>sub mode1:Runmode {<br> it is here<br><br>}<br><br>1;<br><br>and in <br>Child Class<br><br>package MyChild;<br>use base qw/Myparentclass/;<br><br><br><br>1;<br><br>when the "some condition" true, in parent class, it will be run mode1,<br>
but it doesn't work:<br>said:<br><pre>No such run mode 'showcity' at /home/ghw/myperl/in-marry/app/store line 13<br><br>但是把这个runmode定义在store的模块中可以的。<br>所以我猜测是C:A:Plugin::ActionDispatch中有问题了。<br>打开源代码看了一下。发现整个核心是使用attributes来做的。<br>
<br>一直没明白attributes的作用。<br>哪位大大可以讲讲?<br>看了一下perldoc,不太明白。<br><br>谢谢<br><br><br>Mike.G<br><br></pre></div><br>
</blockquote></div><br>