in reply to Trying to close Expect.pm telnet timeout situation to avoid overwhelming a small target device

$VAR1 = [ bless( \*Symbol::GEN0, 'Expect' ) ];

As it looks, your $fh (line 55-57) is an arrayref of objects (don't know why)... which would explain the "Can't call method ... on unblessed reference" (because the arrayref is unblessed).  In other words, you might try

$fh->[0]->do_soft_close();
  • Comment on Re: Trying to close Expect.pm telnet timeout situation to avoid overwhelming a small target device
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: Trying to close Expect.pm telnet timeout situation to avoid overwhelming a small target device
by elmoz (Initiate) on Nov 25, 2008 at 03:25 UTC
    I believe the $VAR1 = around the object is a artifact of Dump::Dumper.

      I believe you are wrong (or at least the [] is important as almut suggests):

      use Data::Dumper; my $blessedBe = bless {}, 'Wibble'; print Dumper $blessedBe; print Dumper [$blessedBe];

      Prints:

      $VAR1 = bless( {}, 'Wibble' ); $VAR1 = [ bless( {}, 'Wibble' ) ];

      Perl reduces RSI - it saves typing

      Sure, the $VAR1 = is an artifact, but not the square brackets... (which indicate that Data::Dumper was given an arrayref).  Compare with your first dump in the line:

      scriptbed login: $VAR1 = bless( \*Symbol::GEN0, 'Expect' );
        Ah, yes. Your modification works as expected:
        sub { my $fh = shift; print Dumper $fh; $fh->[0]->do_soft_close(); die "Timed out\n"; }
        No errors. Thank you.