Name
createEnvironment — sets up Slash to run scripts outside of the web environment
Synopsis
createEnvironment(); createEnvironment($virtual_user);
createEnvironment
initializes several Slash components
that would normally be set when running under Apache. This includes creating a
database connection and setting the current user to the Anonymous User. It
takes an optional single parameter, $virtual_user
, which is the string
name of the DBIx::Password
virtual user associated with
the database that will be used. Lacking this parameter, it will look through
@ARGV
for key/value pairs of the form
“key=value”. If it finds a key named
virtual_user
, it will use the associated value. It returns
nothing and will perform no action if running under
mod_perl. This function is exported from
Slash::Utility
.
Example
use Slash::Utility; my $virtual_user = $ARGV[0]; createEnvironment($virtual_user);
Get Running Weblogs with Slash now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.