From 838a414c641618cf444be4712049e971864ecf0e Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 6 May 2010 15:40:10 -0400 Subject: [PATCH] thrasherbird.pl: Detect or configure Thrasher Perl library path. --- perl/thrasherbird.pl | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/perl/thrasherbird.pl b/perl/thrasherbird.pl index 94422e0..9c68912 100644 --- a/perl/thrasherbird.pl +++ b/perl/thrasherbird.pl @@ -92,12 +92,30 @@ my $plugins = []; # enables file transfers to and from contacts on the transport. # push(@{$plugins}, 'Thrasher::Plugin::ProxyFileTransfer'); +####### +## INSTALLATION LOCATION +####### + +# Thrasher can use libraries built in the same directory as this +# script. If you'd like to install Thrasher to a different path, +# either configure the below or add the path to PERL5LIB: + +my $thrasher_perl_dir; + +# Default: figure out where the script is and use libraries from that path: +use Cwd qw(abs_path); +use File::Basename qw(dirname); +if (not $thrasher_perl_dir) { + $thrasher_perl_dir = dirname(abs_path($0)); + require lib; + lib->import($thrasher_perl_dir . '/lib'); +} #### THRASHER BIRD PROGRAM # If you are just configuring the program, ignore everything after # this. -use Thrasher; +require Thrasher; # Perl Gurus: This function call is all you need to start Thrasher # Bird. This configuration file is unneccessary if you want # to obtain these values some other way. (We do at Barracuda -- 2.11.4.GIT