Leudwinus has asked for the wisdom of the Perl Monks concerning the following question:
I have the following script (json_test) on a remote FreeBSD virtual machine which runs fine when executed directly on the VM:
#!/usr/bin/env perl use lib "/home/user/perl5/lib"; use JSON; # line 4 print JSON->new->pretty->encode( { qw( a b ) } );
However, I get the following error message when I try to run it via SSH from my local machine:
leudwinus@localmachine:~$ ssh user@remotemachine './json_test' Can't locate JSON.pm in @INC (you may need to install the JSON module) + (@INC contains: /home/user/perl5/lib /usr/local/lib/perl5/site_perl/ +mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/loc +al/lib/perl5/5.32) at ./json_test line 4. BEGIN failed--compilation aborted at ./json_test line 4.
Any suggestions on how I can execute this script remotely via SSH?
On the virtual machine, I get the following information:
user@remotemachine:~$ perldoc -l JSON /home/user/perl5/lib/perl5/JSON.pm user@remotemachine:~$ perl -V Summary of my perl5 (revision 5 version 32 subversion 1) configuration +: ... @INC: /home/user/perl5/lib/perl5/5.32.1/amd64-freebsd-thread-multi /home/user/perl5/lib/perl5/5.32.1 /home/user/perl5/lib/perl5/amd64-freebsd-thread-multi /home/user/perl5/lib/perl5 /home/user/perl5/lib/perl5/5.32.1/amd64-freebsd-thread-multi /home/user/perl5/lib/perl5/5.32.1 /home/user/perl5/lib/perl5/amd64-freebsd-thread-multi /home/user/perl5/lib/perl5 /usr/local/lib/perl5/site_perl/mach/5.32 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.32/mach /usr/local/lib/perl5/5.32
JSON is installed on my local Ubuntu machine at /home/leudwinus/perl5/lib/perl5/JSON.pm but I didn't think that would matter.
Thanks in advance!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Can't locate module in @INC when executing script over SSH
by haukex (Archbishop) on Jan 27, 2023 at 19:13 UTC | |
by Leudwinus (Scribe) on Jan 27, 2023 at 19:39 UTC | |
by haukex (Archbishop) on Jan 27, 2023 at 20:26 UTC |
Back to
Seekers of Perl Wisdom