Re: On 'unpack()' - How much did I eat?

2009-04-21 Thread Paul LeoNerd Evans
On Tue, Apr 21, 2009 at 10:24:10AM +0100, Paul LeoNerd Evans wrote: sub pull_int { my $self = shift; my $i = unpack( N, $self-{buffer} ); substr( $i, 0, 4 ) = ; return $i; } Uh.. obviously, that's meant to be substr( $self-{buffer}, 0, 4 ) = ; /me unpacks more

On 'unpack()' - How much did I eat?

2009-04-21 Thread Paul LeoNerd Evans
I find lately I've been doing a lot of binary protocol work, taking messages that live in TCP streams or files or similar, and doing lots of pack()/unpack() on them. I find what works best is to wrap up a message into an object, so I can do things like: my $field = $message-pull_int(); where

Google Announces Nine Students in GSoC2009 with The Perl Foundation

2009-04-21 Thread Jonathan Leto
Howdy, I have the extreme pleasure to announce that the Google Summer of Code 2009 has officially started and The Perl Foundation will be mentoring 9 students this year in a variety of projects. A breakdown of each student project and mentor with links to the project abstract can be found at [1].

Re: Naming advice for retry manager module

2009-04-21 Thread David Nicol
On Tue, Apr 21, 2009 at 3:11 PM, Bill Ward b...@wards.net wrote: Something like Object::Retry maybe?  Then things can inherit from it? The proposed module sounds more like a has-a than an is-a. Or maybe just a new method that would get included in the caller's namespace. Set the defaults at

Re: Naming advice for retry manager module

2009-04-21 Thread Bill Ward
On Tue, Apr 21, 2009 at 3:12 PM, David Nicol davidni...@gmail.com wrote: On Tue, Apr 21, 2009 at 3:11 PM, Bill Ward b...@wards.net wrote: Something like Object::Retry maybe?  Then things can inherit from it? The proposed module sounds more like a has-a than an is-a.  Or maybe just a new

Re: On 'unpack()' - How much did I eat?

2009-04-21 Thread Peter Pentchev
On Tue, Apr 21, 2009 at 10:24:10AM +0100, Paul LeoNerd Evans wrote: I find lately I've been doing a lot of binary protocol work, taking messages that live in TCP streams or files or similar, and doing lots of pack()/unpack() on them. [snip] Is there some neater way to do this? Can I either:

Re: Naming advice for retry manager module

2009-04-21 Thread Jonathan Yu
Hi: What about http://search.cpan.org/~dlo/Proc-BackOff-0.02/lib/Proc/BackOff.pm Proc::BackOff. It seems to implement a function similar to TCP packet retry backoff... The idea is that for every failure you wait X time before the next request; the next time, you wait 2X. etc. But there is also

Re: On 'unpack()' - How much did I eat?

2009-04-21 Thread Jonathan Yu
If a Perl patch can be made available for this purpose, then why not an XS/C module? On Tue, Apr 21, 2009 at 8:17 PM, Peter Pentchev r...@ringlet.net wrote: On Tue, Apr 21, 2009 at 10:24:10AM +0100, Paul LeoNerd Evans wrote: I find lately I've been doing a lot of binary protocol work, taking

Re: On 'unpack()' - How much did I eat?

2009-04-21 Thread Ben Morrow
Quoth r...@ringlet.net (Peter Pentchev): On Tue, Apr 21, 2009 at 10:24:10AM +0100, Paul LeoNerd Evans wrote: I find lately I've been doing a lot of binary protocol work, taking messages that live in TCP streams or files or similar, and doing lots of pack()/unpack() on them. [snip] Is