Consider the following 2 scripts :
main.pl
#!/usr/bin/env perl
require 'lib.pl';
testSub('Hello World');
lib.pl
sub testSub
{
my ($input) = @_;
print $input, "\n";
}
1;
I need to run main.pl
script remotely through SSH using sudo while including lib.pl
as a dependency.
I know how to run a single Perl script through SSH using sudo
:
$ ssh user@host 'sudo perl' < /path/to/local/perl/script
But, in this case, the following error is immediately raised :
Can't locate libs.pl in @INC (@INC contains: /usr/lib/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/lib/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.10.0 /usr/lib/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl .) at - line XX.
But how could I do the same while including another script as a dependency ?
Thanks all in advance.