106 lines
2.4 KiB
Text
106 lines
2.4 KiB
Text
#-------------------------------------------------------------------
|
|
# WebGUI is Copyright 2001-2008 Plain Black Corporation.
|
|
#-------------------------------------------------------------------
|
|
# Please read the legal notices (docs/legal.txt) and the license
|
|
# (docs/license.txt) that came with this distribution before using
|
|
# this software.
|
|
#-------------------------------------------------------------------
|
|
# http://www.plainblack.com info@plainblack.com
|
|
#-------------------------------------------------------------------
|
|
|
|
our ($webguiRoot);
|
|
|
|
BEGIN {
|
|
$webguiRoot = "..";
|
|
unshift (@INC, $webguiRoot."/lib");
|
|
}
|
|
|
|
use strict;
|
|
use Pod::Usage;
|
|
use Getopt::Long;
|
|
use WebGUI::Session;
|
|
|
|
# Get parameters here, including $help
|
|
|
|
pod2usage( verbose => 2 ) if $help;
|
|
pod2usage() unless $help; # Change condition!
|
|
|
|
my $session = start();
|
|
# Do your work here
|
|
finish($session);
|
|
|
|
#-------------------------------------------------
|
|
# Your sub here
|
|
|
|
#-------------------------------------------------
|
|
sub start {
|
|
my $configFile;
|
|
$| = 1; #disable output buffering
|
|
GetOptions(
|
|
'configFile=s' => \$configFile,
|
|
);
|
|
my $session = WebGUI::Session->open($webguiRoot,$configFile);
|
|
$session->user({userId=>3});
|
|
|
|
## If your script is adding or changing content you need these lines, otherwise leave them commented
|
|
#
|
|
# my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|
# $versionTag->set({name => 'Name Your Tag'});
|
|
#
|
|
##
|
|
|
|
return $session;
|
|
}
|
|
|
|
#-------------------------------------------------
|
|
sub finish {
|
|
my $session = shift;
|
|
|
|
## If your script is adding or changing content you need these lines, otherwise leave them commented
|
|
#
|
|
# my $versionTag = WebGUI::VersionTag->getWorking($session);
|
|
# $versionTag->commit;
|
|
##
|
|
|
|
$session->var->end;
|
|
$session->close;
|
|
}
|
|
|
|
__END__
|
|
|
|
|
|
=head1 NAME
|
|
|
|
utility - A template for WebGUI utility scripts
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
utility --configFile config.conf ...
|
|
|
|
utility --help
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
This WebGUI utility script helps you...
|
|
|
|
=over
|
|
|
|
=item B<--configFile config.conf>
|
|
|
|
The WebGUI config file to use. Only the file name needs to be specified,
|
|
since it will be looked up inside WebGUI's configuration directory.
|
|
This parameter is required.
|
|
|
|
=item B<--help>
|
|
|
|
Shows this documentation, then exits.
|
|
|
|
=back
|
|
|
|
=head1 AUTHOR
|
|
|
|
Copyright 2001-2008 Plain Black Corporation.
|
|
|
|
=cut
|
|
|
|
#vim:ft=perl
|