Gantry::Utils::CRON - a way to call a controller's method from a CRON script
use strict; use warnings; use Gantry::Utils::CRON; my $cron = Gantry::Utils::CRON->new( { controller => 'Apps::RR::InvoiceMunger::Batch', conf_instance => 'apps_rr_invoicemunger_dev_prod', conf_file => '/etc/gantry.conf', # optional template_engine => 'TT', # optional namespace => 'Apps::RR::InvoiceMunger', # optional } ); # alternative setters $cron->set_controller( 'Apps::RR::InvoiceMunger::Batch' ); $cron->set_conf_instance( 'invoice_munger_prod' ); $cron->set_conf_file( '/etc/gantry.conf' ); $cron->set_template_engine( 'TT' ); $cron->set_namespace( 'mynamespace' ); $cron->run( { method => 'do_process_files', # do_* required args => [ '1', '2' ], # optional params => { confirm => 1, test => 3 } # optional type => 'post' # or 'get' -- optional } ); print STDERR $cron->status(); print STDERR $cron->content();
This module is a utility to run a Gantry do_ method from a CRON script
Standard constructor, call it first.
Required
controller - Gantry controller that contains the do_ method conf_instance - Gantry conf instance name
Optional
conf_file - defaults to '/etc/gantry.conf' template_engine - defaults to 'TT' namespace
This method executes the defined controller's do_ method.
Accepts
method - the do_ method args - array of args to be passed to the method params - hashref of params to be passed to method type - 'get' or 'post' defaults to 'post'
Returns
status - page status code content - plain-text version of method's returned content
setter for the returned content
getter for the returned content
setter for the returned status
getter for the returned status
setter for controller
getter for controller
setter for the Gantry conf_instance
getter for the Gantry conf_instance
setter for the Gantry conf_file.
getter for the Gantry conf_file. Defaults to /etc/gantry.conf
Gantry(3)
This module depends on Gantry(3), HTML::TreeBuilder, HTML::FormatText
Tim Keefer <tim@timkeefer.com>
Copyright (c) 2007, Tim Keefer.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install Gantry, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gantry
CPAN shell
perl -MCPAN -e shell install Gantry
For more information on module installation, please visit the detailed CPAN module installation guide.