Link to home
Start Free TrialLog in
Avatar of Craig Lavallee
Craig Lavallee

asked on

Perl -bash use command not found

Darwin -bash: use: command not found Why can't I use this module & why is -bash come come up?
Avatar of Jan Bacher
Jan Bacher
Flag of United States of America image

Is this an error from a perl script?
Avatar of Craig Lavallee
Craig Lavallee

ASKER

I am trying to run the perl module "use" which I got from cpan
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If you're missing a module, install it with cpan (for example):

cpan File::Copy

or

cpan Expect

You should be able to list the errors with:

perl -d /path/to/script/script.pl
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Trying  use use NetworkInfo\:\:Discovery\:\:Sniff
-bash: use: command not found
SYNOPSIS

use NetworkInfo::Discovery::Register;
 
# is like doing a $r->autosave(1) and $r->file("/tmp/the.register")
my $r = new NetworkInfo::Discovery::Register(autosave=>1, file=>"/tmp/the.register");
 
$r->read_register();    # restore state from last save
 
# ACLs allow us to remember only what we are allowed to
$r->clear_acl;
$r->add_acl("allow", "192.168.1.3/24"); # 192.168.1.3/24 gets converted to 192.168.1.0/24
$r->add_acl("deny", "0.0.0.0/0");
 
my $interface = { ip    =>  '192.168.1.1',
                  mac   =>  'aa:bb:cc:dd:ee:ff',
                  mask  =>  '255.255.255.0',    # or 24 (as in prefix notation)
                  dns   =>  'www.somehost.org',
                };
 
$r->add_interface($interface);
 
my $subnet  = { ip      =>  '192.168.1.0', # this is the network address
                mask    =>  24, # could also be '255.255.255.0'
              };
 
$r->add_subnet($subnet);
 
my $gateway =   { ip    =>  '192.168.1.254',
                  mask  =>  24,
                  mac   =>  'ff:ee:dd:cc:bb:aa',
                  dns   =>  'router.somehost.org',
                };
 
$r->add_gateway($gateway);
 
$r->write_register();    # save state for future restore
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi moderators,
I see Craig has closed this, accepting his own post (42202344) as the answer, with the a reason of "Excellent!".
Craig has told me in a private message that he doesn't know how to spread points over multiple answers.  I offered to contact a mod for help, and he accepted..  I see he's new to EE.
Craig, please state what posts you want to get what points (500 total).
Sorry mods - I meant to click "Object" rather than "Submit".  Doing that now.
LVL 12 Excellent solution!
Excellent solution
Hi Craig.

What I'm asking is, please state which posts you want to how many points (500 total), so the mods can either tell you how to spread them, or can do so themselves.

I would suggest you give David's post a good proportion of those points, as he was the one who initially told you to put "#!/usr/bin/env perl" at the beginning of your script, which was probably the key thing to getting your code working.

BTW, we don't usually refer to posts by the level of the expert (e.g. LVL 12).  If you want refer to a post, then use the 8 digit ID at the top of the post, and to refer to an expert, use their  name.

Thanks.
tel2
tel2, if someone wants to code, learning the debugger is practically a requirement.  additionally, without going through the debugger, the error should spit out immediately.
Hi Jan,

> "if someone wants to code, learning the debugger is practically a requirement."
The debugger is mainly useful for sorting out logic errors, and wouldn't usually be helpful for syntax errors.  His original post shows he has a syntax error.
For this situation, the debugger is not only unnecessarily complex, but totally unnecessary, since we can already see the error message in the original post.

Furthermore, using that command to start the debugger would not even pick up the issue that the "#!/..." (shebang) line was missing, because it will assume you want to run the script in perl, by the fact that you're typing "perl -d ...".

> "additionally, without going through the debugger, the error should spit out immediately."
Do you mean:
    right at the start of the debugger session the error should spit out,
OR:
    without even starting the debugger the error should spit out,
We can already expect that without even starting the debugger, the error already was spitting out immediately, which is how he would have got the error message in his original post.  So I ask again, why did you suggest:
   You should be able to list the errors with:
    perl -d /path/to/script/script.pl

when he already showed us the error message in his original post?
The debugger is not ideal for listing errors of this type.  It's for finding bugs (i.e. primarily logic errors).
Hi Mr Wolfe,

It should definitely not be deleted, in my view.  Based on some private messages from Craig (which I can post here if you like, as I don't think they contain anything sensitive), he seems happy with the answers he received.  The thread may also be useful to others who get messages like "use command not found".

I propose this split of A grade points:
    Best answer: 42200852 (David) = 250 points
    Assisted answer: 42202339 & 42202347 (mine) = 125 points each => 250 points total
I am not suggesting points for Jan's posts in this case because they didn't seem to be applicable to the error message Craig showed us in his original post, as I have explained above.

Thanks.
tel2
Thanks for your efforts, Mr Wolfe.

The point split is not as I suggested, but you're the expert...er...mod.  I see I ended up with twice the points David did, but I'm going to let that slide this time, and I'll accept the difference as a token of appreciation for the amount of time I spent on admin for this question.   8)