[Dancer-users] how to run function from app from command line?
Nick Knutov
mail at knutov.com
Sun Jul 3 06:25:44 CEST 2011
Thanks! Look like exactly what I need.
btw, is there any way to run 'before' in such scripts?
I changed
before sub {...}
to
sub _init {...}
before sub {_init()}; # in main app
app::_init(); # in Dancer ':script' app
but this is ugly.
02.07.2011 17:19, Jury Gorky пишет:
> you can put the script in the bin directory and use Dancer qw(:script) in it
>
> http://search.cpan.org/~sukria/Dancer-1.3060/lib/Dancer.pm#:script
>
> On 2 July 2011 00:14, Nick Knutov <mail at knutov.com
> <mailto:mail at knutov.com>> wrote:
>
> Hello,
>
> I have a big project running on Dancer. This project has some
> service scripts (to do some cron jobs for example), written as
> functions in this Dancer app, that should have access to all usual
> environment (as called from the web functions have), but I need to
> be able run them from command line.
>
> What is the best way to do it?
>
> Example:
>
> get '/service_func' => {...};
>
> I want to do something like
>
> # ./bin/app.pl <http://app.pl> --run=service_func
>
>
> --
> Best Regards,
> Nick Knutov
> http://knutov.com
> ICQ: 272873706
> Voice: +7-904-84-23-130
> _________________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org <mailto:Dancer-users at perldancer.org>
> http://www.backup-manager.org/__cgi-bin/listinfo/dancer-users
> <http://www.backup-manager.org/cgi-bin/listinfo/dancer-users>
>
>
--
Best Regards,
Nick Knutov
http://knutov.com
ICQ: 272873706
Voice: +7-904-84-23-130
More information about the Dancer-users
mailing list