Hi There,

I'm experiencing a problem with IPC::Run pump function. Well, when I wrote the code as non object-oriented - everything works well. But if I rewrite it into modulino(OOP), pump function get stuck. First, I thought some kind of mistype, but I controlled it many times and everything looks pretty much the same ...

Do you know why I'm getting:

... ;;;;;;6 IPC::Run 0001 [#1(9804)]: ** pumping
Instead of finishing pumping function and moving forward?

thanks, Tomas

Program code: (put it into file.pm and run it as: perl file.pm - it will automatically run the run function.

package pak; __PACKAGE__->run(@ARGV) unless caller(); use IPC::Run qw(start pump finish timeout); sub run { ref(my $class= shift) and die "Class name needed"; $|++; my $tok_program = "/bin/./cat"; my @tok_param=(); my $pokus = $class->new($tok_program,@tok_param); $pokus->{tok_in}="hallo\n"; do{ print "zz::$pokus->{tok_in};;$pokus-> {tok_out};;$pokus->{tok_err +};;".length($pokus->{tok_in})."\n"; $pokus->{tok}->pump; print "kk\n"; } while $pokus->{tok_out} !~ /\n\z/; #$r }#sub run sub new{ ref(my $class= shift) and die "Class name needed"; my $tok_program = shift; my @tok_param = @_; my ( $TOK_IN, $TOK_OUT, $TOK_ERR, $TOK ); $TOK = start [ $tok_program, @tok_param ], '<', \$TOK_IN, '1>pty>', +\$TOK_OUT, '2>', \$TOK_ERR, debug => 2 or die "Can't exec program: $?;\n"; my $self = {tok => $TOK, tok_in => $TOK_IN, tok_out => $TOK_OUT, tok +_err => $TOK_ERR, tok_program => $tok_program}; bless $self,$class; return $self; }


In reply to IPC::pump in object oriented programming by xhudik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.