use warnings;
use Carp;
-use lib '/www/data/rt/rt-perl/current-perl10/share/perl5';
-use lib '/www/data/rt/rt-perl/current-perl10/lib/perl5';
-use lib '/www/data/rt/rt-perl/current-perl10/lib64/perl5';
-
-use lib ("/www/var/rt/local/lib", "/www/var/rt/lib");
-
# fix lib paths, some may be relative
-BEGIN {
+BEGIN { # BEGIN RT CMD BOILERPLATE
require File::Spec;
+ require Cwd;
my @libs = ("lib", "local/lib");
my $bin_path;
for my $lib (@libs) {
unless ( File::Spec->file_name_is_absolute($lib) ) {
- unless ($bin_path) {
- if ( File::Spec->file_name_is_absolute(__FILE__) ) {
- $bin_path = ( File::Spec->splitpath(__FILE__) )[1];
- }
- else {
- require FindBin;
- no warnings "once";
- $bin_path = $FindBin::Bin;
- }
- }
+ $bin_path ||= ( File::Spec->splitpath(Cwd::abs_path(__FILE__)) )[1];
$lib = File::Spec->catfile( $bin_path, File::Spec->updir, $lib );
}
unshift @INC, $lib;
use RT::Interface::CLI qw(CleanEnv GetCurrentUser GetMessageContent loc);
-#Clean out all the nasties from the environment
-CleanEnv();
-
my ( $search, $condition, $action, $search_arg, $condition_arg, $action_arg,
$template, $template_id, $transaction, $transaction_type, $help, $log, $verbose );
GetOptions(
RT::LoadConfig();
# adjust logging to the screen according to options
-RT->Config->Set( LogToScreen => $log ) if $log;
+RT->Config->Set( LogToSTDERR => $log ) if $log;
#Connect to the database and get RT::SystemUser and RT::Nobody loaded
RT::Init();
+# Clean out all the nasties from the environment
+CleanEnv();
+
require RT::Tickets;
require RT::Template;
. "\n";
print loc("It takes several arguments:") . "\n\n";
- print " "
+ print " "
. loc( "[_1] - Specify the search module you want to use", "--search" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - An argument to pass to [_2]", "--search-arg", "--search" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - Specify the condition module you want to use", "--condition" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - An argument to pass to [_2]", "--condition-arg", "--condition" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - Specify the action module you want to use", "--action" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - An argument to pass to [_2]", "--action-arg", "--action" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - Specify name or id of template(s) you want to use", "--template" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - Specify if you want to use either 'first', 'last' or 'all' transactions", "--transaction" )
. "\n";
- print " "
+ print " "
. loc( "[_1] - Specify the comma separated list of transactions' types you want to use", "--transaction-type" )
. "\n";
- print " "
- . loc( "[_1] - Adjust LogToScreen config option", "--log" ) . "\n";
- print " "
+ print " "
+ . loc( "[_1] - Adjust LogToSTDERR config option", "--log" ) . "\n";
+ print " "
. loc( "[_1] - Output status updates to STDOUT", "--verbose" ) . "\n";
print "\n";
print "\n";
=item log
-Adjust LogToScreen config option
+Adjust LogToSTDERR config option
=item verbose