Michael Schout wrote:
interesting. the last time I tried was with bleedperl before 5.8 was released - I know it worked then because I was writing a patch for mod_perl core based on it. this thread has most of the dialogue:Geoffrey Young wrote:keep in mind that neither book mentions the use of subroutine attributes, which is allowed in 1.3 but the only way in 2.0 sub handler : method { ... }
I am 99% sure that Attribute handlers wont work in 1.3 because Attribute::Handlers use CHECK{} blocks to set up the handlers. CHECK blocks do not work in mod_perl under Apache 1.3 (search the list archives for the reason). So because CHECK blocks never execute in mod_perl under Apache 1.3 attribute handlers wont work. I tried to get them work in under Apache 1.3 a few months ago, and gave up because of the CHECK restrictions.
http://marc.theaimsgroup.com/?t=99789776100010&w=2&r=1
and below is the test I was using at the time. when trying it now with my dev environment (Apache/1.3.28-dev (Unix) mod_perl/1.27_01-dev Perl/v5.9.0) it works as I'd expect - the first two calls below are broken, but the last two report back
self: My::MethodTest, r: Apache=SCALAR(0x838e850)
anyway, maybe we have different assumptions, but it seems to be working as I would expect with the current versions.
--Geoff
package My::MethodTest;
# remember to PerlModule 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);
$r->push_handlers($r->current_callback => 'My::MethodTest->foo');
$r->push_handlers($r->current_callback => 'My::MethodTest->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;