Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by perl-diddler (Hermit)
on Mar 15, 2013 at 21:29 UTC ( #1023781=note: print w/replies, xml ) Need Help??


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

Ah...I thought it was just an indirect method call...didn't know it was it's own special operator... Does it still have to be it's own special operator? I.e. are there places where the indirect method call wouldn't give the same behavior? (Apparently there were in the past, but what about now?)....
  • Comment on Re^6: perl 5.12 BSD portability (CPAN test result)...print

Replies are listed 'Best First'.
Re^7: perl 5.12 BSD portability (CPAN test result)...print
by ikegami (Pope) on Mar 16, 2013 at 18:35 UTC

    Assuming you're ok with breaking every program that does print $x, how would you implement IO::Handle::print without the print operator?

    There are other issues, but they're not worth mentioning after the above two.

      Um, I suppose I'm not sure I see the difference between a method called print, called indirectly, that appears to do the same thing as C<print> the operator.

      Could you explain the difference to someone to whom it is not obvious? ;-)

        Without an explicit filehandle, where does the output of print $x go? How is Perl to tell the difference between "print the contents of $_ to the filehandle in $x" from "print the contents of $x to the currently selected filehandle"?

        So you want me to explains how it's impossible to write the method without the print operator? Well, why don't you try it.

        Or are you asking me to explain why they don't do the same thing? Well, consider

        >perl -le"$x = 'abc'; print $x;" abc

        As you can see, it doesn't call the method $x of class abc. If it was an indirect method call, it would have the following outcome:

        >perl -le"$x = 'abc'; $x->print;" Can't locate object method "print" via package "abc" (perhaps you forg +ot to load "abc"?) at -e line 1.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1023781]
help
Chatterbox?
[ambrus]: Hopefull the object isn't kept alive, the events are processed immediately, but you'd have to read a lot of source code to be sure about that.
[Corion]: ambrus: I think both of AnyEvent and Prima are pretty tight in their memory management because they both are cooperative multitasking and (I think) both use the Perl memory management for managing things
[Corion]: ambrus: And for Windows, I don't think that Prima knows if there still are messages queued for an object (in the Windows message loop). Finding that out would take lots of effort for little gain
[ambrus]: And even if this works, I'm still not sure you can't get double timeouts from a Timer.
[ambrus]: Corion: well Prima::Object says something like that the cleanup method will send an onDestory message and that you can't get more messages after cleanup, or something.
[Corion]: ambrus: Yeah - I don't think the deep source dive will be necessary if things are implemented as simple as they could be :)) And hopefully I won't need (more) timely object destruction. I can update the screen at 60Hz and hopefully even do HTTP ...
[Corion]: ... transfers in the background. Now that I think about it, this maybe even means that I can run the OpenGL filters on Youtube input :)
[ambrus]: Corion: I mentioned that the unix event loop of Prima always wakes up at least once every 0.2 seconds. Have you found out whether the win32 event loop of Prima does that too?
[Corion]: ambrus: Hmm - I would assume that the onDestroy message is sent from the destructor and doesn't go through the messageloop, but maybe it is sent when a window gets destroyed but all components are still alive...
[ambrus]: Corion: partly deep source dive, partly just conservative coding even if it adds an overhead.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2016-12-09 10:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.