in reply to Re: SSH connection with module
in thread SSH connection with module

I got most of that but I have no idea what you mean by "you will need to modify login_auth() to accept a parameter, preferably named $self." Don't I have to use this because I have to pass the variables:
$cisco->login_auth(@ARGV);
I get that sub new is returning an object into the main script but I don't get how I then pass it back to the module and use it then pass it back? Am I even understanding that right?

Replies are listed 'Best First'.
Re^3: SSH connection with module
by NetWallah (Canon) on Mar 10, 2014 at 03:39 UTC
    Yes - you are asking the right questions - so you are close to "getting it".

    When you invoke

    $cisco->login_auth( $whatever );
    you are actually passing TWO parameters into login_auth - which you can retrieve using:
    sub login_auth{ my ($self, $whatever) = @_; # Now $self contains whatever sub new() put into it. # and $self can be updated to include more useful things. }
    Instead of passing @ARGV, you should pass it as a reference : \@ARGV.

    This will allow passing additional parameters if necessary.

    OK - next question ?...

            What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
                  -Larry Wall, 1992

      No more questions...for now :) That explained it and I've been playing with passing $exp back and forth. I think I'm figuring it out. Thanks!