hi,
In a MyClass I use something like this :
use Class::Delegation
......
send => -OTHER, to => -SELF->page;
sub page { ${$_[0]}{app}{currTran}{currPage} }
This means that any method (except several i didnt mentioned here for simplicity) should be redirected to $self->page->method().
Then I have in my code script.pl :
use Aspect;
before { ..... } call qr/^MyClass/;
when I run it I get :
...
MyClass::Application::AUTOLOAD->
Could not delegate at /...../lib/Aspect/Hook/LexWrap.pm line 63
MyClass::Application::DESTROY->
I see that Delegation probably didn't succeeds because page() is dynamic and for some reason conflicts with Aspect.
If I try to isolate AUTOLOAD from Apsect i.e.
before {....} call qr/^MyClass/ & !call qr/AUTOLOAD/;
I get another error :
Can't call method "match_define" without a package or object reference
+ at /...../lib/Aspect/Pointcut/NotOp.pm line 13.
Can you figure out some workaround for this situation ?
Should I stop using Class::Delegation and do everything with AUTOLOAD instead ?
I really wanted to use delegation 'cause it would simplify the things alot. On the other hand I want to use Aspect to pin-from-outside Logging, debuging and other functionality.. Now i'm still testing..
Continued : it seems that even if I don't use Class::Delegation, Aspect still has problems ;(
It does something with AUTOLOAD, because if I don't use Aspect, $AUTOLOAD variable is populated and everything goes fine, but at the moment I enable Aspect, $AUTOLAOD is empty!!
More: I continued experimenting with Aspect and similar..here you can see examples :
http://perlmonks.org/?node_id=592845
I sent email to the author of Aspect, probably he can figure out, why..
Does someone have idea how can I cleanly slice the subs/methods i.e. install code inside them, even if I have to put some hook-code.
Of cource doing this in Aspect consistent way. thanx
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.