Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Using perlbrew hides stdout

by hessef (Monk)
on Apr 23, 2010 at 01:52 UTC ( [id://836397]=perlquestion: print w/replies, xml ) Need Help??

hessef has asked for the wisdom of the Perl Monks concerning the following question:

I'm running Ubuntu 9.10 and wanted to try perl 5.12. I've heard good things about perlbrew and installed perl 5.12 using that.

Running

perl -v
returns
This is perl 5, version 12, subversion 0 (v5.12.0) built for i686-linu +x ...
so I'm assuming that perlbrew did its job. However, running this test program, named brewcheck.pl:
#!/home/explain/localperl/bin/perl print "foo"; die "fark";
yields:
fark at ./brewcheck.pl line 4.
The print statement doesn't print. Running ./brewcheck.pl > outputfile, however runs as expected: I get a file named outputfile that contains the "foo" from the print statement. While that sort of behavior is usable, I'd really, really to be able to read the contents of print statments on the terminal while my perl scripts are running. Help, please?

Replies are listed 'Best First'.
Re: Using perlbrew hides stdout
by NetWallah (Canon) on Apr 23, 2010 at 02:57 UTC
    This is true of perl 5.10 on Ubuntu as well.

    You are missing the "\n" that flushes stdout before stderr takes over - I'm sure others here will explain this better.

    :~$ perl -e 'print q|foo|; die "Fark"' Fark at -e line 1. foo :~$ perl -e 'print qq|foo\n|; die "Fark"' foo Fark at -e line 1. :~$ perl -e '$|=1; print qq|foo|; die "Fark"' fooFark at -e line 1. :~$ perl -v This is perl, v5.10.0 built for i486-linux-gnu-thread-multi

         Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

      Oops, yeah, this is a PEBKAC. Just tried one of my previously written programs with tons of say statements. They work. Sorry to inflict a too-hasty test case on you guys.
Re: Using perlbrew hides stdout
by ikegami (Patriarch) on Apr 23, 2010 at 02:58 UTC

    All perlbrew seems to do is create a symbolic link to Perl. Sounds like a red herring.

    Then you've shown that Perl does output foo. The difference appears to be whether STDOUT is connected to a terminal or not. Odd.

    Are you sure you didn't see it because foo appears after the fark at line? No newline caused STDOUT to be flushed before perl exits.

    $ perl -e'print "foo"; die "fark"' fark at -e line 1. foo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://836397]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2026-03-10 15:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.