From scottp at dd.com.au Sun Jun 1 03:08:55 2008 From: scottp at dd.com.au (Scott Penrose) Date: Sun, 1 Jun 2008 20:08:55 +1000 Subject: [Melbourne-pm] Data::Token In-Reply-To: <200805310511.m4V5BhXo069679@v.abnormal.com> References: <200805310511.m4V5BhXo069679@v.abnormal.com> Message-ID: Thanks Tim. This is what I have been trying to point out and you wrote it very well. The MD5 collisions are not relevant to Tokens. however... That being said however using SHA1 makes it a bigger space, and using Crypt::Random or similar improves the hard to emulate - so improves the level of risk. Then as you pointed out, protecting against attempts is the only solution. Scott On 31/05/2008, at 3:11 PM, Tim Hogard wrote: > I think the real problem is everyone is missing the point of tokens. > > They are a risk mitigation device which means the question > becomes "what is the risk?" > > I don't care if your using sha-1, sha-2, md5, md4 md1, crypt or crc > as none of them change the security of the token, they only change > the level of risk. > > Key aspects of token are: > 1) they must appear random (as in test 100,000 of them for randomness) > 2) they must not be guessable (this bit is hard) > 3) there must be a process in place to lock out users who attempt > to offer bad tokens. > > Number 3 is the key. If I can give out tokens that use a crc-16 > as a hash, then I can offer one of 65,536 random numbers a as hash > to your system and will have a 0.00152541338703% chance of getting > in, if my other are ok. If your system lets me send and average > of 32,000 hashs and then lets me in, you have a major problem. > > Another issue you need to be concerned with is looking at the > one to many relationship the other way around. Assume your token > ends up being a 4 digit pin line number. It would take an > average of 5,000 guesses to get your pin number but if I was > guessing 0001 today and 0002 at for many uses at once, that > may change the game. Think about hijacking a grocery stoes > pin pad system and just trying 0001 for everyone the first day > and 0002 the next and so on... If they get 5,000 customers, > how many vaild pins will you have by the end of the month? > > Now consider that problem in the DDOS coordinated many to many > attack... each of a million host is offering 3 bad tokens to your > system. What are the odds then? The solution is the user needs > to hand you a token and other id with every transaction. > > Even if your hitting bank high value accounts, what is the cost > risk if a valid token is hit? Once you figure in costs of insurance, > odds of reversing transactions and time wasted, it doesn't justify > the level of hashes typicaly used from an actuarial point of view > and the only reason its so secure is that big number crypto is > cheap. > > If your token system doesn't have good odds of keeping people out > if its hash just mirrors the input data, you need to find a better > way. > > -tim > >> >> Jacinta Richardson writes: >>> Scott Penrose wrote: >>> >>>> So the question is: >>>> >>>> 1) Am I missing the threads on the net >>>> 2) Are we jumping to the wrong conclusion because we are mixing >>>> document signature faking with unpredictability >>>> 3) Is this really a problem and we are the first to really solve >>>> it. >>> >>> I think it's 3 in so far that many of these modules were written >>> before 17th August 2004 (which is when Xiaoyun Wang,Dengguo Feng, >>> Xuejia Lai, and Hongbo Yu announced collisions for the full MD5 >>> space >>> (Their analytical attack was reported to take only one hour on an >>> IBM >>> p690 cluster.)). Prior to this, the general assumption seemed to be >>> that engineering a collision would be really hard, and finding a >>> collision by accident would be next to impossible. >>> >>> Since not everyone keeps up with cryptography news, people >>> continue to >>> use md5 despite its issues. This is not necessarily because it's a >>> good idea. It may even be as simple as when people think of hashing >>> algorithms the first one that comes to mind is md5. >>> >>> I expect that for the purposes of generating tokens, particularly >>> with >>> the use of a salt, that these issues aren't really a problem. >>> However, if you do so you are choosing to provide a less secure >>> token >>> than you could otherwise. I think in general, using md5 for >>> anything >>> to do with security or with anything which might even be vaguely >>> connected with the idea of security, is looking like a bad idea. >> >> Mmmm. I am still trying to work out how to respond to the >> documentation >> Scott wrote, but my general feeling is that these tokens *are* used >> in a >> security sensitive context, and that token forgery is a genuine risk. >> >> As I said previously, though, it probably isn't a significant risk >> compared to other threats to your deployment: breaking an MD5 session >> token hash isn't (yet) an economically viable way for most >> attackers to >> abuse available services. >> >> On that basis the continued use of (compromised) MD5 or (soon to be >> compromised) SHA1 for the tokens is probably not sufficiently >> worrying >> to have to rush into changing them... yet. >> >> >> Like Jacinta, I also expect that Data::Token will be used in security >> related areas -- Apache::AuthCookie, for example -- even if the >> documentation *explicitly* states that it isn't suitable. >> >> On that basis planning for MD5 and SHA1 cracking being economically >> viable[1] on day, and having the module cope, is probably a good >> move. >> >> Regards, >> Daniel >> >> Footnotes: >> [1] If breaking CAPTCHA images is economically viable then stealing >> sessions by brute-force (or worse) attacks on the token >> identifying >> them is going to happen one of these days. One resource the >> attackers have in spades is CPU time. >> >> _______________________________________________ >> Melbourne-pm mailing list >> Melbourne-pm at pm.org >> http://mail.pm.org/mailman/listinfo/melbourne-pm >> > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From bjdean at bjdean.id.au Sun Jun 1 14:29:41 2008 From: bjdean at bjdean.id.au (Bradley Dean) Date: Sun, 1 Jun 2008 22:29:41 +0100 Subject: [Melbourne-pm] NEXT + AUTOLOAD problems Message-ID: <20080601212941.GB1828@bjdean.id.au> Greetings folks, I've been trying to get NEXT working with AUTOLOAD and it doesn't seem to be behaving as I would expect. Using $self->NEXT::ACTUAL::AUTOLOAD() should cause an exception to be thrown if the search for another AUTOLOAD in the inheritance tree fails. This allows AUTOLOADs to be written to handle specifif cases and then hand the search on - for example: sub AUTOLOAD { my ($self, @params) = @_; if ( _i_handle_this_case() ) { # Do something ... } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } NEXT::ACTUAL was added by Damian after Paul suggested that the default NEXT behaviour of failing silently was not good for AUTOLOAD. The problem I'm having is that I'm still seeing silent failures. I've written a quick test script (included in this email after the __END__ tag :) ) which results in the following output: AUTOLOAD:A a CALL: A AUTOLOAD:A AUTOLOAD:B b CALL: B AUTOLOAD:A AUTOLOAD:B AUTOLOAD:C c CALL: C AUTOLOAD:A AUTOLOAD:B AUTOLOAD:C d [UNDEF] That "d [UNDEF]" at the end means I'm getting an undef response from $obj->d() whereas I would hope for an exception saying "Can't locate object method ....". Poking around in NEXT.pm ($VERSION='0.60') the problem seems to be around line 63: my $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; while ($wanted_class =~ /^NEXT\b.*\b(UNSEEN|DISTINCT)\b/ && defined $call_method && $NEXT::SEEN->{$self,$call_method}++) { $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; } unless (defined $call_method) { return unless $wanted_class =~ /^NEXT:.*:ACTUAL/; (local $Carp::CarpLevel)++; croak qq(Can't locate object method "$wanted_method" ), qq(via package "$caller_class"); }; The unless block deals with the lack of a found $call_method, but the 'return unless $wanted_class =~ /^NEXT:.*:ACTUAL/;' is always returning for my test. Looking at the value of $wanted I see it's 'NEXT::AUTOLOAD' which in turn means that the value of $wanted_class is not matching /^NEXT:.*:ACTUAL/. Looking further I can't see any place that $NEXT::AUTOLOAD is set (indeed when I look at $NEXT::AUTOLOAD just in case it's being set automatically it is undefined). This means that $wanted_class will never match the pattern, so the exception will never be thrown. So that leaves me somewhat confused - if I comment out the 'return unless...' I get the result I want but that means that NEXT will start behaving like NEXT::ACTUAL. I cannot for the life of me find the string 'ACTUAL' anywhere to match on. I know I could make it work by refactoring the code to have hard coded noisy failures for NEXT::ACTUALL and quiet for NEXT - but I figure this must have worked for some test so I'm still a bit suspicious of my usage. Any and all insights or suggestions gratefully accepted! :) Cheerio, Brad __END__ #!/usr/bin/env perl use strict; use warnings; package B; use NEXT; our $AUTOLOAD; sub AUTOLOAD { print "AUTOLOAD:B\n"; my ($self, @params) = @_; if ( $AUTOLOAD =~ /b/ ) { return 'CALL: B'; } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } sub DESTROY {}; package C; use NEXT; our $AUTOLOAD; sub AUTOLOAD { print "AUTOLOAD:C\n"; my ($self, @params) = @_; if ( $AUTOLOAD =~ /c/ ) { return 'CALL: C'; } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } sub DESTROY {}; package A; use NEXT; our $AUTOLOAD; use base qw{B C}; sub AUTOLOAD { print "AUTOLOAD:A\n"; my ($self, @params) = @_; if ( $AUTOLOAD =~ /a/ ) { return 'CALL: A'; } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } sub DESTROY {}; package main; my $obj = bless {}, 'A'; print 'a ' . do { $obj->a() || '[UNDEF]' } . "\n"; print 'b ' . do { $obj->b() || '[UNDEF]' } . "\n"; print 'c ' . do { $obj->c() || '[UNDEF]' } . "\n"; print 'd ' . do { $obj->d() || '[UNDEF]' } . "\n"; -- Bradley Dean Software Engineer - http://bjdean.id.au/ Email: bjdean at bjdean.id.au Skype: skype at bjdean.id.au Mobile(Aus): +61-413014395 Mobile(UK): +44-7846895073 From damian at conway.org Sun Jun 1 16:15:17 2008 From: damian at conway.org (Damian Conway) Date: Mon, 02 Jun 2008 09:15:17 +1000 Subject: [Melbourne-pm] NEXT + AUTOLOAD problems In-Reply-To: <20080601212941.GB1828@bjdean.id.au> References: <20080601212941.GB1828@bjdean.id.au> Message-ID: <48432D85.7000405@conway.org> Bradley Dean wrote: > I've been trying to get NEXT working with AUTOLOAD and it doesn't seem to > be behaving as I would expect. > > Using $self->NEXT::ACTUAL::AUTOLOAD() should cause an exception to be > thrown if the search for another AUTOLOAD in the inheritance tree fails. Indeed it should. And, yes, it's broken. The actual problem is at this line in the NEXT::AUTOLOAD subroutine: 38 my $wanted = $NEXT::AUTOLOAD || 'NEXT::AUTOLOAD'; This line sets the $AUTOLOAD variable in the special case of calling $obj->NEXT::AUTOLOAD(@args) The problem is that the one circumstance in which $AUTOLOAD isn't set within an AUTOLOAD sub is when you actually call the sub directly (as above). So line 38 tries to set it for you. The problem is that it only tries to set it to 'NEXT::AUTOLOAD', rather than 'NEXT::ACTUAL::AUTOLOAD' if that's what you called. The version below fixes that problem (I hope). Give it a try. Damian -----cut----------cut----------cut----------cut----------cut----- package NEXT; $VERSION = '0.60_01'; use Carp; use strict; sub NEXT::ELSEWHERE::ancestors { my @inlist = shift; my @outlist = (); while (my $next = shift @inlist) { push @outlist, $next; no strict 'refs'; unshift @inlist, @{"$outlist[-1]::ISA"}; } return @outlist; } sub NEXT::ELSEWHERE::ordered_ancestors { my @inlist = shift; my @outlist = (); while (my $next = shift @inlist) { push @outlist, $next; no strict 'refs'; push @inlist, @{"$outlist[-1]::ISA"}; } return sort { $a->isa($b) ? -1 : $b->isa($a) ? +1 : 0 } @outlist; } sub NEXT::ELSEWHERE::buildAUTOLOAD { my $autoload_name = caller() . '::AUTOLOAD'; no strict 'refs'; *{$autoload_name} = sub { my ($self) = @_; my $depth = 1; until ((caller($depth))[3] !~ /^\(eval\)$/) { $depth++ } my $caller = (caller($depth))[3]; my $wanted = $NEXT::AUTOLOAD || $autoload_name; undef $NEXT::AUTOLOAD; my ($caller_class, $caller_method) = $caller =~ m{(.*)::(.*)}g; my ($wanted_class, $wanted_method) = $wanted =~ m{(.*)::(.*)}g; croak "Can't call $wanted from $caller" unless $caller_method eq $wanted_method; local ($NEXT::NEXT{$self,$wanted_method}, $NEXT::SEEN) = ($NEXT::NEXT{$self,$wanted_method}, $NEXT::SEEN); unless ($NEXT::NEXT{$self,$wanted_method}) { my @forebears = NEXT::ELSEWHERE::ancestors ref $self || $self, $wanted_class; while (@forebears) { last if shift @forebears eq $caller_class } no strict 'refs'; @{$NEXT::NEXT{$self,$wanted_method}} = map { *{"${_}::$caller_method"}{CODE}||() } @forebears unless $wanted_method eq 'AUTOLOAD'; @{$NEXT::NEXT{$self,$wanted_method}} = map { (*{"${_}::AUTOLOAD"}{CODE}) ? "${_}::AUTOLOAD" : ()} @forebears unless @{$NEXT::NEXT{$self,$wanted_method}||[]}; $NEXT::SEEN->{$self,*{$caller}{CODE}}++; } my $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; while ($wanted_class =~ /^NEXT\b.*\b(UNSEEN|DISTINCT)\b/ && defined $call_method && $NEXT::SEEN->{$self,$call_method}++) { $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; } unless (defined $call_method) { return unless $wanted_class =~ /^NEXT:.*:ACTUAL/; (local $Carp::CarpLevel)++; croak qq(Can't locate object method "$wanted_method" ), qq(via package "$caller_class"); }; return $self->$call_method(@_[1..$#_]) if ref $call_method eq 'CODE'; no strict 'refs'; ($wanted_method=${$caller_class."::AUTOLOAD"}) =~ s/.*::// if $wanted_method eq 'AUTOLOAD'; $$call_method = $caller_class."::NEXT::".$wanted_method; return $call_method->(@_); }; } no strict 'vars'; package NEXT::UNSEEN; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); package NEXT::DISTINCT; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); package NEXT::ACTUAL; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); package NEXT::ACTUAL::UNSEEN; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); package NEXT::ACTUAL::DISTINCT; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); package NEXT::UNSEEN::ACTUAL; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); package NEXT::DISTINCT::ACTUAL; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); sub EVERY::ELSEWHERE::buildAUTOLOAD { my $autoload_name = caller() . '::AUTOLOAD'; no strict 'refs'; *{$autoload_name} = sub { my ($self) = @_; my $depth = 1; until ((caller($depth))[3] !~ /^\(eval\)$/) { $depth++ } my $caller = (caller($depth))[3]; my $wanted = $EVERY::AUTOLOAD || $autoload_name; undef $EVERY::AUTOLOAD; my ($wanted_class, $wanted_method) = $wanted =~ m{(.*)::(.*)}g; local $NEXT::ALREADY_IN_EVERY{$self,$wanted_method} = $NEXT::ALREADY_IN_EVERY{$self,$wanted_method}; return if $NEXT::ALREADY_IN_EVERY{$self,$wanted_method}++; my @forebears = NEXT::ELSEWHERE::ordered_ancestors ref $self || $self, $wanted_class; @forebears = reverse @forebears if $wanted_class =~ /\bLAST\b/; no strict 'refs'; my %seen; my @every = map { my $sub = "${_}::$wanted_method"; !*{$sub}{CODE} || $seen{$sub}++ ? () : $sub } @forebears unless $wanted_method eq 'AUTOLOAD'; my $want = wantarray; if (@every) { if ($want) { return map {($_, [$self->$_(@_[1..$#_])])} @every; } elsif (defined $want) { return { map {($_, scalar($self->$_(@_[1..$#_])))} @every }; } else { $self->$_(@_[1..$#_]) for @every; return; } } @every = map { my $sub = "${_}::AUTOLOAD"; !*{$sub}{CODE} || $seen{$sub}++ ? () : "${_}::AUTOLOAD" } @forebears; if ($want) { return map { $$_ = ref($self)."::EVERY::".$wanted_method; ($_, [$self->$_(@_[1..$#_])]); } @every; } elsif (defined $want) { return { map { $$_ = ref($self)."::EVERY::".$wanted_method; ($_, scalar($self->$_(@_[1..$#_]))) } @every }; } else { for (@every) { $$_ = ref($self)."::EVERY::".$wanted_method; $self->$_(@_[1..$#_]); } return; } }; } package EVERY::LAST; @ISA = 'EVERY'; EVERY::ELSEWHERE::buildAUTOLOAD(); package EVERY; @ISA = 'NEXT'; EVERY::ELSEWHERE::buildAUTOLOAD(); 1; __END__ =head1 NAME NEXT.pm - Provide a pseudo-class NEXT (et al) that allows method redispatch =head1 SYNOPSIS use NEXT; package A; sub A::method { print "$_[0]: A method\n"; $_[0]->NEXT::method() } sub A::DESTROY { print "$_[0]: A dtor\n"; $_[0]->NEXT::DESTROY() } package B; use base qw( A ); sub B::AUTOLOAD { print "$_[0]: B AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } sub B::DESTROY { print "$_[0]: B dtor\n"; $_[0]->NEXT::DESTROY() } package C; sub C::method { print "$_[0]: C method\n"; $_[0]->NEXT::method() } sub C::AUTOLOAD { print "$_[0]: C AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } sub C::DESTROY { print "$_[0]: C dtor\n"; $_[0]->NEXT::DESTROY() } package D; use base qw( B C ); sub D::method { print "$_[0]: D method\n"; $_[0]->NEXT::method() } sub D::AUTOLOAD { print "$_[0]: D AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } sub D::DESTROY { print "$_[0]: D dtor\n"; $_[0]->NEXT::DESTROY() } package main; my $obj = bless {}, "D"; $obj->method(); # Calls D::method, A::method, C::method $obj->missing_method(); # Calls D::AUTOLOAD, B::AUTOLOAD, C::AUTOLOAD # Clean-up calls D::DESTROY, B::DESTROY, A::DESTROY, C::DESTROY =head1 DESCRIPTION NEXT.pm adds a pseudoclass named C to any program that uses it. If a method C calls C<$self-ENEXT::m()>, the call to C is redispatched as if the calling method had not originally been found. In other words, a call to C<$self-ENEXT::m()> resumes the depth-first, left-to-right search of C<$self>'s class hierarchy that resulted in the original call to C. Note that this is not the same thing as C<$self-ESUPER::m()>, which begins a new dispatch that is restricted to searching the ancestors of the current class. C<$self-ENEXT::m()> can backtrack past the current class -- to look for a suitable method in other ancestors of C<$self> -- whereas C<$self-ESUPER::m()> cannot. A typical use would be in the destructors of a class hierarchy, as illustrated in the synopsis above. Each class in the hierarchy has a DESTROY method that performs some class-specific action and then redispatches the call up the hierarchy. As a result, when an object of class D is destroyed, the destructors of I its parent classes are called (in depth-first, left-to-right order). Another typical use of redispatch would be in C'ed methods. If such a method determined that it was not able to handle a particular call, it might choose to redispatch that call, in the hope that some other C (above it, or to its left) might do better. By default, if a redispatch attempt fails to find another method elsewhere in the objects class hierarchy, it quietly gives up and does nothing (but see L<"Enforcing redispatch">). This gracious acquiescence is also unlike the (generally annoying) behaviour of C, which throws an exception if it cannot redispatch. Note that it is a fatal error for any method (including C) to attempt to redispatch any method that does not have the same name. For example: sub D::oops { print "oops!\n"; $_[0]->NEXT::other_method() } =head2 Enforcing redispatch It is possible to make C redispatch more demandingly (i.e. like C does), so that the redispatch throws an exception if it cannot find a "next" method to call. To do this, simple invoke the redispatch as: $self->NEXT::ACTUAL::method(); rather than: $self->NEXT::method(); The C tells C that there must actually be a next method to call, or it should throw an exception. C is most commonly used in C methods, as a means to decline an C request, but preserve the normal exception-on-failure semantics: sub AUTOLOAD { if ($AUTOLOAD =~ /foo|bar/) { # handle here } else { # try elsewhere shift()->NEXT::ACTUAL::AUTOLOAD(@_); } } By using C, if there is no other C to handle the method call, an exception will be thrown (as usually happens in the absence of a suitable C). =head2 Avoiding repetitions If C redispatching is used in the methods of a "diamond" class hierarchy: # A B # / \ / # C D # \ / # E use NEXT; package A; sub foo { print "called A::foo\n"; shift->NEXT::foo() } package B; sub foo { print "called B::foo\n"; shift->NEXT::foo() } package C; @ISA = qw( A ); sub foo { print "called C::foo\n"; shift->NEXT::foo() } package D; @ISA = qw(A B); sub foo { print "called D::foo\n"; shift->NEXT::foo() } package E; @ISA = qw(C D); sub foo { print "called E::foo\n"; shift->NEXT::foo() } E->foo(); then derived classes may (re-)inherit base-class methods through two or more distinct paths (e.g. in the way C inherits C twice -- through C and C). In such cases, a sequence of C redispatches will invoke the multiply inherited method as many times as it is inherited. For example, the above code prints: called E::foo called C::foo called A::foo called D::foo called A::foo called B::foo (i.e. C is called twice). In some cases this I be the desired effect within a diamond hierarchy, but in others (e.g. for destructors) it may be more appropriate to call each method only once during a sequence of redispatches. To cover such cases, you can redispatch methods via: $self->NEXT::DISTINCT::method(); rather than: $self->NEXT::method(); This causes the redispatcher to only visit each distinct C method once. That is, to skip any classes in the hierarchy that it has already visited during redispatch. So, for example, if the previous example were rewritten: package A; sub foo { print "called A::foo\n"; shift->NEXT::DISTINCT::foo() } package B; sub foo { print "called B::foo\n"; shift->NEXT::DISTINCT::foo() } package C; @ISA = qw( A ); sub foo { print "called C::foo\n"; shift->NEXT::DISTINCT::foo() } package D; @ISA = qw(A B); sub foo { print "called D::foo\n"; shift->NEXT::DISTINCT::foo() } package E; @ISA = qw(C D); sub foo { print "called E::foo\n"; shift->NEXT::DISTINCT::foo() } E->foo(); then it would print: called E::foo called C::foo called A::foo called D::foo called B::foo and omit the second call to C (since it would not be distinct from the first call to C). Note that you can also use: $self->NEXT::DISTINCT::ACTUAL::method(); or: $self->NEXT::ACTUAL::DISTINCT::method(); to get both unique invocation I exception-on-failure. Note that, for historical compatibility, you can also use C instead of C. =head2 Invoking all versions of a method with a single call Yet another pseudo-class that NEXT.pm provides is C. Its behaviour is considerably simpler than that of the C family. A call to: $obj->EVERY::foo(); calls I method named C that the object in C<$obj> has inherited. That is: use NEXT; package A; @ISA = qw(B D X); sub foo { print "A::foo " } package B; @ISA = qw(D X); sub foo { print "B::foo " } package X; @ISA = qw(D); sub foo { print "X::foo " } package D; sub foo { print "D::foo " } package main; my $obj = bless {}, 'A'; $obj->EVERY::foo(); # prints" A::foo B::foo X::foo D::foo Prefixing a method call with C causes every method in the object's hierarchy with that name to be invoked. As the above example illustrates, they are not called in Perl's usual "left-most-depth-first" order. Instead, they are called "breadth-first-dependency-wise". That means that the inheritance tree of the object is traversed breadth-first and the resulting order of classes is used as the sequence in which methods are called. However, that sequence is modified by imposing a rule that the appropriate method of a derived class must be called before the same method of any ancestral class. That's why, in the above example, C is called before C, even though C comes before C in C<@B::ISA>. In general, there's no need to worry about the order of calls. They will be left-to-right, breadth-first, most-derived-first. This works perfectly for most inherited methods (including destructors), but is inappropriate for some kinds of methods (such as constructors, cloners, debuggers, and initializers) where it's more appropriate that the least-derived methods be called first (as more-derived methods may rely on the behaviour of their "ancestors"). In that case, instead of using the C pseudo-class: $obj->EVERY::foo(); # prints" A::foo B::foo X::foo D::foo you can use the C pseudo-class: $obj->EVERY::LAST::foo(); # prints" D::foo X::foo B::foo A::foo which reverses the order of method call. Whichever version is used, the actual methods are called in the same context (list, scalar, or void) as the original call via C, and return: =over =item * A hash of array references in list context. Each entry of the hash has the fully qualified method name as its key and a reference to an array containing the method's list-context return values as its value. =item * A reference to a hash of scalar values in scalar context. Each entry of the hash has the fully qualified method name as its key and the method's scalar-context return values as its value. =item * Nothing in void context (obviously). =back =head2 Using C methods The typical way to use an C call is to wrap it in another base method, that all classes inherit. For example, to ensure that every destructor an object inherits is actually called (as opposed to just the left-most-depth-first-est one): package Base; sub DESTROY { $_[0]->EVERY::Destroy } package Derived1; use base 'Base'; sub Destroy {...} package Derived2; use base 'Base', 'Derived1'; sub Destroy {...} et cetera. Every derived class than needs its own clean-up behaviour simply adds its own C method (I a C method), which the call to C in the inherited destructor then correctly picks up. Likewise, to create a class hierarchy in which every initializer inherited by a new object is invoked: package Base; sub new { my ($class, %args) = @_; my $obj = bless {}, $class; $obj->EVERY::LAST::Init(\%args); } package Derived1; use base 'Base'; sub Init { my ($argsref) = @_; ... } package Derived2; use base 'Base', 'Derived1'; sub Init { my ($argsref) = @_; ... } et cetera. Every derived class than needs some additional initialization behaviour simply adds its own C method (I a C method), which the call to C in the inherited constructor then correctly picks up. =head1 AUTHOR Damian Conway (damian at conway.org) =head1 BUGS AND IRRITATIONS Because it's a module, not an integral part of the interpreter, NEXT.pm has to guess where the surrounding call was found in the method look-up sequence. In the presence of diamond inheritance patterns it occasionally guesses wrong. It's also too slow (despite caching). Comment, suggestions, and patches welcome. =head1 COPYRIGHT Copyright (c) 2000-2001, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. From bjdean at bjdean.id.au Sun Jun 1 17:53:51 2008 From: bjdean at bjdean.id.au (Bradley Dean) Date: Mon, 2 Jun 2008 01:53:51 +0100 Subject: [Melbourne-pm] NEXT + AUTOLOAD problems In-Reply-To: <48432D85.7000405@conway.org> References: <20080601212941.GB1828@bjdean.id.au> <48432D85.7000405@conway.org> Message-ID: <20080602005351.GA15584@bjdean.id.au> Hi Damian, On Mon, Jun 02, 2008 at 09:15:17AM +1000, Damian Conway wrote: > Bradley Dean wrote: > > >I've been trying to get NEXT working with AUTOLOAD and it doesn't seem to > >be behaving as I would expect. > > > >Using $self->NEXT::ACTUAL::AUTOLOAD() should cause an exception to be > >thrown if the search for another AUTOLOAD in the inheritance tree fails. > > Indeed it should. And, yes, it's broken. Ah good - I'm not going mad. :) > The actual problem is at this line in the NEXT::AUTOLOAD subroutine: > > 38 my $wanted = $NEXT::AUTOLOAD || 'NEXT::AUTOLOAD'; > > This line sets the $AUTOLOAD variable in the special case of calling > > $obj->NEXT::AUTOLOAD(@args) > > The problem is that the one circumstance in which $AUTOLOAD isn't set > within an AUTOLOAD sub is when you actually call the sub directly (as > above). So line 38 tries to set it for you. The problem is that it only > tries to set it to 'NEXT::AUTOLOAD', rather than 'NEXT::ACTUAL::AUTOLOAD' > if that's what you called. > > The version below fixes that problem (I hope). Give it a try. Looks almost right - it fixed my problem but broke when I tested with just NEXT::AUTOLOAD because you hadn't called NEXT::ELSEWHERE::buildAUTOLOAD() on the NEXT namespace: --- NEXT.pm.damian 2008-05-16 13:03:52.000000000 +0100 +++ NEXT.pm 2008-05-16 13:08:52.000000000 +0100 @@ -87,6 +87,7 @@ return $call_method->(@_); }; } +NEXT::ELSEWHERE::buildAUTOLOAD(); no strict 'vars'; package NEXT::UNSEEN; @ISA = 'NEXT'; NEXT::ELSEWHERE::buildAUTOLOAD(); After making that change I see silent failure as expected for NEXT and exceptions raised for NEXT::ACTUAL. I've run that version through the tests in NEXT-0.60.tar.gz with no errors. That said - I've also noticed that there's a t/actual.t which did not catch the original error. Here's a Test::More script which would have revealed the initial problem (and which now passes using the new version): -----cut----------cut----------cut----------cut----------cut----- use Test::More 'no_plan'; BEGIN { if ($ENV{PERL_CORE}) { chdir('t') if -d 't'; @INC = qw(../lib); } } BEGIN { use_ok('NEXT') }; package B; use NEXT; our $AUTOLOAD; sub AUTOLOAD { my ($self, @params) = @_; if ( $AUTOLOAD =~ /b/ ) { return 'CALL: B'; } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } sub DESTROY {}; package C; use NEXT; our $AUTOLOAD; sub AUTOLOAD { my ($self, @params) = @_; if ( $AUTOLOAD =~ /c/ ) { return 'CALL: C'; } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } sub DESTROY {}; package A; use NEXT; our $AUTOLOAD; use base qw{B C}; sub AUTOLOAD { my ($self, @params) = @_; if ( $AUTOLOAD =~ /a/ ) { return 'CALL: A'; } else { return $self->NEXT::ACTUAL::AUTOLOAD(@params); } } sub DESTROY {}; package main; my $obj = bless {}, 'A'; is( $obj->a() , 'CALL: A' , 'Call to ->a() resolved without error' ); is( $obj->b() , 'CALL: B' , 'Call to ->b() resolved without error' ); is( $obj->c() , 'CALL: C' , 'Call to ->c() resolved without error' ); eval{ $obj->d() }; like( $@ , qr/Can't locate object method/ , 'Called to ->d() fails with "Cannot locate..." exception' ); -----cut----------cut----------cut----------cut----------cut----- Cheerio, Brad > > Damian > > -----cut----------cut----------cut----------cut----------cut----- > > package NEXT; > $VERSION = '0.60_01'; > use Carp; > use strict; > > sub NEXT::ELSEWHERE::ancestors > { > my @inlist = shift; > my @outlist = (); > while (my $next = shift @inlist) { > push @outlist, $next; > no strict 'refs'; > unshift @inlist, @{"$outlist[-1]::ISA"}; > } > return @outlist; > } > > sub NEXT::ELSEWHERE::ordered_ancestors > { > my @inlist = shift; > my @outlist = (); > while (my $next = shift @inlist) { > push @outlist, $next; > no strict 'refs'; > push @inlist, @{"$outlist[-1]::ISA"}; > } > return sort { $a->isa($b) ? -1 > : $b->isa($a) ? +1 > : 0 } @outlist; > } > > sub NEXT::ELSEWHERE::buildAUTOLOAD > { > my $autoload_name = caller() . '::AUTOLOAD'; > > no strict 'refs'; > *{$autoload_name} = sub { > my ($self) = @_; > my $depth = 1; > until ((caller($depth))[3] !~ /^\(eval\)$/) { $depth++ } > my $caller = (caller($depth))[3]; > my $wanted = $NEXT::AUTOLOAD || $autoload_name; > undef $NEXT::AUTOLOAD; > my ($caller_class, $caller_method) = $caller =~ m{(.*)::(.*)}g; > my ($wanted_class, $wanted_method) = $wanted =~ m{(.*)::(.*)}g; > croak "Can't call $wanted from $caller" > unless $caller_method eq $wanted_method; > > local ($NEXT::NEXT{$self,$wanted_method}, $NEXT::SEEN) = > ($NEXT::NEXT{$self,$wanted_method}, $NEXT::SEEN); > > > unless ($NEXT::NEXT{$self,$wanted_method}) { > my @forebears = > NEXT::ELSEWHERE::ancestors ref $self || $self, > $wanted_class; > while (@forebears) { > last if shift @forebears eq $caller_class > } > no strict 'refs'; > @{$NEXT::NEXT{$self,$wanted_method}} = > map { *{"${_}::$caller_method"}{CODE}||() } @forebears > unless $wanted_method eq 'AUTOLOAD'; > @{$NEXT::NEXT{$self,$wanted_method}} = > map { (*{"${_}::AUTOLOAD"}{CODE}) ? "${_}::AUTOLOAD" : ()} > @forebears > unless @{$NEXT::NEXT{$self,$wanted_method}||[]}; > $NEXT::SEEN->{$self,*{$caller}{CODE}}++; > } > my $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; > while ($wanted_class =~ /^NEXT\b.*\b(UNSEEN|DISTINCT)\b/ > && defined $call_method > && $NEXT::SEEN->{$self,$call_method}++) { > $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; > } > unless (defined $call_method) { > return unless $wanted_class =~ /^NEXT:.*:ACTUAL/; > (local $Carp::CarpLevel)++; > croak qq(Can't locate object method "$wanted_method" ), > qq(via package "$caller_class"); > }; > return $self->$call_method(@_[1..$#_]) if ref $call_method eq > 'CODE'; > no strict 'refs'; > ($wanted_method=${$caller_class."::AUTOLOAD"}) =~ s/.*::// > if $wanted_method eq 'AUTOLOAD'; > $$call_method = $caller_class."::NEXT::".$wanted_method; > return $call_method->(@_); > }; > } > > no strict 'vars'; > package NEXT::UNSEEN; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > package NEXT::DISTINCT; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > package NEXT::ACTUAL; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > package NEXT::ACTUAL::UNSEEN; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > package NEXT::ACTUAL::DISTINCT; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > package NEXT::UNSEEN::ACTUAL; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > package NEXT::DISTINCT::ACTUAL; @ISA = 'NEXT'; > NEXT::ELSEWHERE::buildAUTOLOAD(); > > sub EVERY::ELSEWHERE::buildAUTOLOAD > { > my $autoload_name = caller() . '::AUTOLOAD'; > > no strict 'refs'; > *{$autoload_name} = sub { > my ($self) = @_; > my $depth = 1; > until ((caller($depth))[3] !~ /^\(eval\)$/) { $depth++ } > my $caller = (caller($depth))[3]; > my $wanted = $EVERY::AUTOLOAD || $autoload_name; > undef $EVERY::AUTOLOAD; > my ($wanted_class, $wanted_method) = $wanted =~ m{(.*)::(.*)}g; > > local $NEXT::ALREADY_IN_EVERY{$self,$wanted_method} = > $NEXT::ALREADY_IN_EVERY{$self,$wanted_method}; > > return if $NEXT::ALREADY_IN_EVERY{$self,$wanted_method}++; > > my @forebears = NEXT::ELSEWHERE::ordered_ancestors ref $self || > $self, > $wanted_class; > @forebears = reverse @forebears if $wanted_class =~ /\bLAST\b/; > no strict 'refs'; > my %seen; > my @every = map { my $sub = "${_}::$wanted_method"; > !*{$sub}{CODE} || $seen{$sub}++ ? () : $sub > } @forebears > unless $wanted_method eq 'AUTOLOAD'; > > my $want = wantarray; > if (@every) { > if ($want) { > return map {($_, [$self->$_(@_[1..$#_])])} @every; > } > elsif (defined $want) { > return { map {($_, scalar($self->$_(@_[1..$#_])))} > @every > }; > } > else { > $self->$_(@_[1..$#_]) for @every; > return; > } > } > > @every = map { my $sub = "${_}::AUTOLOAD"; > !*{$sub}{CODE} || $seen{$sub}++ ? () : "${_}::AUTOLOAD" > } @forebears; > if ($want) { > return map { $$_ = ref($self)."::EVERY::".$wanted_method; > ($_, [$self->$_(@_[1..$#_])]); > } @every; > } > elsif (defined $want) { > return { map { $$_ = ref($self)."::EVERY::".$wanted_method; > ($_, scalar($self->$_(@_[1..$#_]))) > } @every > }; > } > else { > for (@every) { > $$_ = ref($self)."::EVERY::".$wanted_method; > $self->$_(@_[1..$#_]); > } > return; > } > }; > } > > package EVERY::LAST; @ISA = 'EVERY'; > EVERY::ELSEWHERE::buildAUTOLOAD(); > package EVERY; @ISA = 'NEXT'; > EVERY::ELSEWHERE::buildAUTOLOAD(); > > > 1; > > __END__ > > =head1 NAME > > NEXT.pm - Provide a pseudo-class NEXT (et al) that allows method redispatch > > > =head1 SYNOPSIS > > use NEXT; > > package A; > sub A::method { print "$_[0]: A method\n"; $_[0]->NEXT::method() } > sub A::DESTROY { print "$_[0]: A dtor\n"; $_[0]->NEXT::DESTROY() } > > package B; > use base qw( A ); > sub B::AUTOLOAD { print "$_[0]: B AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } > sub B::DESTROY { print "$_[0]: B dtor\n"; $_[0]->NEXT::DESTROY() } > > package C; > sub C::method { print "$_[0]: C method\n"; $_[0]->NEXT::method() } > sub C::AUTOLOAD { print "$_[0]: C AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } > sub C::DESTROY { print "$_[0]: C dtor\n"; $_[0]->NEXT::DESTROY() } > > package D; > use base qw( B C ); > sub D::method { print "$_[0]: D method\n"; $_[0]->NEXT::method() } > sub D::AUTOLOAD { print "$_[0]: D AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } > sub D::DESTROY { print "$_[0]: D dtor\n"; $_[0]->NEXT::DESTROY() } > > package main; > > my $obj = bless {}, "D"; > > $obj->method(); # Calls D::method, A::method, C::method > $obj->missing_method(); # Calls D::AUTOLOAD, B::AUTOLOAD, C::AUTOLOAD > > # Clean-up calls D::DESTROY, B::DESTROY, A::DESTROY, C::DESTROY > > > > =head1 DESCRIPTION > > NEXT.pm adds a pseudoclass named C to any program > that uses it. If a method C calls C<$self-ENEXT::m()>, the call to > C is redispatched as if the calling method had not originally been found. > > In other words, a call to C<$self-ENEXT::m()> resumes the depth-first, > left-to-right search of C<$self>'s class hierarchy that resulted in the > original call to C. > > Note that this is not the same thing as C<$self-ESUPER::m()>, which > begins a new dispatch that is restricted to searching the ancestors > of the current class. C<$self-ENEXT::m()> can backtrack > past the current class -- to look for a suitable method in other > ancestors of C<$self> -- whereas C<$self-ESUPER::m()> cannot. > > A typical use would be in the destructors of a class hierarchy, > as illustrated in the synopsis above. Each class in the hierarchy > has a DESTROY method that performs some class-specific action > and then redispatches the call up the hierarchy. As a result, > when an object of class D is destroyed, the destructors of I > its parent classes are called (in depth-first, left-to-right order). > > Another typical use of redispatch would be in C'ed methods. > If such a method determined that it was not able to handle a > particular call, it might choose to redispatch that call, in the > hope that some other C (above it, or to its left) might > do better. > > By default, if a redispatch attempt fails to find another method > elsewhere in the objects class hierarchy, it quietly gives up and does > nothing (but see L<"Enforcing redispatch">). This gracious acquiescence > is also unlike the (generally annoying) behaviour of C, which > throws an exception if it cannot redispatch. > > Note that it is a fatal error for any method (including C) > to attempt to redispatch any method that does not have the > same name. For example: > > sub D::oops { print "oops!\n"; $_[0]->NEXT::other_method() } > > > =head2 Enforcing redispatch > > It is possible to make C redispatch more demandingly (i.e. like > C does), so that the redispatch throws an exception if it cannot > find a "next" method to call. > > To do this, simple invoke the redispatch as: > > $self->NEXT::ACTUAL::method(); > > rather than: > > $self->NEXT::method(); > > The C tells C that there must actually be a next method to > call, > or it should throw an exception. > > C is most commonly used in C methods, as a means to > decline an C request, but preserve the normal exception-on-failure > semantics: > > sub AUTOLOAD { > if ($AUTOLOAD =~ /foo|bar/) { > # handle here > } > else { # try elsewhere > shift()->NEXT::ACTUAL::AUTOLOAD(@_); > } > } > > By using C, if there is no other C to handle the > method call, an exception will be thrown (as usually happens in the absence > of > a suitable C). > > > =head2 Avoiding repetitions > > If C redispatching is used in the methods of a "diamond" class > hierarchy: > > # A B > # / \ / > # C D > # \ / > # E > > use NEXT; > > package A; > sub foo { print "called A::foo\n"; shift->NEXT::foo() } > > package B; > sub foo { print "called B::foo\n"; shift->NEXT::foo() } > > package C; @ISA = qw( A ); > sub foo { print "called C::foo\n"; shift->NEXT::foo() } > > package D; @ISA = qw(A B); > sub foo { print "called D::foo\n"; shift->NEXT::foo() } > > package E; @ISA = qw(C D); > sub foo { print "called E::foo\n"; shift->NEXT::foo() } > > E->foo(); > > then derived classes may (re-)inherit base-class methods through two or > more distinct paths (e.g. in the way C inherits C twice -- > through C and C). In such cases, a sequence of C redispatches > will invoke the multiply inherited method as many times as it is > inherited. For example, the above code prints: > > called E::foo > called C::foo > called A::foo > called D::foo > called A::foo > called B::foo > > (i.e. C is called twice). > > In some cases this I be the desired effect within a diamond hierarchy, > but in others (e.g. for destructors) it may be more appropriate to > call each method only once during a sequence of redispatches. > > To cover such cases, you can redispatch methods via: > > $self->NEXT::DISTINCT::method(); > > rather than: > > $self->NEXT::method(); > > This causes the redispatcher to only visit each distinct C method > once. That is, to skip any classes in the hierarchy that it has > already visited during redispatch. So, for example, if the > previous example were rewritten: > > package A; > sub foo { print "called A::foo\n"; shift->NEXT::DISTINCT::foo() } > > package B; > sub foo { print "called B::foo\n"; shift->NEXT::DISTINCT::foo() } > > package C; @ISA = qw( A ); > sub foo { print "called C::foo\n"; shift->NEXT::DISTINCT::foo() } > > package D; @ISA = qw(A B); > sub foo { print "called D::foo\n"; shift->NEXT::DISTINCT::foo() } > > package E; @ISA = qw(C D); > sub foo { print "called E::foo\n"; shift->NEXT::DISTINCT::foo() } > > E->foo(); > > then it would print: > > called E::foo > called C::foo > called A::foo > called D::foo > called B::foo > > and omit the second call to C (since it would not be distinct > from the first call to C). > > Note that you can also use: > > $self->NEXT::DISTINCT::ACTUAL::method(); > > or: > > $self->NEXT::ACTUAL::DISTINCT::method(); > > to get both unique invocation I exception-on-failure. > > Note that, for historical compatibility, you can also use > C instead of C. > > > =head2 Invoking all versions of a method with a single call > > Yet another pseudo-class that NEXT.pm provides is C. > Its behaviour is considerably simpler than that of the C family. > A call to: > > $obj->EVERY::foo(); > > calls I method named C that the object in C<$obj> has inherited. > That is: > > use NEXT; > > package A; @ISA = qw(B D X); > sub foo { print "A::foo " } > > package B; @ISA = qw(D X); > sub foo { print "B::foo " } > > package X; @ISA = qw(D); > sub foo { print "X::foo " } > > package D; > sub foo { print "D::foo " } > > package main; > > my $obj = bless {}, 'A'; > $obj->EVERY::foo(); # prints" A::foo B::foo X::foo D::foo > > Prefixing a method call with C causes every method in the > object's hierarchy with that name to be invoked. As the above example > illustrates, they are not called in Perl's usual "left-most-depth-first" > order. Instead, they are called "breadth-first-dependency-wise". > > That means that the inheritance tree of the object is traversed > breadth-first > and the resulting order of classes is used as the sequence in which methods > are called. However, that sequence is modified by imposing a rule that the > appropriate method of a derived class must be called before the same method > of > any ancestral class. That's why, in the above example, C is called > before C, even though C comes before C in C<@B::ISA>. > > In general, there's no need to worry about the order of calls. They will be > left-to-right, breadth-first, most-derived-first. This works perfectly for > most inherited methods (including destructors), but is inappropriate for > some kinds of methods (such as constructors, cloners, debuggers, and > initializers) where it's more appropriate that the least-derived methods be > called first (as more-derived methods may rely on the behaviour of their > "ancestors"). In that case, instead of using the C pseudo-class: > > $obj->EVERY::foo(); # prints" A::foo B::foo X::foo D::foo > > you can use the C pseudo-class: > > $obj->EVERY::LAST::foo(); # prints" D::foo X::foo B::foo A::foo > > which reverses the order of method call. > > Whichever version is used, the actual methods are called in the same > context (list, scalar, or void) as the original call via C, and > return: > > =over > > =item * > > A hash of array references in list context. Each entry of the hash has the > fully qualified method name as its key and a reference to an array > containing > the method's list-context return values as its value. > > =item * > > A reference to a hash of scalar values in scalar context. Each entry of the > hash has the > fully qualified method name as its key and the method's scalar-context > return values as its value. > > =item * > > Nothing in void context (obviously). > > =back > > =head2 Using C methods > > The typical way to use an C call is to wrap it in another base > method, that all classes inherit. For example, to ensure that every > destructor an object inherits is actually called (as opposed to just the > left-most-depth-first-est one): > > package Base; > sub DESTROY { $_[0]->EVERY::Destroy } > > package Derived1; > use base 'Base'; > sub Destroy {...} > > package Derived2; > use base 'Base', 'Derived1'; > sub Destroy {...} > > et cetera. Every derived class than needs its own clean-up > behaviour simply adds its own C method (I a C > method), > which the call to C in the inherited destructor > then correctly picks up. > > Likewise, to create a class hierarchy in which every initializer inherited > by > a new object is invoked: > > package Base; > sub new { > my ($class, %args) = @_; > my $obj = bless {}, $class; > $obj->EVERY::LAST::Init(\%args); > } > > package Derived1; > use base 'Base'; > sub Init { > my ($argsref) = @_; > ... > } > > package Derived2; > use base 'Base', 'Derived1'; > sub Init { > my ($argsref) = @_; > ... > } > > et cetera. Every derived class than needs some additional initialization > behaviour simply adds its own C method (I a C method), > which the call to C in the inherited constructor > then correctly picks up. > > > =head1 AUTHOR > > Damian Conway (damian at conway.org) > > =head1 BUGS AND IRRITATIONS > > Because it's a module, not an integral part of the interpreter, NEXT.pm > has to guess where the surrounding call was found in the method > look-up sequence. In the presence of diamond inheritance patterns > it occasionally guesses wrong. > > It's also too slow (despite caching). > > Comment, suggestions, and patches welcome. > > =head1 COPYRIGHT > > Copyright (c) 2000-2001, Damian Conway. All Rights Reserved. > This module is free software. It may be used, redistributed > and/or modified under the same terms as Perl itself. -- Bradley Dean Software Engineer - http://bjdean.id.au/ Email: bjdean at bjdean.id.au Skype: skype at bjdean.id.au Mobile(Aus): +61-413014395 Mobile(UK): +44-7846895073 From ickphum at gmail.com Sun Jun 1 20:24:05 2008 From: ickphum at gmail.com (Ian Macdonald) Date: Mon, 2 Jun 2008 13:24:05 +1000 Subject: [Melbourne-pm] How to build a local module repository Message-ID: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> Hi, I was wondering if people had good solutions for distributing internal code and known-to-work CPAN modules through a local repository. We have linux & WinXP boxes on site and up to now the CPAN modules we need (60+) have been installed on the WinXP boxes with a combination of CPAN and PPM, which has been painful due to dependencies, availability of up-to-date PPM modules, etc. Code distribution for our internal code has been done by shared drives for the WinXP boxes; our newer work has been on linux and we've just been installing the code separately on each machine, which will bite us eventually. We're currently trialling Strawberry Perl as an alternative to ASPerl, and we were looking to fix our code distribution at the same time by using CPAN::Site to create a local repository holding our local code and any CPAN modules we wished to freeze w.r.t. their versions; we've had several instances where upgrades to CPAN modules have caused regression failures or inconsistencies in our system. This way, all boxes could be installed with a single cpan bundle and any OS-specific issues can be handled in the relevant module's makefile. Does anybody have any better ideas, or can see problems with where we're going? PS on a related note; we've also thought about installing CPAN modules on new boxes by simply copying the perl/site directory from a working box. Assuming that the OS matches down to the patch level, is this a safe approach? -- Ian Macdonald datacomIT -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080602/991ae7b4/attachment.html From pat at patspam.com Sun Jun 1 20:52:11 2008 From: pat at patspam.com (Patrick Donelan) Date: Mon, 2 Jun 2008 13:52:11 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> Message-ID: <42321ee20806012052md6583b5g3800e22e1d38fc74@mail.gmail.com> Brian d foy wrote about using CPAN::Mini to do something similar in the Fall 2007 issue of The Perl Review (first page sample available here). There's been a few blog posts recently about CPAN::Mini (Perlbuzz etc..) which Google should turn up, and I can bring along my copy of TPR to the next meeting if you don't have one to hand. I haven't tried it myself so not sure if it will solve your problem, but might be a good place to start. Cheers, Patrick Donelan http://patspam.com On Mon, Jun 2, 2008 at 1:24 PM, Ian Macdonald wrote: > Hi, > > I was wondering if people had good solutions for distributing internal code > and known-to-work CPAN modules through a local repository. We have linux & > WinXP boxes on site and up to now the CPAN modules we need (60+) have been > installed on the WinXP boxes with a combination of CPAN and PPM, which has > been painful due to dependencies, availability of up-to-date PPM modules, > etc. > > Code distribution for our internal code has been done by shared drives for > the WinXP boxes; our newer work has been on linux and we've just been > installing the code separately on each machine, which will bite us > eventually. > > We're currently trialling Strawberry Perl as an alternative to ASPerl, and > we were looking to fix our code distribution at the same time by using > CPAN::Site to create a local repository holding our local code and any CPAN > modules we wished to freeze w.r.t. their versions; we've had several > instances where upgrades to CPAN modules have caused regression failures or > inconsistencies in our system. This way, all boxes could be installed with a > single cpan bundle and any OS-specific issues can be handled in the relevant > module's makefile. > > Does anybody have any better ideas, or can see problems with where we're > going? > > PS on a related note; we've also thought about installing CPAN modules on > new boxes by simply copying the perl/site directory from a working box. > Assuming that the OS matches down to the patch level, is this a safe > approach? > -- > Ian Macdonald > datacomIT > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080602/0dc78eb0/attachment.html From tjc at wintrmute.net Sun Jun 1 20:57:35 2008 From: tjc at wintrmute.net (Toby Corkindale) Date: Mon, 2 Jun 2008 13:57:35 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> Message-ID: <20080602035735.GH1210@roseberry> On Mon, Jun 02, 2008 at 01:24:05PM +1000, Ian Macdonald wrote: > Hi, > > I was wondering if people had good solutions for distributing internal code > and known-to-work CPAN modules through a local repository. We have linux & > WinXP boxes on site and up to now the CPAN modules we need (60+) have been > installed on the WinXP boxes with a combination of CPAN and PPM, which has > been painful due to dependencies, availability of up-to-date PPM modules, > etc. > > Code distribution for our internal code has been done by shared drives for > the WinXP boxes; our newer work has been on linux and we've just been > installing the code separately on each machine, which will bite us > eventually. > > We're currently trialling Strawberry Perl as an alternative to ASPerl, and > we were looking to fix our code distribution at the same time by using > CPAN::Site to create a local repository holding our local code and any CPAN > modules we wished to freeze w.r.t. their versions; we've had several > instances where upgrades to CPAN modules have caused regression failures or > inconsistencies in our system. This way, all boxes could be installed with a > single cpan bundle and any OS-specific issues can be handled in the relevant > module's makefile. > > Does anybody have any better ideas, or can see problems with where we're > going? I suggest using the distributions own tools for package management. RPM on RedHat, APT on Debian/Ubuntu, Portage on Gentoo, etc. I'm really unfamiliar with Windows so I'm not sure their system uses, but they must have something for enterprise management of windows servers, surely? > PS on a related note; we've also thought about installing CPAN modules on > new boxes by simply copying the perl/site directory from a working box. > Assuming that the OS matches down to the patch level, is this a safe > approach? Yes. In fact, given that Perl installs architecture-specific things under differing directories, so should even be able to share the directory between totally different machines too. (Assuming you install into that directory from each variant initially of course) Toby From pjf at perltraining.com.au Sun Jun 1 21:01:57 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Mon, 02 Jun 2008 14:01:57 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> Message-ID: <484370B5.6060605@perltraining.com.au> G'day Ian, Ian Macdonald wrote: > Does anybody have any better ideas, or can see problems with where we're > going? I agree with Toby's comments about using the native OS packaging system, but I'm not sure if any such thing exists for Windows. I believe that using CPAN::Site or a similar technology (eg, CPAN::Mini) to essentially make your own CPAN is a fine idea. It means you get the modules you want, in the locations your Perl expects them to be. However I've not used either CPAN::Site or CPAN::Mini, so I can't comment on its effectiveness. It certainly sounds like the traditional thing to do. Depending upon your circumstances, you may also wish to use PAR. You'll take both a space and a time hit on start-up, but it makes it very easy to bundle all the modules you need into a single archive, and then use that. For example, you can bundle all the modules required by a program into a single file with: pp -p -o mymodules.par myscript.pl You can then include in your program: use PAR 'mymodules.par'; use Foo::Bar; use Bar::Baz; and your code will automatically extract and load them from mymodules.par if they exist. You can even run the .par file directly (since it will also contains your script) with: parl mymodules.par Perl Training Australia has recently written a Perl tip on PAR at: http://perltraining.com.au/tips/2008-05-23.html PAR has pretty minimum dependencies. Distributing it to your target machines should be easier than distributing all the modules. In fact, you can even use PAR to build stand-alone .exes that don't require perl at all, or .pl files which contain their own module archive. Of course, you'll take a speed and space hit to do so. However, using PAR isn't all roses. You should be aware that: * You'll take a time AND space hit by using PAR, since modules will need to be extracted from the .par file. This isn't too bad, since PAR will cache the extracted modules locally, so you only get a big hit the first time. * There's currently a bug in parl, because it *always* uses the same cache directory. This means that if you have two different programs built into .par files, and they contain different versions of the same module or file, then only one of those modules will ever get used. * It doesn't always work with all modules. In particular, if there are .dll or .so files that need to be bundled, you may have to provide hints. In our perl-tip we've got a link to SweeperBot's builder, which demonstrates how to link in the various Image::Magick .dll files. * Unless you're using pure-perl modules, you'll need a full install of all the modules you want to use on a system with identical architecture where you're using 'pp' to build your .par files. * Systems built with PAR won't necessarily pick up upgraded modules that are on your systems; so if you're already going to the work of maintaining good installs of all your modules, PAR may make your distribution headaches worse. > PS on a related note; we've also thought about installing CPAN modules > on new boxes by simply copying the perl/site directory from a working > box. Assuming that the OS matches down to the patch level, is this a > safe approach? Well, you'll hit the same problems as we do with PAR when there are .dll/.so or other dependencies that don't necessarily live in perl/site. It also sounds rather difficult when it comes to backing out the changes; with a .par file you just delete the file. I've not tried copying the directories myself, so YMMV. Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From daniel at rimspace.net Sun Jun 1 21:16:08 2008 From: daniel at rimspace.net (Daniel Pittman) Date: Mon, 02 Jun 2008 14:16:08 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <484370B5.6060605@perltraining.com.au> (Paul Fenwick's message of "Mon, 02 Jun 2008 14:01:57 +1000") References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> <484370B5.6060605@perltraining.com.au> Message-ID: <873anwqxo7.fsf@rimspace.net> Paul Fenwick writes: > G'day Ian, > Ian Macdonald wrote: > >> Does anybody have any better ideas, or can see problems with where we're >> going? > > I agree with Toby's comments about using the native OS packaging system, but > I'm not sure if any such thing exists for Windows. > > I believe that using CPAN::Site or a similar technology (eg, CPAN::Mini) to > essentially make your own CPAN is a fine idea. It means you get the modules > you want, in the locations your Perl expects them to be. However I've not > used either CPAN::Site or CPAN::Mini, so I can't comment on its > effectiveness. It certainly sounds like the traditional thing to do. > > Depending upon your circumstances, you may also wish to use PAR. You'll > take both a space and a time hit on start-up, but it makes it very easy to > bundle all the modules you need into a single archive, and then use that. > For example, you can bundle all the modules required by a program into a > single file with: > > pp -p -o mymodules.par myscript.pl > > You can then include in your program: > > use PAR 'mymodules.par'; > use Foo::Bar; > use Bar::Baz; > > and your code will automatically extract and load them from > mymodules.par if they exist. The one other interesting feature of PAR, which I have yet to investigate, is that it can use an HTTP URL as a source for the PAR archive. That requires PAR::Repository::Client, but seems like a reasonable approach to ensuring that your client machines are consistent in their use of third party modules. Regards, Daniel If you /do/ use it, let us know, eh? From pat at patspam.com Sun Jun 1 21:21:24 2008 From: pat at patspam.com (Patrick Donelan) Date: Mon, 2 Jun 2008 14:21:24 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <484370B5.6060605@perltraining.com.au> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> <484370B5.6060605@perltraining.com.au> Message-ID: <42321ee20806012121r70392f03pd49468a733a51a3d@mail.gmail.com> > > > PS on a related note; we've also thought about installing CPAN modules > > on new boxes by simply copying the perl/site directory from a working > > box. Assuming that the OS matches down to the patch level, is this a > > safe approach? > > Well, you'll hit the same problems as we do with PAR when there are > .dll/.so > or other dependencies that don't necessarily live in perl/site. It also > sounds rather difficult when it comes to backing out the changes; with a > .par file you just delete the file. > > I've not tried copying the directories myself, so YMMV. WebGUI does the "copy the directory" thing for its "runtime environment" distribution, they bundle up a build of perl with a custom install dir, all required cpan modules, MySQL, Apache, etc.. into a subdir and then make that available for download (on a per-linux-distro basis). Co-exists fairly well next to your system perl, and you can easily backup/move your entrie web environment between machines. Patrick -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080602/ac8965d9/attachment-0001.html From scottp at dd.com.au Sun Jun 1 22:12:57 2008 From: scottp at dd.com.au (Scott Penrose) Date: Mon, 2 Jun 2008 15:12:57 +1000 Subject: [Melbourne-pm] Another Data::Token example Message-ID: <61C0F918-CA96-4E4B-8496-ECF26B8F057F@dd.com.au> As I was signing up to a web site today I realised there was another example to add for Tokens - Invitations. Gmail in the early days had tokens to allow you to sign up. You got given a few. These have all the same requirements as authentication tokens - in particular checked against a database etc. However they tend to be a lot shorter - e.g. one I used today is wzCWPFnw0d It would be a mistake though to be too general, it would probably be better to create Data::Token::Simple if that was required. Scott From sisyphus1 at optusnet.com.au Sun Jun 1 22:27:04 2008 From: sisyphus1 at optusnet.com.au (Sisyphus) Date: Mon, 2 Jun 2008 15:27:04 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> Message-ID: <64BDAD65A5EA43238ED8BC750F11611B@desktop2> ----- Original Message ----- From: "Ian Macdonald" . . > > We're currently trialling Strawberry Perl as an alternative to ASPerl You can, of course, use the dmake and mingw32 compiler that ships with Strawberry Perl, to build modules on ActivePerl. If Strawberry's c/bin is in the path, then (recent versions of) ActivePerl will automatically find dmake and mingw32, and use them to build modules. That is, dmake and mingw32 will work just as well with ActivePerl as they do with Strawberry Perl. Going in the opposite direction, the ppm packages that have been built for ActivePerl, will work just as well on Strawberry Perl. (You may already have been fully aware of that ... just thought I'd mention it in case you weren't, and could make use of it :-) > > PS on a related note; we've also thought about installing CPAN modules on > new boxes by simply copying the perl/site directory from a working box. > Assuming that the OS matches down to the patch level, is this a safe > approach? Two unlikely (but theoretically possible) gotchas: 1) ActiveState, at some time during their 5.8.x releases (I think it was during their 5.8.8 releases), started placing non-core modules that they shipped with their distros into perl/lib. Earlier builds had those modules placed in perl/site/lib. So there's a window of opportunity that this approach could lead to a situation where a particular installation of ActiveState perl ends up with certain modules in both perl/lib and perl/site/lib. This has the potential to be a little confusing - and even troublesome. If all of your WinXP ActivePerls have the same build number, then there's nothing to worry about on that score. (If they don't have the same build number, just check that the @INC ordering is the same.) 2) If a particular module has some hard coded paths built into it's config, and you copy it to a machine where those paths need to be different (eg because perl has been installed in a different location), then it's not going to work. For example, this is an issue with PDL, but you're probably not using PDL. I can't think of any other cases where this could happen - but they may exist. Cheers, Rob From ddick at aapt.net.au Mon Jun 2 03:11:07 2008 From: ddick at aapt.net.au (David Dick) Date: Mon, 02 Jun 2008 20:11:07 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <20080602035735.GH1210@roseberry> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> <20080602035735.GH1210@roseberry> Message-ID: <4843C73B.5060605@aapt.net.au> Toby Corkindale wrote: > I suggest using the distributions own tools for package management. RPM on > RedHat, APT on Debian/Ubuntu, Portage on Gentoo, etc. > I'm really unfamiliar with Windows so I'm not sure their system uses, but they > must have something for enterprise management of windows servers, surely? > Microsoft uses the msi format for native package management. They have releaseed an open source project called Wix that is hosted on sourceforge to generate native windows packages. Wix takes an XML file as input to describe files, environment variables, registry settings, services, etc and creates an appropriate .msi file with or without gui installer screen. There is a good tutorial at http://www.tramontana.co.hu/wix/ I've used wix on a number of projects and found it to be a pretty useful tool for generating packages. From toby.corkindale at rea-group.com Mon Jun 2 17:52:19 2008 From: toby.corkindale at rea-group.com (Toby Corkindale) Date: Tue, 03 Jun 2008 10:52:19 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <4843C73B.5060605@aapt.net.au> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> <20080602035735.GH1210@roseberry> <4843C73B.5060605@aapt.net.au> Message-ID: <484495C3.30502@rea-group.com> David Dick wrote: > Toby Corkindale wrote: >> I suggest using the distributions own tools for package management. RPM on >> RedHat, APT on Debian/Ubuntu, Portage on Gentoo, etc. >> I'm really unfamiliar with Windows so I'm not sure their system uses, but they >> must have something for enterprise management of windows servers, surely? >> > Microsoft uses the msi format for native package management. They have > releaseed an open source project called Wix that is hosted on > sourceforge to generate native windows packages. Wix takes an XML file > as input to describe files, environment variables, registry settings, > services, etc and creates an appropriate .msi file with or without gui > installer screen. There is a good tutorial at > http://www.tramontana.co.hu/wix/ I've used wix on a number of projects > and found it to be a pretty useful tool for generating packages. Does the Windows installer handle dependencies yet? That always annoyed me.. you'd go to install something, and then halfway through the install it'd bomb out and say "sorry, you need the .Net blahblah extension installed, you can get it from LINK." (I should really try out Vista or Server 2008 one of these days to see how things are going..) -- Toby Corkindale Software developer w: www.rea-group.com REA Group refers to realestate.com.au Ltd (ASX:REA) Warning - This e-mail transmission may contain confidential information. If you have received this transmission in error, please notify us immediately on (61 3) 9897 1121 or by reply email to the sender. You must destroy the e-mail immediately and not use, copy, distribute or disclose the contents. From daniel at rimspace.net Mon Jun 2 21:09:31 2008 From: daniel at rimspace.net (Daniel Pittman) Date: Tue, 03 Jun 2008 14:09:31 +1000 Subject: [Melbourne-pm] Looking for work... Message-ID: <87r6bf88hw.fsf@rimspace.net> G'day. I am looking for a new position, either to replace the four day a week contract I am just leaving, or full time. I have a very wide range of experience, including software development, systems administration and management, as a consequence of being a self-employed contractor for the last five years or so. I would be interested in software development, systems, or management roles, or something that combined all three -- ideally, something that involved Perl, Unix, and the chance to build things that have real world utility and effect. Y'all can find my resum? at http://rimspace.net/resume/resume.pdf and I would be very pleased if you were to pass it on freely to anywhere you thought was appropriate. You can contact me at this email address (daniel at rimspace.net) or by phone on 0401 155 707 if you want to discuss any opportunity. Regards, Daniel From ddick at aapt.net.au Tue Jun 3 04:45:16 2008 From: ddick at aapt.net.au (David Dick) Date: Tue, 03 Jun 2008 21:45:16 +1000 Subject: [Melbourne-pm] How to build a local module repository In-Reply-To: <484495C3.30502@rea-group.com> References: <38d47d520806012024x245ccc8do5ce876f2f0874ea4@mail.gmail.com> <20080602035735.GH1210@roseberry> <4843C73B.5060605@aapt.net.au> <484495C3.30502@rea-group.com> Message-ID: <48452ECC.3050805@aapt.net.au> Toby Corkindale wrote: > > Does the Windows installer handle dependencies yet? > Certainly not in a rpm/dpkg type fashion where you can request version X of a library, an smtp server and postgresql v8.2.1. I believe, although i haven't done it myself, that you can include the entire dependency _inside_ the package and specify it to be installed only if it doesn't already exist. But since there is no real central repository for windows packages, not really surprising. > (I should really try out Vista or Server 2008 one of these days to see > how things are going..) > Haven't seen anything that would excite anyone with Vista. The changing permissions/roles with Vista has provided frustrations, but no excitement. :) From pjf at perltraining.com.au Tue Jun 3 05:38:29 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Tue, 03 Jun 2008 22:38:29 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June Message-ID: <48453B45.4000104@perltraining.com.au> G'day Everyone, Wednesday 11th June (next week) is the second Wednesday of the month, which makes it Perl Mongers day. We don't yet have a speaker arranged, and I'm sure you've all heard enough from me. So, if you've ever wanted to talk at Melb.pm, or talk again, then speak up now. ;) Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From jarich at perltraining.com.au Wed Jun 4 21:34:28 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Thu, 05 Jun 2008 14:34:28 +1000 Subject: [Melbourne-pm] Regular expression musings Message-ID: <48476CD4.6030909@perltraining.com.au> I'm writing a Perl tip ( http://perltraining.com.au/tips/ ) about regular expression optimisations - the usual ones, and decided to benchmark some with respect to .*, .*? and alternatives. I considered the case of matching a string inside double quotes. I used one very long string copied three times with: * the whole string in quotes (1) * only the first word in quotes (2) * only the last word in quotes (3) * only one double quote (4) I figured that this covered all of my options since the regular engine would halt as soon as the second double quote was found. I also used the following expressions: /".*"/ (dot_star) /".*?"/ (dot_quest) /"[^"]"/ (brackets) What I expected to find was: * dot_star clearly fastest on 1 * dot_quest slower in general than brackets * brackets fastest on 2 and 4 (followed closely by dot_quest) * no significant time difference on 3 * very significant time difference between dot_quest and the others on 4 What I found instead was: * dot_star fastest on 1, 4 * dot_quest fastest on 2, 3 * brackets never fastest * no significant time difference between any of them on 3, 4. The benchmarking results are: Comparing over a string of length: 2159 Whole string quoted Rate brackets1 dot_quest1 dot_star1 brackets1 17958/s -- -75% -83% dot_quest1 71522/s 298% -- -33% dot_star1 107222/s 497% 50% -- First word only quoted Rate dot_star2 brackets2 dot_quest2 dot_star2 562469/s -- -31% -40% brackets2 813620/s 45% -- -13% dot_quest2 936418/s 66% 15% -- Last word only quoted Rate brackets3 dot_star3 dot_quest3 brackets3 68064/s -- -1% -2% dot_star3 68713/s 1% -- -1% dot_quest3 69176/s 2% 1% -- Single starting quote Rate dot_quest4 brackets4 dot_star4 dot_quest4 203988/s -- -0% -1% brackets4 204852/s 0% -- -1% dot_star4 206853/s 1% 1% -- This surprises me. I expected it to take more time for .*? to take something, try to match the ", fail and repeat; than to just compare a character to a bit map, consume it and repeat. I certainly didn't expect .*? to be 300% faster than [^"]* over a long string. I'm particularly surprised to see .*? be 15% faster than [^"]* over a string of 5 characters. This seems even more unusual because it's not that much slower over the 9 characters at the end of the string. My benchmarking code is attached. Can anyone spot any issues which might be influencing these results? All the best, Jacinta -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | -------------- next part -------------- A non-text attachment was scrubbed... Name: benchmarking-res.pl Type: application/x-perl Size: 9839 bytes Desc: not available Url : http://mail.pm.org/pipermail/melbourne-pm/attachments/20080605/ea152ab2/attachment.bin From alfiejohn at gmail.com Wed Jun 4 21:47:26 2008 From: alfiejohn at gmail.com (Alfie John) Date: Thu, 5 Jun 2008 14:47:26 +1000 Subject: [Melbourne-pm] Regular expression musings In-Reply-To: <48476CD4.6030909@perltraining.com.au> References: <48476CD4.6030909@perltraining.com.au> Message-ID: Hey Jacinta, If you're talking about optimisations, I think it would also be a good idea to include the tip - "don't use regular expressions". Using the same samples, I would be interested in seeing the results of a index()/substr() combo. Alfie On Thu, Jun 5, 2008 at 2:34 PM, Jacinta Richardson wrote: > I'm writing a Perl tip ( http://perltraining.com.au/tips/ ) about regular > expression optimisations - the usual ones, and decided to benchmark some with > respect to .*, .*? and alternatives. > > I considered the case of matching a string inside double quotes. I used one > very long string copied three times with: > > * the whole string in quotes (1) > * only the first word in quotes (2) > * only the last word in quotes (3) > * only one double quote (4) > > I figured that this covered all of my options since the regular engine would > halt as soon as the second double quote was found. I also used the following > expressions: > > /".*"/ (dot_star) > /".*?"/ (dot_quest) > /"[^"]"/ (brackets) > > What I expected to find was: > > * dot_star clearly fastest on 1 > * dot_quest slower in general than brackets > * brackets fastest on 2 and 4 (followed closely by dot_quest) > * no significant time difference on 3 > * very significant time difference between dot_quest and the others on 4 > > What I found instead was: > > * dot_star fastest on 1, 4 > * dot_quest fastest on 2, 3 > * brackets never fastest > * no significant time difference between any of them on 3, 4. > > The benchmarking results are: > > Comparing over a string of length: 2159 > Whole string quoted > Rate brackets1 dot_quest1 dot_star1 > brackets1 17958/s -- -75% -83% > dot_quest1 71522/s 298% -- -33% > dot_star1 107222/s 497% 50% -- > > First word only quoted > Rate dot_star2 brackets2 dot_quest2 > dot_star2 562469/s -- -31% -40% > brackets2 813620/s 45% -- -13% > dot_quest2 936418/s 66% 15% -- > > Last word only quoted > Rate brackets3 dot_star3 dot_quest3 > brackets3 68064/s -- -1% -2% > dot_star3 68713/s 1% -- -1% > dot_quest3 69176/s 2% 1% -- > > Single starting quote > Rate dot_quest4 brackets4 dot_star4 > dot_quest4 203988/s -- -0% -1% > brackets4 204852/s 0% -- -1% > dot_star4 206853/s 1% 1% -- > > > This surprises me. I expected it to take more time for .*? to take something, > try to match the ", fail and repeat; than to just compare a character to a bit > map, consume it and repeat. I certainly didn't expect .*? to be 300% faster > than [^"]* over a long string. I'm particularly surprised to see .*? be 15% > faster than [^"]* over a string of 5 characters. This seems even more unusual > because it's not that much slower over the 9 characters at the end of the string. > > My benchmarking code is attached. Can anyone spot any issues which might be > influencing these results? > > All the best, > > Jacinta > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > From jarich at perltraining.com.au Wed Jun 4 22:38:26 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Thu, 05 Jun 2008 15:38:26 +1000 Subject: [Melbourne-pm] Regular expression musings In-Reply-To: <48476CD4.6030909@perltraining.com.au> References: <48476CD4.6030909@perltraining.com.au> Message-ID: <48477BD2.9000802@perltraining.com.au> Heh. I've just shown that .* and .*? can fail very quickly. I feel so foolish. (Original data didn't need /s, but I should have put it in anyway). Corrected file attached and better benchmark results are: Comparing over a string of length: 2159 Whole string quoted Rate brackets1 dot_quest1 dot_star1 brackets1 16580/s -- -84% -93% dot_quest1 102920/s 521% -- -56% dot_star1 232662/s 1303% 126% -- First word only quoted Rate dot_star2 brackets2 dot_quest2 dot_star2 46541/s -- -94% -94% brackets2 744650/s 1500% -- -7% dot_quest2 804305/s 1628% 8% -- Last word only quoted Rate brackets3 dot_quest3 dot_star3 brackets3 65944/s -- -2% -2% dot_quest3 66987/s 2% -- -1% dot_star3 67626/s 3% 1% -- Single starting quote Rate dot_star4 dot_quest4 brackets4 dot_star4 192377/s -- -1% -2% dot_quest4 194869/s 1% -- -0% brackets4 195491/s 2% 0% -- Paul pointed out that Perl's way smarter than this and makes anchors of static points before running the regular expression. Which we can see when we turn on re 'debug': use re 'debug'; $string1 =~ /"(.*)"/s; exit; Compiling REx `"(.*)"' size 11 Got 92 bytes for offset annotations. first at 1 1: EXACT <">(3) 3: OPEN1(5) 5: STAR(7) 6: SANY(0) 7: CLOSE1(9) 9: EXACT <">(11) 11: END(0) anchored """ at 0 floating """ at 1..2147483647 (checking floating) minlen 2 Offsets: [11] 1[1] 0[0] 2[1] 0[0] 4[1] 3[1] 5[1] 0[0] 6[1] 0[0] 7[0] Guessing start of match, REx ""(.*)"" against ""Lorem ipsum dolor sit amet, consectetur adipisicing elit, s..."... Found floating substr """ at offset 2158... Found anchored substr """ at offset 0... Guessed: match at offset 0 Matching REx ""(.*)"" against ""Lorem ipsum dolor sit amet, consectetur adipisicing elit, s..." Setting an EVAL scope, savestack=14 0 <> <"Lorem ipsum> | 1: EXACT <"> 1 <"> | 3: OPEN1 1 <"> | 5: STAR SANY can match 2158 times out of 2147483647... Setting an EVAL scope, savestack=14 2158 <"> | 7: CLOSE1 2158 <"> | 9: EXACT <"> 2159 <> | 11: END Match successful! Freeing REx: `"\"(.*)\""' So Perl jumps to the anchors, and thus is so fast. I'm not sure how this ties in to the speed differences we see. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | -------------- next part -------------- A non-text attachment was scrubbed... Name: benchmarking-res.pl Type: application/x-perl Size: 10142 bytes Desc: not available Url : http://mail.pm.org/pipermail/melbourne-pm/attachments/20080605/7826dc9a/attachment-0001.bin From jarich at perltraining.com.au Wed Jun 4 22:55:42 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Thu, 05 Jun 2008 15:55:42 +1000 Subject: [Melbourne-pm] Regular expression musings In-Reply-To: References: <48476CD4.6030909@perltraining.com.au> Message-ID: <48477FDE.2070605@perltraining.com.au> Alfie John wrote: > Hey Jacinta, > > If you're talking about optimisations, I think it would also be a good > idea to include the tip - "don't use regular expressions". Using the > same samples, I would be interested in seeing the results of a > index()/substr() combo. Oh it will be in there. ;) Here are your requested results: Comparing over a string of length: 2159 Whole string quoted Rate brackets1 substr1 dot_quest1 dot_star1 brackets1 15420/s -- -85% -85% -93% substr1 101824/s 560% -- -0% -53% dot_quest1 102167/s 563% 0% -- -53% dot_star1 218741/s 1319% 115% 114% -- First word only quoted Rate dot_star2 substr2 brackets2 dot_quest2 dot_star2 46839/s -- -91% -94% -94% substr2 545553/s 1065% -- -26% -34% brackets2 735254/s 1470% 35% -- -11% dot_quest2 822619/s 1656% 51% 12% -- Last word only quoted Rate brackets3 dot_quest3 dot_star3 substr3 brackets3 66313/s -- -1% -2% -44% dot_quest3 67200/s 1% -- -0% -43% dot_star3 67411/s 2% 0% -- -43% substr3 117791/s 78% 75% 75% -- Single starting quote Rate substr4 dot_quest4 brackets4 dot_star4 substr4 178739/s -- -7% -8% -8% dot_quest4 191837/s 7% -- -1% -2% brackets4 194053/s 9% 1% -- -0% dot_star4 194858/s 9% 2% 0% -- Using: substr4 => sub { my $i1 = index($string4, q{"}, 0); return if $i1 < 0; my $i2 = index($string4, q{"}, $i1+1); return if $i2 < 0; my $str = substr($string4, $i1, $i2-$i1); return $str; } I'm a little surprised that substr does so badly on the single starting quote, but there you have it. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From alfiejohn at gmail.com Wed Jun 4 23:09:46 2008 From: alfiejohn at gmail.com (Alfie John) Date: Thu, 5 Jun 2008 16:09:46 +1000 Subject: [Melbourne-pm] Regular expression musings In-Reply-To: <48477FDE.2070605@perltraining.com.au> References: <48476CD4.6030909@perltraining.com.au> <48477FDE.2070605@perltraining.com.au> Message-ID: > I'm a little surprised that substr does so badly on the single starting quote, > but there you have it. I'm actually a bit surprised myself. Just goes to show that you should always benchmark your optimisations :) Alfie From Martin.G.Ryan at team.telstra.com Wed Jun 4 23:15:15 2008 From: Martin.G.Ryan at team.telstra.com (Ryan, Martin G) Date: Thu, 5 Jun 2008 16:15:15 +1000 Subject: [Melbourne-pm] Regular expression musings In-Reply-To: References: <48476CD4.6030909@perltraining.com.au> Message-ID: <589EE331794E0B4DA62A9ADE89BCB4057C0AD58D3F@WSMSG3103V.srv.dir.telstra.com> Maybe a bit out of the scope of a tip, but if your going to do lots of different RE's on a string, the "study" function might help. -----Original Message----- From: melbourne-pm-bounces+martin.g.ryan=team.telstra.com at pm.org [mailto:melbourne-pm-bounces+martin.g.ryan=team.telstra.com at pm.org] On Behalf Of Alfie John Sent: Thursday, 5 June 2008 2:47 PM To: Jacinta Richardson Cc: Melbourne Perlmongers Subject: Re: [Melbourne-pm] Regular expression musings Hey Jacinta, If you're talking about optimisations, I think it would also be a good idea to include the tip - "don't use regular expressions". Using the same samples, I would be interested in seeing the results of a index()/substr() combo. Alfie On Thu, Jun 5, 2008 at 2:34 PM, Jacinta Richardson wrote: > I'm writing a Perl tip ( http://perltraining.com.au/tips/ ) about > regular expression optimisations - the usual ones, and decided to > benchmark some with respect to .*, .*? and alternatives. > > I considered the case of matching a string inside double quotes. I > used one very long string copied three times with: > > * the whole string in quotes (1) > * only the first word in quotes (2) > * only the last word in quotes (3) > * only one double quote (4) > > I figured that this covered all of my options since the regular engine > would halt as soon as the second double quote was found. I also used > the following > expressions: > > /".*"/ (dot_star) > /".*?"/ (dot_quest) > /"[^"]"/ (brackets) > > What I expected to find was: > > * dot_star clearly fastest on 1 > * dot_quest slower in general than brackets > * brackets fastest on 2 and 4 (followed closely by dot_quest) > * no significant time difference on 3 > * very significant time difference between dot_quest and the > others on 4 > > What I found instead was: > > * dot_star fastest on 1, 4 > * dot_quest fastest on 2, 3 > * brackets never fastest > * no significant time difference between any of them on 3, 4. > > The benchmarking results are: > > Comparing over a string of length: 2159 Whole string quoted > Rate brackets1 dot_quest1 dot_star1 > brackets1 17958/s -- -75% -83% > dot_quest1 71522/s 298% -- -33% > dot_star1 107222/s 497% 50% -- > > First word only quoted > Rate dot_star2 brackets2 dot_quest2 > dot_star2 562469/s -- -31% -40% > brackets2 813620/s 45% -- -13% > dot_quest2 936418/s 66% 15% -- > > Last word only quoted > Rate brackets3 dot_star3 dot_quest3 > brackets3 68064/s -- -1% -2% > dot_star3 68713/s 1% -- -1% > dot_quest3 69176/s 2% 1% -- > > Single starting quote > Rate dot_quest4 brackets4 dot_star4 > dot_quest4 203988/s -- -0% -1% > brackets4 204852/s 0% -- -1% > dot_star4 206853/s 1% 1% -- > > > This surprises me. I expected it to take more time for .*? to take > something, try to match the ", fail and repeat; than to just compare a > character to a bit map, consume it and repeat. I certainly didn't > expect .*? to be 300% faster than [^"]* over a long string. I'm > particularly surprised to see .*? be 15% faster than [^"]* over a > string of 5 characters. This seems even more unusual because it's not that much slower over the 9 characters at the end of the string. > > My benchmarking code is attached. Can anyone spot any issues which > might be influencing these results? > > All the best, > > Jacinta > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > _______________________________________________ Melbourne-pm mailing list Melbourne-pm at pm.org http://mail.pm.org/mailman/listinfo/melbourne-pm From rob at cataclysm.cx Tue Jun 10 14:41:47 2008 From: rob at cataclysm.cx (Robert Norris) Date: Wed, 11 Jun 2008 07:41:47 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <48453B45.4000104@perltraining.com.au> References: <48453B45.4000104@perltraining.com.au> Message-ID: <20080610214147.GA11502@plastic.home> > Wednesday 11th June (next week) is the second Wednesday of the month, > which makes it Perl Mongers day. I'm planning to come along for the first time. The list has been silent; everything still on for this evening? Cheers, Rob. From toby.corkindale at rea-group.com Tue Jun 10 18:20:52 2008 From: toby.corkindale at rea-group.com (Toby Corkindale) Date: Wed, 11 Jun 2008 11:20:52 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <20080610214147.GA11502@plastic.home> References: <48453B45.4000104@perltraining.com.au> <20080610214147.GA11502@plastic.home> Message-ID: <484F2874.7060405@rea-group.com> Robert Norris wrote: >> Wednesday 11th June (next week) is the second Wednesday of the month, >> which makes it Perl Mongers day. > > I'm planning to come along for the first time. The list has been silent; > everything still on for this evening? I am wondering the same thing. There was a call for speakers and I didn't see any responses, so maybe we'll just go straight to the pub? (Where was the venue going to be?) tjc From melbourne-pm at popcorn.cx Tue Jun 10 19:08:28 2008 From: melbourne-pm at popcorn.cx (Stephen Edmonds) Date: Wed, 11 Jun 2008 12:08:28 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <484F2874.7060405@rea-group.com> References: <48453B45.4000104@perltraining.com.au> <20080610214147.GA11502@plastic.home> <484F2874.7060405@rea-group.com> Message-ID: <484F339C.7000503@popcorn.cx> Toby Corkindale wrote: > I am wondering the same thing. > > There was a call for speakers and I didn't see any responses, so maybe > we'll just go straight to the pub? (Where was the venue going to be?) > > tjc I was also wondering, but I was planning to go anyway :) As for venue ... I was going to go to Flinders St again as I recall David saying we could use it again and that is what http://melbourne.pm.org/ currently says. Stephen -- _ _ _ Stephen Edmonds _/ \_ / \_/ \ Melbourne, Australia <_ " _> / \ / O \ / " \ stephen at popcorn.cx / ___ \ | O | http://popcorn.cx/ \_____/ \___/ From wjmoore at gmail.com Tue Jun 10 19:11:06 2008 From: wjmoore at gmail.com (Wesley Moore) Date: Wed, 11 Jun 2008 12:11:06 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <484F339C.7000503@popcorn.cx> References: <48453B45.4000104@perltraining.com.au> <20080610214147.GA11502@plastic.home> <484F2874.7060405@rea-group.com> <484F339C.7000503@popcorn.cx> Message-ID: <664f64be0806101911g5428e5efl4a4d7ab747b60b98@mail.gmail.com> I'm up for coming too. Just need to know where to go. :-) On Wed, Jun 11, 2008 at 12:08 PM, Stephen Edmonds wrote: > Toby Corkindale wrote: > > I am wondering the same thing. > > > > There was a call for speakers and I didn't see any responses, so maybe > > we'll just go straight to the pub? (Where was the venue going to be?) > > > > tjc > > I was also wondering, but I was planning to go anyway :) > > As for venue ... I was going to go to Flinders St again as I recall > David saying we could use it again and that is what > http://melbourne.pm.org/ currently says. > > Stephen > > -- > _ _ _ > Stephen Edmonds _/ \_ / \_/ \ > Melbourne, Australia <_ " _> / \ > / O \ / " \ > stephen at popcorn.cx / ___ \ | O | > http://popcorn.cx/ \_____/ \___/ > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080611/0cb4f4f8/attachment.html From rob at cataclysm.cx Tue Jun 10 20:13:36 2008 From: rob at cataclysm.cx (Robert Norris) Date: Wed, 11 Jun 2008 13:13:36 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <484F339C.7000503@popcorn.cx> References: <48453B45.4000104@perltraining.com.au> <20080610214147.GA11502@plastic.home> <484F2874.7060405@rea-group.com> <484F339C.7000503@popcorn.cx> Message-ID: <20080611031336.GA6050@plastic.home> > I was also wondering, but I was planning to go anyway :) Same. If nothing else its a couple of hours away from the kids, a rare treat at the moment :) > As for venue ... I was going to go to Flinders St again as I recall > David saying we could use it again and that is what > http://melbourne.pm.org/ currently says. Cool, I'll be there. If we only get a few then we can just head to the pub. Cheers, Rob. From myfwhite at gmail.com Tue Jun 10 20:48:11 2008 From: myfwhite at gmail.com (Myf White) Date: Wed, 11 Jun 2008 13:48:11 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <20080611031336.GA6050@plastic.home> References: <48453B45.4000104@perltraining.com.au> <20080610214147.GA11502@plastic.home> <484F2874.7060405@rea-group.com> <484F339C.7000503@popcorn.cx> <20080611031336.GA6050@plastic.home> Message-ID: <14bb7600806102048v40ec95eelba801c31ddc8ed9f@mail.gmail.com> Pub sounds good. Alternatively, I've got something I could do... Last pm meeting a couple of people recommened Moose to me and I prepared a little presentation introducing just some of it for work... I could do that if people are interested. Myf White mailto:myfwhite at gmail.com Work like you don't need the money. Love like you've never been hurt. Dance like nobody's watching. ~ Satchel Paige -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080611/24fdc28a/attachment.html From ddick at aapt.net.au Tue Jun 10 20:48:00 2008 From: ddick at aapt.net.au (David Dick) Date: Wed, 11 Jun 2008 13:48:00 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June Message-ID: Toby Corkindale wrote: ??> I am wondering the same thing. ??> ??> There was a call for speakers and I didn't see any responses, so maybe ??> we'll just go straight to the pub? (Where was the venue going to be?) ??> ??> tjc Remasys is up for the challenge. ?? 180 Flinders St (opp Federation square). I'll put the office phone number (03) 9804 4100 on the outside door this time again and will probably be popping down every so often to gather people. ??No idea about talks thou. -Dave From pat at patspam.com Tue Jun 10 21:15:53 2008 From: pat at patspam.com (Patrick Donelan) Date: Wed, 11 Jun 2008 14:15:53 +1000 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: References: Message-ID: <42321ee20806102115x6fceacdare48f4855a82159a3@mail.gmail.com> More lightning talks would be good, they were fun last month. I'd love to hear about Moose, and if we're scraping the bottom of the barrel I can do one on Flux - a rule-based authorisation layer I'm building on top of WebGUI. Patrick On Wed, Jun 11, 2008 at 1:48 PM, David Dick wrote: > > I am wondering the same thing. > > > > There was a call for speakers and I didn't see any responses, so maybe > > we'll just go straight to the pub? (Where was the venue going to be?) > > > > tjc > > Remasys is up for the challenge. 180 Flinders St (opp Federation square). > I'll put the office phone number (03) 9804 4100 on the outside door this > time > again and will probably be popping down every so often to gather people. > No > idea about talks thou. > > -Dave > > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080611/e8284da7/attachment-0001.html From melbourne.pm at joshheumann.com Tue Jun 10 21:18:22 2008 From: melbourne.pm at joshheumann.com (Josh Heumann) Date: Tue, 10 Jun 2008 21:18:22 -0700 Subject: [Melbourne-pm] Call for speakers: MPM, Wed 11th June In-Reply-To: <42321ee20806102115x6fceacdare48f4855a82159a3@mail.gmail.com> References: <42321ee20806102115x6fceacdare48f4855a82159a3@mail.gmail.com> Message-ID: <20080611041822.GE18524@joshheumann.com> > More lightning talks would be good, they were fun last month. > > I'd love to hear about Moose +1 for Moose. I was just reading about Mouse today (Moose without antlers). > and if we're scraping the bottom of the barrel I can do one on Flux - > a rule-based authorisation layer I'm building on top of WebGUI. +1 for other lightning talks as well. J From pjf at perltraining.com.au Tue Jun 10 21:46:46 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Wed, 11 Jun 2008 14:46:46 +1000 Subject: [Melbourne-pm] Meeting TONIGHT (Wed 11 June), 6:30pm Message-ID: <484F58B6.2060209@perltraining.com.au> G'day Everyone, It looks like we do have talks after all! When: Wednesday, 14th May (tonight) 6:30pm Where: Remasys Level 1 172 Flinders St (Opposite Federation Square) Talk: Myf White Moose - A postmodern object system for Perl 5 Moose is a postmodern object system for Perl 5 that takes the tedium out of writing object-oriented Perl. It borrows all the best features from Perl 6, CLOS (LISP), Smalltalk, Java, BETA, OCaml, Ruby and more, while still keeping true to its Perl 5 roots. Lightning talks may follow. Note: If the doors are locked when you arrive, wait a few minutes. There'll be people popping down regularly to let you in. If nobody does, call David on 03 9804 4100 (which will also be posted on the door). After: Pub (Beer Deluxe?) Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From pjf at perltraining.com.au Wed Jun 11 04:16:09 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Wed, 11 Jun 2008 21:16:09 +1000 Subject: [Melbourne-pm] Apologies Message-ID: <484FB3F9.80401@perltraining.com.au> G'day Everyone, I'm afraid I'm feeling a little under the weather, and as you can probably tell by my absence, I missed/am missing Melbourne.pm. I'm especially sad since I've been looking forward to a Moose talk for ages. However I hope that you've all had a fantastic time. On the topic of me having missed talks, don't forget the OSDC 2008 call for papers is still open. ;) http://www.osdc.com.au/2008/papers/cfp.html Cheerio, Paul -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From ddick at aapt.net.au Wed Jun 11 14:37:39 2008 From: ddick at aapt.net.au (David Dick) Date: Thu, 12 Jun 2008 07:37:39 +1000 Subject: [Melbourne-pm] Apologies In-Reply-To: <484FB3F9.80401@perltraining.com.au> References: <484FB3F9.80401@perltraining.com.au> Message-ID: <485045A3.1080100@aapt.net.au> Paul Fenwick wrote: > However I hope > that you've all had a fantastic time. > I think everything went well, but we may need a new place to go for drinks/food afterwards, since that despite melbourne.pm running the risk of crossing 4 lanes of traffic and a tram line, beer deluxe has decided to significantly cut down on the food menu. From pat at patspam.com Wed Jun 11 16:12:04 2008 From: pat at patspam.com (Patrick Donelan) Date: Thu, 12 Jun 2008 09:12:04 +1000 Subject: [Melbourne-pm] Apologies In-Reply-To: <485045A3.1080100@aapt.net.au> References: <484FB3F9.80401@perltraining.com.au> <485045A3.1080100@aapt.net.au> Message-ID: <42321ee20806111612v29f9cb02y9848f6e4dba63fd8@mail.gmail.com> ..or follow the steak to the "burger bar" upstairs. On Thu, Jun 12, 2008 at 7:37 AM, David Dick wrote: > Paul Fenwick wrote: > > However I hope > > that you've all had a fantastic time. > > > I think everything went well, but we may need a new place to go for > drinks/food afterwards, since that despite melbourne.pm running the risk > of crossing 4 lanes of traffic and a tram line, beer deluxe has decided > to significantly cut down on the food menu. > > > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080612/550a2761/attachment.html From pjf at perltraining.com.au Thu Jun 12 01:10:02 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Thu, 12 Jun 2008 18:10:02 +1000 Subject: [Melbourne-pm] autodie 1.10 beta released - It's Fatal 2.0 for Perl! Message-ID: <4850D9DA.5040102@perltraining.com.au> G'day Melb.pm, After much hacking, I'm very glad to say that I've got a version of Fatal/autodie that I'm willing to foist upon the world for BETA testing. It's not a release candidate, but all the important things that should work, do work (I hope). For those who haven't seen my previous discussions, you can think of autodie as a Fatal 2.0. It provides lexical scope, exception objects, and much nicer error messages. It even lets you make system() fatal[1]. You can find the distribution at: http://perltraining.com.au/~pjf/autodie/ It's currently not on the CPAN because I don't want innocent bystanders replacing their Fatal.pm by accident. Currently it only works on Perl 5.10 and above. Support for 5.8 is on my TODO list[2]. I'm specifically after feedback on the following points: * Do any tests fail on your system? * If you use the new Fatal.pm module, does any of your existing code break? (It should be 100% backwards compatible) * If you s/Fatal/autodie/; in your code, does it do what you expect? Are the error messages nicer? Are there any gotchas I've missed? If you really want to get your hands dirty, feel free to look at the TODO file, the DESIGN.pod file, or the source code in general. Suggestions and patches are very much appreciated. If you've got a github account, I'm happy to give you commit access, or you can just fork the repository. If you want to see my five minute talk about what this is about, see: http://pjf.id.au/blog/?position=540 If you want to track my repository of changes, you can find them at: http://github.com/pfenwick/autodie/tree/master I also want to say a special thank-you to Aristotle, who has provided invaluable feedback while I've been working on the project. Any questions, feedback, criticisms, patches, or ideas are welcome. Many thanks, Paul [1] To fatalise system() you'll also need to install IPC::System::Simple. [2] http://github.com/pfenwick/autodie/tree/master/TODO -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From jarich at perltraining.com.au Thu Jun 12 20:29:34 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Fri, 13 Jun 2008 13:29:34 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? Message-ID: <4851E99E.4010000@perltraining.com.au> G'day! There are lots of good reasons to use Perl 5.10 (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 ), but who's managed to get it on to their personal machine? development machines? testing? production? If you're not using 5.10 what versions are you using? This is an informal poll, but I'd love everyone who can to spend a couple of seconds responding. FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not sure what I use on my laptop - probably 5.8.something - haven't looked recently. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | From scottp at dd.com.au Thu Jun 12 20:40:45 2008 From: scottp at dd.com.au (Scott Penrose) Date: Fri, 13 Jun 2008 13:40:45 +1000 (EST) Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> Message-ID: <13029869.10541213328433844.JavaMail.root@zimbra> Personal Machines - 5.8.8 Personal production machines - 5.8.8 3rd party production machines - 5.6 in some cases, but a lot of 5.8.4 I would not run 5.10 though. Two reasons: Not available on my production machines; too hard to manually install on my laptop. I have gone from building my own machines (e.g. Gentoo and similar) to being completely lazy on that front. The problem is that if you have two versions on a system, one from the package system and another from another install it causes major confusion on the perl module front. On one machine things worked if I typed "perl blah.pl" but if I used "./blah.pl" it did not (turns out that my default path was not the same as /usr/bin/perl). This is a problem, I would like to see perl progress, but the reality of systems I use is that manual installs on Debian or Mac OS X of Perl generally break things. This is not just Perl, I had the same problem the other day with Python for using the new version of Trac, had to give up, and with PHP4 and PHP5 on the same machine. Tricky. Scott ----- "Jacinta Richardson" wrote: > G'day! > > There are lots of good reasons to use Perl 5.10 > (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? > development > machines? testing? production? > > If you're not using 5.10 what versions are you using? > > This is an informal poll, but I'd love everyone who can to spend a > couple of > seconds responding. > > FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm > not sure > what I use on my laptop - probably 5.8.something - haven't looked > recently. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From pjf at perltraining.com.au Thu Jun 12 21:15:56 2008 From: pjf at perltraining.com.au (Paul Fenwick) Date: Fri, 13 Jun 2008 14:15:56 +1000 Subject: [Melbourne-pm] [Sydney-pm] Who's using Perl 5.10? In-Reply-To: <4851E9AC.7050800@perltraining.com.au> References: <4851E9AC.7050800@perltraining.com.au> Message-ID: <4851F47C.4050309@perltraining.com.au> G'day (?:Syd|Melb|Canberra).pm, Cross-posting, since Jacinta asked in a few different places. Jacinta Richardson wrote (paraphrased): > Who uses Perl 5.10? On Win32 native, I do. It's dead easy to install, just grab Strawberry or ActiveState Perl and double-click. It's also pretty important because my latest project[1] currently only runs under Perl 5.10. On Win32 Cygwin, I have 5.8.8 installed natively (it's what cygwin comes with), and 5.11/blead installed in my dev area. Unfortunately all my Unix boxes are still on 5.8, and all for pretty much the same reason as we've seen on some of the perl mongers lists already. Most of the unix distributions still come with 5.8, and doing my own packaging for 5.10 represents a huge amount of work. The notable exception to this is RedHat, I believe the latest Fedora Core comes with 5.10 as standard. I note that lenny (RedHat testing) is using 5.10. So I imagine that we'll see big 5.10 rollouts once Debian declare lenny to be stable. Adam's note on Sydney.pm showing the huge number of 5.10 installs vs 5.8 is probably quite indicative of Win32 leading the charge. Because there isn't a central package repository for Win32, it's easy to just grab the latest and greatest right now, rather than waiting for the packagers to catch up. Cheerio, Paul [1] autodie, see http://search.cpan.org/perldoc?autodie for documentation and download, and http://pjf.id.au/blog/?position=540 for the video. -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 From matt.koscica at gmail.com Thu Jun 12 21:34:40 2008 From: matt.koscica at gmail.com (Matt Koscica) Date: Fri, 13 Jun 2008 14:34:40 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> References: <4851E99E.4010000@perltraining.com.au> Message-ID: 5.10 installed to $HOME on all of our production boxes (Debian Etch); the exceptions being a couple of legacy Mandrake boxes running 5.8.7 (no thanks to the nightmarish Math::Pari which only seems to have been made 5.10 friendly in the last ~month). On Fri, Jun 13, 2008 at 1:29 PM, Jacinta Richardson wrote: > G'day! > > There are lots of good reasons to use Perl 5.10 > (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? > > If you're not using 5.10 what versions are you using? > > This is an informal poll, but I'd love everyone who can to spend a couple of > seconds responding. > > FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not sure > what I use on my laptop - probably 5.8.something - haven't looked recently. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > From cas at taz.net.au Thu Jun 12 21:38:44 2008 From: cas at taz.net.au (Craig Sanders) Date: Fri, 13 Jun 2008 14:38:44 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> References: <4851E99E.4010000@perltraining.com.au> Message-ID: <20080613043843.GA3979@taz.net.au> On Fri, Jun 13, 2008 at 01:29:34PM +1000, Jacinta Richardson wrote: > There are lots of good reasons to use Perl 5.10 > (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? $ dpkg -l perl Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii perl 5.10.0-10 Larry Wall's Practical Extraction and Report running it on most machines for the last few weeks, personal, development, & production. haven't noticed any incompatibilities or problems. is running fine. there were a few hassles during the transition (i.e. when not all perl module packages had been rebuilt for perl 5.10) but that was weeks ago...and dealing with it was mostly a matter of Holding important module packages and delaying the upgrade until the module packages had been rebuilt (and even then it was mostly just the handful of modules that weren't pure perl that needed recompiling) craig ps: to Scott - that's what apt-get is for. no need to have a system package of old perl and the new version in /usr/local. just install the latest packages. if you're running debian etch rather than lenny or sid, then backports.org might have 5.10 for etch. if not, download the debianised perl source for 5.10 and build your own backport. -- craig sanders From scottp at dd.com.au Thu Jun 12 21:48:18 2008 From: scottp at dd.com.au (Scott Penrose) Date: Fri, 13 Jun 2008 14:48:18 +1000 (EST) Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <20080613043843.GA3979@taz.net.au> Message-ID: <1014533.10691213332498988.JavaMail.root@zimbra> > ps: to Scott - that's what apt-get is for. no need to have a system > package of old perl and the new version in /usr/local. just install > the > latest packages. if you're running debian etch rather than lenny or > sid, then backports.org might have 5.10 for etch. if not, download > the > debianised perl source for 5.10 and build your own backport. You nailed the problem. If etch - tick. If older versions (which we are stuck on still in most places) then backports are difficult because of all the C compiled modules that have to be recompiled, including proprietary ones. There is two ways we run servers: * One off - no problem, we can control the updates. This is most of the little servers and systems I run as mostly they only need 1 to 4 machines. * Bulk - this is quite common and on % it is about 90% of the servers and they can't just be updated. Scooter From rob at cataclysm.cx Thu Jun 12 22:18:20 2008 From: rob at cataclysm.cx (Robert Norris) Date: Fri, 13 Jun 2008 15:18:20 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> References: <4851E99E.4010000@perltraining.com.au> Message-ID: <20080613051820.GA2600@plastic.home> 5.8.7 on production boxes, only because 5.8.8 had nothing that was going to help and I try not to upgrade production servers for the hell of it. Personal machines are all Debian sid, which has been 5.10.0 for a little while. Being able to to use -E and say in oneliners is a joy. Apart from that I'm not really using the new features except to tinker because I need to target 5.8 until 5.10 is more widespread. I'll be building some new machines in ~3 months from now. They'll be 5.10.1 if its available, otherwise 5.8.8. Even though 5.10.0 seems to be a hell of a lot more stable/bugfree than 5.6.0 and 5.8.0 were, it is taking a little while for modules to catch up. Cheers, Rob. From daniel at rimspace.net Thu Jun 12 22:26:51 2008 From: daniel at rimspace.net (Daniel Pittman) Date: Fri, 13 Jun 2008 15:26:51 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> (Jacinta Richardson's message of "Fri, 13 Jun 2008 13:29:34 +1000") References: <4851E99E.4010000@perltraining.com.au> Message-ID: <87hcbxsy5g.fsf@rimspace.net> Jacinta Richardson writes: > There are lots of good reasons to use Perl 5.10 > (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? > > If you're not using 5.10 what versions are you using? ] apt-cache show perl | grep Version Version: 5.8.8-12 I expect to be looking at Perl 5.10 soon, assuming it moves into Debian/Ubuntu in the near future. If they don't package it I am probably too lazy to work out what it breaks myself. Putting it into production or anything like that will take longer, to ensure that 5.10 doesn't break more things than it fixes. :) Regards, Daniel From greg.george at orica.com Thu Jun 12 22:34:07 2008 From: greg.george at orica.com (greg.george at orica.com) Date: Fri, 13 Jun 2008 15:34:07 +1000 Subject: [Melbourne-pm] Melbourne-pm Digest, Vol 50, Issue 11 In-Reply-To: Message-ID: Hi Jacinta, Using 5.10 on XP development machine and 5.5.8 on AIX 5.3 (Development and production machines) Still having a couple of issues with 5.10 wrt Active States PerlApp but have not had time to investigate reasons (issue is I think with some XS dll's) Regards, Greg George Phone: +613-9091-2492 3/100 Victoria Prd, Melbourne Please consider the environment before printing this e-mail melbourne-pm-request at pm.org Sent by: melbourne-pm-bounces+greg.george=orica.com at pm.org 13/06/2008 03:27 PM Please respond to melbourne-pm at pm.org To melbourne-pm at pm.org cc Subject Melbourne-pm Digest, Vol 50, Issue 11 Send Melbourne-pm mailing list submissions to melbourne-pm at pm.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.pm.org/mailman/listinfo/melbourne-pm or, via email, send a message with subject or body 'help' to melbourne-pm-request at pm.org You can reach the person managing the list at melbourne-pm-owner at pm.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Melbourne-pm digest..." Today's Topics: 1. Who's using Perl 5.10? (Jacinta Richardson) 2. Re: Who's using Perl 5.10? (Scott Penrose) 3. Re: [Sydney-pm] Who's using Perl 5.10? (Paul Fenwick) 4. Re: Who's using Perl 5.10? (Matt Koscica) 5. Re: Who's using Perl 5.10? (Craig Sanders) 6. Re: Who's using Perl 5.10? (Scott Penrose) 7. Re: Who's using Perl 5.10? (Robert Norris) 8. Re: Who's using Perl 5.10? (Daniel Pittman) ---------------------------------------------------------------------- Message: 1 Date: Fri, 13 Jun 2008 13:29:34 +1000 From: Jacinta Richardson Subject: [Melbourne-pm] Who's using Perl 5.10? To: Melbourne Perlmongers Message-ID: <4851E99E.4010000 at perltraining.com.au> Content-Type: text/plain; charset=ISO-8859-1 G'day! There are lots of good reasons to use Perl 5.10 ( http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 ), but who's managed to get it on to their personal machine? development machines? testing? production? If you're not using 5.10 what versions are you using? This is an informal poll, but I'd love everyone who can to spend a couple of seconds responding. FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not sure what I use on my laptop - probably 5.8.something - haven't looked recently. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | ------------------------------ Message: 2 Date: Fri, 13 Jun 2008 13:40:45 +1000 (EST) From: Scott Penrose Subject: Re: [Melbourne-pm] Who's using Perl 5.10? To: Jacinta Richardson Cc: Melbourne Perlmongers Message-ID: <13029869.10541213328433844.JavaMail.root at zimbra> Content-Type: text/plain; charset=utf-8 Personal Machines - 5.8.8 Personal production machines - 5.8.8 3rd party production machines - 5.6 in some cases, but a lot of 5.8.4 I would not run 5.10 though. Two reasons: Not available on my production machines; too hard to manually install on my laptop. I have gone from building my own machines (e.g. Gentoo and similar) to being completely lazy on that front. The problem is that if you have two versions on a system, one from the package system and another from another install it causes major confusion on the perl module front. On one machine things worked if I typed "perl blah.pl" but if I used "./blah.pl" it did not (turns out that my default path was not the same as /usr/bin/perl). This is a problem, I would like to see perl progress, but the reality of systems I use is that manual installs on Debian or Mac OS X of Perl generally break things. This is not just Perl, I had the same problem the other day with Python for using the new version of Trac, had to give up, and with PHP4 and PHP5 on the same machine. Tricky. Scott ----- "Jacinta Richardson" wrote: > G'day! > > There are lots of good reasons to use Perl 5.10 > ( http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? > development > machines? testing? production? > > If you're not using 5.10 what versions are you using? > > This is an informal poll, but I'd love everyone who can to spend a > couple of > seconds responding. > > FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm > not sure > what I use on my laptop - probably 5.8.something - haven't looked > recently. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm ------------------------------ Message: 3 Date: Fri, 13 Jun 2008 14:15:56 +1000 From: Paul Fenwick Subject: Re: [Melbourne-pm] [Sydney-pm] Who's using Perl 5.10? To: Sydney PM , Melbourne Perl Mongers , canberra-pm at pm.org Message-ID: <4851F47C.4050309 at perltraining.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed G'day (?:Syd|Melb|Canberra).pm, Cross-posting, since Jacinta asked in a few different places. Jacinta Richardson wrote (paraphrased): > Who uses Perl 5.10? On Win32 native, I do. It's dead easy to install, just grab Strawberry or ActiveState Perl and double-click. It's also pretty important because my latest project[1] currently only runs under Perl 5.10. On Win32 Cygwin, I have 5.8.8 installed natively (it's what cygwin comes with), and 5.11/blead installed in my dev area. Unfortunately all my Unix boxes are still on 5.8, and all for pretty much the same reason as we've seen on some of the perl mongers lists already. Most of the unix distributions still come with 5.8, and doing my own packaging for 5.10 represents a huge amount of work. The notable exception to this is RedHat, I believe the latest Fedora Core comes with 5.10 as standard. I note that lenny (RedHat testing) is using 5.10. So I imagine that we'll see big 5.10 rollouts once Debian declare lenny to be stable. Adam's note on Sydney.pm showing the huge number of 5.10 installs vs 5.8 is probably quite indicative of Win32 leading the charge. Because there isn't a central package repository for Win32, it's easy to just grab the latest and greatest right now, rather than waiting for the packagers to catch up. Cheerio, Paul [1] autodie, see http://search.cpan.org/perldoc?autodie for documentation and download, and http://pjf.id.au/blog/?position=540 for the video. -- Paul Fenwick | http://perltraining.com.au/ Director of Training | Ph: +61 3 9354 6001 Perl Training Australia | Fax: +61 3 9354 2681 ------------------------------ Message: 4 Date: Fri, 13 Jun 2008 14:34:40 +1000 From: "Matt Koscica" Subject: Re: [Melbourne-pm] Who's using Perl 5.10? To: "Jacinta Richardson" , "Melbourne Perlmongers" , sydney-pm at pm.org Message-ID: Content-Type: text/plain; charset=UTF-8 5.10 installed to $HOME on all of our production boxes (Debian Etch); the exceptions being a couple of legacy Mandrake boxes running 5.8.7 (no thanks to the nightmarish Math::Pari which only seems to have been made 5.10 friendly in the last ~month). On Fri, Jun 13, 2008 at 1:29 PM, Jacinta Richardson wrote: > G'day! > > There are lots of good reasons to use Perl 5.10 > ( http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? > > If you're not using 5.10 what versions are you using? > > This is an informal poll, but I'd love everyone who can to spend a couple of > seconds responding. > > FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not sure > what I use on my laptop - probably 5.8.something - haven't looked recently. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm > ------------------------------ Message: 5 Date: Fri, 13 Jun 2008 14:38:44 +1000 From: Craig Sanders Subject: Re: [Melbourne-pm] Who's using Perl 5.10? To: Melbourne Perlmongers Message-ID: <20080613043843.GA3979 at taz.net.au> Content-Type: text/plain; charset=us-ascii On Fri, Jun 13, 2008 at 01:29:34PM +1000, Jacinta Richardson wrote: > There are lots of good reasons to use Perl 5.10 > ( http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? $ dpkg -l perl Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii perl 5.10.0-10 Larry Wall's Practical Extraction and Report running it on most machines for the last few weeks, personal, development, & production. haven't noticed any incompatibilities or problems. is running fine. there were a few hassles during the transition (i.e. when not all perl module packages had been rebuilt for perl 5.10) but that was weeks ago...and dealing with it was mostly a matter of Holding important module packages and delaying the upgrade until the module packages had been rebuilt (and even then it was mostly just the handful of modules that weren't pure perl that needed recompiling) craig ps: to Scott - that's what apt-get is for. no need to have a system package of old perl and the new version in /usr/local. just install the latest packages. if you're running debian etch rather than lenny or sid, then backports.org might have 5.10 for etch. if not, download the debianised perl source for 5.10 and build your own backport. -- craig sanders ------------------------------ Message: 6 Date: Fri, 13 Jun 2008 14:48:18 +1000 (EST) From: Scott Penrose Subject: Re: [Melbourne-pm] Who's using Perl 5.10? To: Craig Sanders Cc: Melbourne Perlmongers Message-ID: <1014533.10691213332498988.JavaMail.root at zimbra> Content-Type: text/plain; charset=utf-8 > ps: to Scott - that's what apt-get is for. no need to have a system > package of old perl and the new version in /usr/local. just install > the > latest packages. if you're running debian etch rather than lenny or > sid, then backports.org might have 5.10 for etch. if not, download > the > debianised perl source for 5.10 and build your own backport. You nailed the problem. If etch - tick. If older versions (which we are stuck on still in most places) then backports are difficult because of all the C compiled modules that have to be recompiled, including proprietary ones. There is two ways we run servers: * One off - no problem, we can control the updates. This is most of the little servers and systems I run as mostly they only need 1 to 4 machines. * Bulk - this is quite common and on % it is about 90% of the servers and they can't just be updated. Scooter ------------------------------ Message: 7 Date: Fri, 13 Jun 2008 15:18:20 +1000 From: Robert Norris Subject: Re: [Melbourne-pm] Who's using Perl 5.10? To: melbourne-pm at pm.org Message-ID: <20080613051820.GA2600 at plastic.home> Content-Type: text/plain; charset=us-ascii 5.8.7 on production boxes, only because 5.8.8 had nothing that was going to help and I try not to upgrade production servers for the hell of it. Personal machines are all Debian sid, which has been 5.10.0 for a little while. Being able to to use -E and say in oneliners is a joy. Apart from that I'm not really using the new features except to tinker because I need to target 5.8 until 5.10 is more widespread. I'll be building some new machines in ~3 months from now. They'll be 5.10.1 if its available, otherwise 5.8.8. Even though 5.10.0 seems to be a hell of a lot more stable/bugfree than 5.6.0 and 5.8.0 were, it is taking a little while for modules to catch up. Cheers, Rob. ------------------------------ Message: 8 Date: Fri, 13 Jun 2008 15:26:51 +1000 From: Daniel Pittman Subject: Re: [Melbourne-pm] Who's using Perl 5.10? To: Jacinta Richardson Cc: Melbourne Perlmongers Message-ID: <87hcbxsy5g.fsf at rimspace.net> Content-Type: text/plain; charset=us-ascii Jacinta Richardson writes: > There are lots of good reasons to use Perl 5.10 > ( http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? development > machines? testing? production? > > If you're not using 5.10 what versions are you using? ] apt-cache show perl | grep Version Version: 5.8.8-12 I expect to be looking at Perl 5.10 soon, assuming it moves into Debian/Ubuntu in the near future. If they don't package it I am probably too lazy to work out what it breaks myself. Putting it into production or anything like that will take longer, to ensure that 5.10 doesn't break more things than it fixes. :) Regards, Daniel ------------------------------ _______________________________________________ Melbourne-pm mailing list Melbourne-pm at pm.org http://mail.pm.org/mailman/listinfo/melbourne-pm End of Melbourne-pm Digest, Vol 50, Issue 11 ******************************************** ********************************************************************** Please consider the environment before printing this e-mail. This message is intended solely for the individual(s) and entity(s) addressed. It is confidential and may contain legally privileged information. The use, copying or distribution of this message or any information it contains, by anyone other than the addressee, is prohibited. If you have received this message in error, please notify postmaster at orica.com. The mailbox address from which this message has been sent is for business mail only. Mail sent to it may be subject to security scanning and delivery on non-business messages sent to this address may not occur. Thank you. *********************************************************************** From sisyphus1 at optusnet.com.au Thu Jun 12 22:51:30 2008 From: sisyphus1 at optusnet.com.au (sisyphus1 at optusnet.com.au) Date: Fri, 13 Jun 2008 15:51:30 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? Message-ID: <200806130551.m5D5pUbU007634@mail01.syd.optusnet.com.au> An embedded and charset-unspecified text was scrubbed... Name: not available Url: http://mail.pm.org/pipermail/melbourne-pm/attachments/20080613/994f2695/attachment.pl From guy at alchemy.com.au Fri Jun 13 01:03:44 2008 From: guy at alchemy.com.au (Guy Morton) Date: Fri, 13 Jun 2008 18:03:44 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> References: <4851E99E.4010000@perltraining.com.au> Message-ID: <41B49BE0-0D57-41EA-A15F-5B3A80E449B3@alchemy.com.au> v5.8.8 as that's what's in etch stable. if I needed something from perl 5.10 I'd have a crack at installing it, but so far I haven't needed it. Guy On 13/06/2008, at 1:29 PM, Jacinta Richardson wrote: > G'day! > > There are lots of good reasons to use Perl 5.10 > (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_perl_5_10 > ), but who's managed to get it on to their personal machine? > development > machines? testing? production? > > If you're not using 5.10 what versions are you using? > > This is an informal poll, but I'd love everyone who can to spend a > couple of > seconds responding. > > FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm > not sure > what I use on my laptop - probably 5.8.something - haven't looked > recently. > > All the best, > > J > > -- > ("`-''-/").___..--''"`-._ | Jacinta Richardson | > `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | > (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | > _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | > (il),-'' (li),' ((!.-' | www.perltraining.com.au | > _______________________________________________ > Melbourne-pm mailing list > Melbourne-pm at pm.org > http://mail.pm.org/mailman/listinfo/melbourne-pm From ddick at aapt.net.au Fri Jun 13 02:28:21 2008 From: ddick at aapt.net.au (David Dick) Date: Fri, 13 Jun 2008 19:28:21 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> References: <4851E99E.4010000@perltraining.com.au> Message-ID: <48523DB5.2080309@aapt.net.au> Jacinta Richardson wrote: > If you're not using 5.10 what versions are you using? > Personal at home: default fedora 8 at 5.8.8 Own business: default debian etch at 5.8.8 Work: ranges from 5.8.0 to 5.10.0 from custom built perls, desktop fedora 9, strawberry perl and cygwin. From matt.cameron at websiteplus.com.au Fri Jun 13 04:37:06 2008 From: matt.cameron at websiteplus.com.au (matt.cameron at websiteplus.com.au) Date: Fri, 13 Jun 2008 21:37:06 +1000 Subject: [Melbourne-pm] Who's using Perl 5.10? In-Reply-To: <4851E99E.4010000@perltraining.com.au> References: <4851E99E.4010000@perltraining.com.au> Message-ID: <006501c8cd49$d0022f90$70068eb0$@cameron@websiteplus.com.au> 5.8.8 on dev & all production -----Original Message----- From: melbourne-pm-bounces+matt.cameron=websiteplus.com.au at pm.org [mailto:melbourne-pm-bounces+matt.cameron=websiteplus.com.au at pm.org] On Behalf Of Jacinta Richardson Sent: Friday, 13 June 2008 1:30 PM To: Melbourne Perlmongers Subject: [Melbourne-pm] Who's using Perl 5.10? G'day! There are lots of good reasons to use Perl 5.10 (http://www.perlfoundation.org/perl5/index.cgi?why_you_should_upgrade_to_per l_5_10 ), but who's managed to get it on to their personal machine? development machines? testing? production? If you're not using 5.10 what versions are you using? This is an informal poll, but I'd love everyone who can to spend a couple of seconds responding. FWIW I use: Perl 5.8.8 on my personal box, and production box. I'm not sure what I use on my laptop - probably 5.8.something - haven't looked recently. All the best, J -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au | _______________________________________________ Melbourne-pm mailing list Melbourne-pm at pm.org http://mail.pm.org/mailman/listinfo/melbourne-pm From toby.corkindale at rea-group.com Tue Jun 17 22:59:04 2008 From: toby.corkindale at rea-group.com (Toby Corkindale) Date: Wed, 18 Jun 2008 15:59:04 +1000 Subject: [Melbourne-pm] Git correction Message-ID: <4858A428.1080209@rea-group.com> Hey guys, Just a quick correction to the talk I gave a month or so ago.. At the time, I mentioned that Git did seem to have a potential problem, with the garbage-collection pass not being multi-user safe. (ie. If you ran it at the same time as someone else was modifying data, there was a potential race condition) Since then I've looked into it more, and it seems that my research was looking at old information. Git has been safe from this race condition for quite some time now. The GC pass only removes things that look like garbage when they're older than a configurable amount of days. The race condition *was* that someone could upload some packs for, say, a new branch, but then have them garbage-collected before the user had uploaded the references to them. The default garbage age is now something like 60 days.. so in order for the race condition to occur, you'd have to be pushing at an insanely slow speed! (If your upload takes two months, maybe you should just post a CD :) Of course this has then resulted in users acting confused because they're creating big branches, then deleting the branches, and wondering why their repo doesn't shrink at all after running git-gc. Anyway, I just thought I'd drop the correction through.. I meant to mention it at the last meeting but forget :( Toby -- Toby Corkindale Software developer w: www.rea-group.com REA Group refers to realestate.com.au Ltd (ASX:REA) Warning - This e-mail transmission may contain confidential information. If you have received this transmission in error, please notify us immediately on (61 3) 9897 1121 or by reply email to the sender. You must destroy the e-mail immediately and not use, copy, distribute or disclose the contents. From jarich at perltraining.com.au Sat Jun 21 21:36:26 2008 From: jarich at perltraining.com.au (jarich at perltraining.com.au) Date: Sun, 22 Jun 2008 14:36:26 +1000 (EST) Subject: [Melbourne-pm] SAGE-AU 2008 Early bird registrations now open Message-ID: <20080622043626.B6F84A815E@teddybear.perltraining.com.au> Dear Melbourne Perl Mongers members, [Please forward this invitation to anyone you feel would be interested] Registration for the sixteenth annual Australian System Administrators' conference (SAGE-AU 2008) are now open. Book before Friday July 4th to receive a 15% discount. http://www.sage-au.org.au/display/conf/Registration Key information: 4th July: Early Bird Date 11th - 13th August: Training Program 14th - 15th August: Technical Program Holiday Inn Adelaide 65 Hindley Street Adelaide South Australia SAGE-AU is the System Administration industry body in Australia. It exists to support all Australian system administrators, raise awareness of the profession and provide education in technical and professional issues. Our yearly conference provides a forum for System Administrators of all platforms and levels of experience to gather together and share their experiences. Further it provides an excellent opportunity to meet and network with acknowledged experts in the field. We have 10 training sessions for our three day training program in addition to 26 great sessions for our technical program. This year focusses on a mix of management and security topics with an emphasis on sharing techniques and ideas rather than selling products. This year's conference will be broken up into two streams of concurrent talks, giving you more choice in the topics you want to see. To see our program visit: http://www.sage-au.org.au/display/conf/Technical+Program You can help make this conference be the best system administrators' conference ever, just by turning up and participating. We look forward to sharing this great conference with you. Many thanks go to our Platinum Sponsors: Internode and Tas, our Gold Sponsor: Ironport our Silver Sponsor: RedHat and our terminal room sponsors: Apple and Sun. Jacinta Richardson SAGE-AU Program Coordinator From jarich at perltraining.com.au Sun Jun 22 17:28:55 2008 From: jarich at perltraining.com.au (Jacinta Richardson) Date: Mon, 23 Jun 2008 10:28:55 +1000 Subject: [Melbourne-pm] OSDC 2008 CFP closes on Monday, 30 June 2008 Message-ID: <485EEE47.6060705@perltraining.com.au> Come and see what the Sydney team have done with our conference. Give a talk, be involved and have a great week in December learning new things about Perl, Python, PHP, Ruby, Java and more. Tell your friends and workmates about the CFP, lets see how many Perl talks we can submit! There is less than two weeks to get your paper proposal in for the opportunity to speak and attend Australia's Open Source Developers' Conference! The deadline for proposals is 30th June 2008. The Open Source Developers' Conference is an Australian conference designed for developers, by developers. Papers on Open Source languages, technologies, projects, tools and well as topics of interest to Open Source developers are being solicited for submission to OSDC 2008. So if you are an Open Source maintainer, developer or user, the organising committee would encourage you to submit a talk proposal on the open source tools, solutions, languages or technologies you are working with. The conference will be held at SMC Conference venue in the Sydney CBD, New South Wales, from the 2nd to the 5th of December, 2008. We have had some great proposals submitted already, but this is your chance to give the open source thing you are passionate about more exposure. Being a speaker at OSDC 2008, has it's privileges. As well as having your paper published in the conference proceedings, you will get a free admission to the 3 days of the main conference and the conference dinner. If you have any questions, or have never submitted a paper proposal before, please read our FAQ page at http://www.osdc.com.au/2008/faq/ If you don't find an answer there, please contact program osdc.com.au To submit a proposal, follow the instructions at http://www.osdc.com.au/2008/papers/cfp.html -- ("`-''-/").___..--''"`-._ | Jacinta Richardson | `6_ 6 ) `-. ( ).`-.__.`) | Perl Training Australia | (_Y_.)' ._ ) `._ `. ``-..-' | +61 3 9354 6001 | _..`--'_..-_/ /--'_.' ,' | contact at perltraining.com.au | (il),-'' (li),' ((!.-' | www.perltraining.com.au |