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

Re: perl 5.12 BSD portability (CPAN test result)...print

by ikegami (Pope)
on Mar 11, 2013 at 19:19 UTC ( #1022853=note: print w/ replies, xml ) Need Help??


in reply to perl 5.12 BSD portability (CPAN test result)...print

Before 5.14, you had to do

use IO::Handle qw( );

to load the module if you wanted to use its methods. Since 5.14.0, IO::Handle and IO::File are loaded on demand.

This has nothing to do with BSD.


Comment on Re: perl 5.12 BSD portability (CPAN test result)...print
Download Code
Re^2: perl 5.12 BSD portability (CPAN test result)...print
by perl-diddler (Hermit) on Mar 14, 2013 at 05:12 UTC
    Um... so everyone who uses 'print' or 'printf' needed to use IO::Handle? I doubt that is what you mean, is it?

    In any case, changing the code from '$fh->print' to 'print $fh' seems to have fixed the problem. Of *course* it makes sense -- it's perl! :-)

    That uncovered one last (??*crossing fingers*??) bug where the 'cat' was involved, which was unrelated to the 'rev', which I just supplied in my test directory (in a perl-1-liner script).simulated in a perl 1-liner:

    P> more t/rev sub rv{1>=length $_[0]?$_[0]:substr( $_[0],-1).rv(substr $_[0],0,-1)} +$_=<>;chomp; print rv($_);
    The 'cat' was for my STDERR test, which I cleaned up (and got rid of using 'cat' in testing...didn't want any Humane Society/PITA complaints). It's a split output, where the first part of the line put out by the 'generic example' code is on STDOUT, and the 2nd part is on STDERR... so I just run it twice for that test:
    if ($caseno == 5) { my $null; my $dev; open($null, ">", $dev="/dev/null") or open($null, ">", $dev="NUL:") or die "Cannot open /dev/null nor NUL:"; close ($null); my $resp = get_case($matchp->[0],"2>$dev"); $resp =~ m{$weak_match_expr}; ($rcase,$name, $rstr) = ($1,$2,$3); $resp = get_case($matchp->[0],"2>&1 >$dev"); $resp =~ m{$weak_match_expr}; $rstr = $2; } .... ok($rcase && $caseno == $rcase, "received testcase $caseno"); if (length($re)) {ok($rstr =~ m{$re}, $name)} }
    Hopefully "/dev/null" or "NUL" will work (it works on my linux and on Windows strawbelly16.2.)

    Tedia, tedia, tedia....;-)

    Thanks again for the assists...this is my testing the waters, as it were...
    hopefully it will go well...

      Um... so everyone who uses 'print' or 'printf' needed to use IO::Handle?

      Everyone who wanted to use those as methods on filehandles had to use IO::Handle, yes.

        But only in the FH->print format? Why does it work in the print FH mode? Aren't they supposed equivalent?
      Hopefully "/dev/null" or "NUL" will work (it works on my linux and on Windows strawbelly16.2.)

      For portability File::Spec->devnull() works well.

      Cheers,
      Rob

      Um... so everyone who uses 'print' or 'printf' needed to use IO::Handle? I doubt that is what you mean, is it?

      It's not what I meant. It's not what I said.

      Everyone who uses IO:Handle's print or printf method (e.g. $fh->print("foo");) needs to use use IO::Handle; or similar before 5.14.

      Using the print or printf operator (e.g. print $fh "foo";) does not require the use of use IO::Handle;.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1022853]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (11)
As of 2015-07-01 21:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (24 votes), past polls