Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by perl-diddler (Hermit)
on Mar 10, 2013 at 17:04 UTC ( #1022672=note: print w/ replies, xml ) Need Help??


in reply to Re^3: perl 5.12 BSD portability (CPAN test result)...print
in thread perl 5.12 BSD portability (CPAN test result)...print

Funny you should mention that example.

I was pokin' at the code and though, well, maybe I should try

print $fh [rest of print line]
It seems with 'say', the above form worked, while the 'preferred' (hmmm) "$fh->say" did not..?

BTW, FWIW, I'd really hate to put in a BUGS section like that indicating that they'd have to upgrade just because of my module. If I did have to put in a section like that, I'd like to point them to a perlbug# specific for their version & platform -- but that still would beg the question, "why BSD and not linux"? On the level that I'm using perl, they should be identical. If the 5.12 version of perl on BSD was miscompiled, I'd think that would be fixable, no?

For windows, am wondering if I should just skip those tests that won't work? The execute test on lib/P.pm... yeah, that would be skippable, but the other test is testing the ability to print directly *from* a file descriptor. I think that should work on windows if I write a tiny perl-prog to emulate the function(s) of cat & rev. I.e. its a corner case that's not really worth the effort, but it would probably be the "right thing to do"...;^/


Comment on Re^4: perl 5.12 BSD portability (CPAN test result)...print
Download Code
Re^5: perl 5.12 BSD portability (CPAN test result)...print
by tobyink (Abbot) on Mar 10, 2013 at 21:55 UTC

    Did you try the solution I posted earlier?

    use IO::File (); use IO::Handle ();

    ... I strongly suspect it will solve the problem.

    package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
      Well it works on my machine, of course, but because of the problem report with 'say' working as a 'pre-method', but generating the exact same type of error when used as a target method, I was leaning toward trying that.

      The reason being, is that let's say you have the 5.12 source -- it shouldn't be different for different platforms. So the @ISA chain should be the same and if I call print on a IO::File -- it derives from IO::Handle -- so unless object calling is completely broken on 5.12 -- which it wasn't, AFAIR. But something was bizarre with having pre-methods (verb object), work when object->verb did not in that time frame. So it would make more sense to hope the same thing that affected 'say', is affecting 'print' ??? Does that sound logical/reasonable?

      I.e. if the problem mentioned with 'say' said putting those two use statements in was the solution they tried, I'd likely try it first.

      I have no way to test it other than wait for more test reports to come in, unless someone knows of a way to run it more quickly...but haven't uploaded new source yet... was still dwelling on how I wanted to solve the windows case...that and working on other things while my brain 'stews'...;-)...

      Later...

      Uploaded V1.0.12 with the BSD and the Win fix. Of course now, every other platform will break... but hey! ;-)....ok ... maybe not linux and maybe not windows...(testing on windows in strawberry is less than fun -- no bash! I do most of my windows cmdline stuff in cygwin)...

        "no bash"

        IIRC there's a MinGW non-Cygwin build of bash. I've also found using GNU utilities for Win32 within cmd.exe mostly acceptable, apart from the appalling implementation of tab-completion.

        package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2014-09-21 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls