one question about the plugin: CGI::Appliclation::Plugin::AutoRunmode

View: New views
3 Messages — Rating Filter:   Alert me  

one question about the plugin: CGI::Appliclation::Plugin::AutoRunmode

by Mike.G :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, everybody.

when I use CGI::Application like this:

package MyWeb;
use base qw/CGI::Application/;

sub setup {
     my $this = shift;

     $this->run_modes (
         'mode_1' => 'run_mode_1',
         ......
     }

     $this->start_mode('mode_1')
     $this->mode_param('action')



}

......

1;

so in my url, we can request the script like this:
http://127.0.0.1/cgi/test.pl?action=mode_1

but when I use that plugin

I will write code like this:

package MyWeb;
use base qw/CGI::Application/;
use CGI::Application::Plugin::AutoRunmode;

sub run_mode_1:StartMode {
   ......
}

1;

so my issue is: when I use that plugin, what's that parameter( I had
request, named 'action' in example1? it is run_mode_1? )?

thanks

Mike.G


}

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: one question about the plugin: CGI::Appliclation::Plugin::AutoRunmode

by Alexandr Ciornii :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

sub run_mode_1:Runmode
 is an equivalent of
$this->run_modes ( 'run_mode_1' => 'run_mode_1',

To have run mode 'mode_1' you need
sub mode_1:Runmode

StartRunmode also adds
$this->start_mode('...')

To change mode_param, do it as before in setup {}.

Also see SYNOPSIS from CGI::Application::Plugin::AutoRunmode docs
(http://search.cpan.org/perldoc?CGI::Application::Plugin::AutoRunmode).

2008/6/4 Mike. G <hylinux@...>:

> Hi, everybody.
>
> when I use CGI::Application like this:
>
> package MyWeb;
> use base qw/CGI::Application/;
>
> sub setup {
>     my $this = shift;
>
>     $this->run_modes (
>         'mode_1' => 'run_mode_1',
>         ......
>     }
>
>     $this->start_mode('mode_1')
>     $this->mode_param('action')
>
>
>
> }
>
> ......
>
> 1;
>
> so in my url, we can request the script like this:
> http://127.0.0.1/cgi/test.pl?action=mode_1
>
> but when I use that plugin
>
> I will write code like this:
>
> package MyWeb;
> use base qw/CGI::Application/;
> use CGI::Application::Plugin::AutoRunmode;
>
> sub run_mode_1:StartMode {
>   ......
> }
>
> 1;
>
> so my issue is: when I use that plugin, what's that parameter( I had
> request, named 'action' in example1? it is run_mode_1? )?

--
Alexandr Ciornii, http://chorny.net

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################


Re: one question about the plugin: CGI::Appliclation::Plugin::AutoRunmode

by Mike.G :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks


2008/6/4 Alexandr Ciornii <alexchorny@...>:

> Hello!
>
> sub run_mode_1:Runmode
>  is an equivalent of
> $this->run_modes ( 'run_mode_1' => 'run_mode_1',
>
> To have run mode 'mode_1' you need
> sub mode_1:Runmode
>
> StartRunmode also adds
> $this->start_mode('...')
>
> To change mode_param, do it as before in setup {}.
>
> Also see SYNOPSIS from CGI::Application::Plugin::AutoRunmode docs
> (http://search.cpan.org/perldoc?CGI::Application::Plugin::AutoRunmode).
>
> 2008/6/4 Mike. G <hylinux@...>:
> > Hi, everybody.
> >
> > when I use CGI::Application like this:
> >
> > package MyWeb;
> > use base qw/CGI::Application/;
> >
> > sub setup {
> >     my $this = shift;
> >
> >     $this->run_modes (
> >         'mode_1' => 'run_mode_1',
> >         ......
> >     }
> >
> >     $this->start_mode('mode_1')
> >     $this->mode_param('action')
> >
> >
> >
> > }
> >
> > ......
> >
> > 1;
> >
> > so in my url, we can request the script like this:
> > http://127.0.0.1/cgi/test.pl?action=mode_1
> >
> > but when I use that plugin
> >
> > I will write code like this:
> >
> > package MyWeb;
> > use base qw/CGI::Application/;
> > use CGI::Application::Plugin::AutoRunmode;
> >
> > sub run_mode_1:StartMode {
> >   ......
> > }
> >
> > 1;
> >
> > so my issue is: when I use that plugin, what's that parameter( I had
> > request, named 'action' in example1? it is run_mode_1? )?
>
> --
> Alexandr Ciornii, http://chorny.net
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>

#####  CGI::Application community mailing list  ################
##                                                            ##
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp    ##
##                                                            ##
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:          http://cgiapp.erlbaum.net/                 ##
##                                                            ##
################################################################

LightInTheBox - Buy quality products at wholesale price