perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoffrey Young <ge...@modperlcookbook.org>
Subject Re: back compatibility layer for method handlers?
Date Mon, 21 Jan 2002 19:38:27 GMT
Doug MacEachern wrote:
> 
> On Mon, 21 Jan 2002, Geoffrey Young wrote:
> 
> > Stas Bekman wrote:
> > >
> > > A "method handler" is now specified using the `method' sub attribute, e.g.
> > >
> > > sub handler : method {};
> >
> > well, I submitted a patch to get this to work in 1.3.
> 
> huh?  that isn't what your patch does.  in any case, i'll look at it again
> when catching up on 1.x stuffs.

whoops.  as usual, I'm not entirely with the program.

after removing the cobwebs from my brain, I remembered that what didn't work was pushing
method handlers as coderefs, even with the : method declaration.

here is an updated test case.  sorry for the confusion.

--Geoff
(who tries to break his rut)

package My::MethodTest;

use Apache::Constants qw(OK);

use strict;

sub handler {
  my $r = shift;

  $r->push_handlers($r->current_callback => \&foo);
  $r->push_handlers($r->current_callback => \&bar);

  return OK;
}

sub foo : method {
  my $self = shift;
  my $r = shift;

  print STDERR "My::Method::foo\n";
  print STDERR "self: $self, r: $r\n";

  return OK;
}

sub bar ($$) {
  my $self = shift;
  my $r = shift;

  print STDERR "My::Method::bar\n";
  print STDERR "self: $self, r: $r\n";

  return OK;
}
1;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message