Ang-st has asked for the wisdom of the Perl Monks concerning the following question:
{ package Fake; sub present { my $class = shift ; print $class->head, "\n"; } sub ack { my $class = shift; print $class->ok,"\n"; } sub rst { my $class = shift; print $class->quit,"\n"; } } { package Ssh; @ISA = qw{Fake}; sub head { my @fake = ("SSH-2.0-OpenSSH_3.8.1p1","SSH-2.0-OpenSSH_3.7p1", +"SSH-2.0-OpenSSH_3.5p1"); $size = @fake; $rand = 0; $rand = int(rand $size); return $fake[$rand]; } sub quit {return "Protocol mismatch."} }
but when try to print to the socket with for example print $socket "$obj->present" i get "Ssh->present" on the client screen or if i try print $socket $obj->present i get the good message but on STDOUT ...bind($port, 'Ssh'); sub bind ( $$){ my $port = shift; my $obj =shift ...... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: call a method which print to a handle
by dave_the_m (Monsignor) on Mar 23, 2005 at 22:13 UTC | |
by Ang-st (Novice) on Mar 23, 2005 at 22:43 UTC | |
|
Re: call a method which print to a handle
by holli (Abbot) on Mar 24, 2005 at 05:38 UTC |