Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Cheap idioms

by DapperDan (Pilgrim)
on Oct 13, 2002 at 11:06 UTC ( #204884=note: print w/replies, xml ) Need Help??

in reply to Cheap idioms

Hi Juerd-

Nice post.

I think maybe the only problem with this is that it's not an idiom yet. The thing about idioms IMHO is that it matters less whether they're readable because you just recognise it and say "oh this is that idiom" and move on. That takes time because people have to start using the idiom. I guess as with every other new idea, you need some early adopters. :)

But that shouldn't be a problem for long; I will always know what that piece of code means when I see it now.

I too get tired of coding up little slurps all the time (generally using local $/). I presume I can use this for any handle and not just ARGV?

Replies are listed 'Best First'.
Re^2: Cheap idioms
by Aristotle (Chancellor) on Oct 13, 2002 at 11:16 UTC
    Since @ARGV is localized, it doesn't destroy the main program's @ARGV contents. And by using @ARGV you get away with the magic diamond operator, thus avoiding the need to open the file yourself. It's a really beautiful idiom. Juerd++.

    Makeshifts last the longest.

      Thank you for the clarification.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://204884]
[ambrus]: Corion: you could also consider using IO::Async and its POE driver and some HTTP module for it, but I don't know if that would solve your problems with AnyEvent+POE
[ambrus]: Corion: wait, you didn't say POE. You said Prima, let me look up what that is.
[ambrus]: Corion: have you considered just writing an AnyEvent integration for that thing?
[ambrus]: Or perhaps pushing schmorp to write one?
[ambrus]: Also, searching for an existing one on CPAN obviously
[Corion]: Prima, which is mostly cooperative multitasking
[ambrus]: Corion: also (sorry for the obvious ideas) consider running your HTTP thing in a separate process from Prima (separate thread won't work well if you need a perl interpreter on both sides)
[Corion]: ambrus: Yeah, that's the alternative which I considered, at least for file I/O, but as I only want to simply do HTTP from my Prima app :)
[Corion]: Schmorp is more a Gtk+ guy
[ambrus]: Corion: yes, I've found Prima on cpan, but can you point to where its event loop is documented?

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (11)
As of 2016-12-07 16:07 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (130 votes). Check out past polls.