Method modifiers and subclasses

[email protected] (Alex Hole)
Newsgroups perl.moose
Message-ID <AC390A87E26DAD4493450412E18335A85E4E3D0971@ch-exchange.ad.connect-distribution.co.uk>
Hi,

What is the expected behaviour with regards to method modifiers and sub classes?

I was expecting that all "before" sub routines would be run before any around subs.

In current tests, I am finding that a sub classes "around" is called before any parent classes "before" subs.


For a test I have there classes Base -> Sub -> Test  and 3 Roles A, B & C applied to Base.
Role A provides a sub test().

Roles B&C and Classes Base,Sub,Test provide before,around & after subs for the test sub.  Calling test on an instance of Test gives:

Test->before test
Test->around test
Sub->before test
Sub->around test
Base->before test
C->before test
B->before test
Base->around test
C->around test
B->around test
A->test
B->after test
C->after test
Base->after test
Sub->after test
Test->after test

For classes Test and Sub, their around sub is called before the parent classes befores are called.
For roles, all "before" are called before "around" is called on the class where the roles are composed.

Is this correct?


Thanks in advance
Alex Hole
Computer Programmer
[cid:[email protected]]
T: 0121 766 2204
E: [email protected]<mailto:[email protected]>
www.connect-service.co.uk<http://www.connect-service.co.uk>
Connect Distribution Services Ltd. | Connect House | Small Heath Business Park | Talbot Way | Birmingham | B10 0HJ


________________________________
Please consider the environment before printing this e-mail

________________________________
DISCLAIMER: This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
image001.png (image/png, 174 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.