Posted on 2009-11-02 06:15:20-08 by tinuc
How to pass an open session to a subroutine
So this is probably more of a Perl question but I'm having some trouble passing an open session to a subroutine.
This is how I have it initialized: $s = Net::Appliance::Session->new( Host => $ip, );
I'm trying to pass it as an argument to a subroutine:
enterCommands(\$s , \@array);
then here is the part that is messing me up: inside the subroutine:
my ($s , @array) = @_;
then I get an error: Can't call method "cmd" on unblessed reference at ./css-multi-script.pl line 138, <FILE< line 211. line 138 is:
@out1 = ($s)->cmd($line);
Help please, Amir
Direct Responses: 11695 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.