Open GoogleCodeExporter opened 9 years ago
$>perlcc -O3 -r -e 'package MyTest; use Attribute::Handlers; sub Check :ATTR
{print "called\n"; print "ok\n" if ref $_[4] eq "ARRAY" && join(",", @{$_[4]})
eq join(",", qw/a b c/);} sub a_sub :Check(qw/a b c/) { return 42 } print
a_sub() . "\n";'
42
$>perl -e 'package MyTest; use Attribute::Handlers; sub Check :ATTR {print
"called\n"; print "ok\n" if ref $_[4] eq "ARRAY" && join(",", @{$_[4]}) eq
join(",", qw/a b c/);} sub a_sub :Check(qw/a b c/) { return 42 } print a_sub()
. "\n";'
called
ok
42
Original comment by todd.e.rinaldo
on 23 Jan 2014 at 11:49
The part that's got me confused is why it doesn't print "called"
Original comment by todd.e.rinaldo
on 23 Jan 2014 at 11:50
Issue 278 has been merged into this issue.
Original comment by reini.urban
on 27 Jan 2014 at 8:47
Of the issues relevant to us, this one is high.
Original comment by todd.e.rinaldo
on 1 Feb 2014 at 12:25
Disagree.
I haven't seen Attribute::Handlers in our code, and I'm vehemently against
using it in the future.
It's junk and dangerous code, which evals innocence attribute strings.
e.g.
perl -MAttribute::Handlers -e'
sub UNIVERSAL::Help :ATTR(CODE) { $help_attr{ *{$_[1]}{NAME} } = $_[4]; }
sub unlink :Help(unlink xx) {}'
as used in Add::Rad::Help and xx is gone.
Original comment by reini.urban
on 1 Feb 2014 at 6:57
[deleted comment]
As far as I know, Catalyst uses it heavily, right?
Common controller code:
sub access_remove : Does(ACL) : ACLDetachTo("/unauthorized") :
AllowedRole(root) : Local {
my ( $self, $c ) = @_;
my $params = $c->req->params;
$c->model->remove_priv( $params->{'username'}, $params->{'priv'} );
$c->model->log_access( $c->user->username, $c->stash->{'current_path'}, 1,
qq{Removed privelige "$params->{'priv'}" from "$params->{'username'}"}
);
$c->redirect('access_edit'); # Re-display access_edit
}
Original comment by todd.e.rinaldo
on 1 Feb 2014 at 3:49
Exactly.
:Does(ACL) will call ACL() at compile-time
:AllowedRole(root) will call root() at compile-time
I'll add a second issue for Attribute::Handlers,
that they are crashing at an too early exit in the run-loop.
1st issue: why does it leave the runloop at all.
2nd: it should not crash at any exit() called in an inner scope.
./pccAttribute_Handlers(Perl_cv_undef+0x2ed)[0x4f435d]
./pccAttribute_Handlers(Perl_sv_clear+0x6bc)[0x544f4c]
./pccAttribute_Handlers(Perl_sv_free2+0xdd)[0x54539d]
./pccAttribute_Handlers(Perl_leave_scope+0x63b)[0x567dab]
./pccAttribute_Handlers[0x4c6176]
./pccAttribute_Handlers(Perl_my_exit+0x23)[0x4caae3]
./pccAttribute_Handlers(perl_run+0x25c)[0x4cde5c]
Original comment by reini.urban
on 19 Feb 2014 at 3:31
Original comment by reini.urban
on 11 Jun 2014 at 11:21
Original comment by reini.urban
on 11 Jun 2014 at 11:23
Issue 278 has been merged into this issue.
Original comment by reini.urban
on 29 Aug 2014 at 1:30
Original issue reported on code.google.com by
nicolas....@gmail.com
on 7 Nov 2013 at 4:06