[Catalyst] myapp_test.pl - running code from the command line

Octavian Rasnita octavian.rasnita at ssifbroker.ro
Wed Nov 3 06:58:30 GMT 2010

From: "Jonathon Soong" <jon at investmentscience.com.au>
> Yes I realise now it might make more sense in the Model, but at the moment 
> it is in the Controller (it is someone else's code, so more difficult for 
> me to refactor).
> There are two questions I have then:
> 1. How do you call a Model's function from the command line?
> 2. Is there no way to call controller methods that require authentication?
> Thanks
> Jon

The model can be just a thin wrapper for your non-catalyst modules like 
MyApp::Model::DB could be for your DBIC schema.
And you can use your non-catalyst module from a non-catalyst script that can 
be ran by a cron job.

If the code is in the controller and you can access it by web only, you can 
create a script that accesses your running Catalyst application, does the 
login (submits the login form with the necessary username and password), 
saves the cookie and resends that cookie for all the requests you need to do 
after logging in.


More information about the Catalyst mailing list