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!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.