On Thu, 08 Apr 2010 21:08:54 +0200, Eric Veith1 wrote:
> Shlomi Fish <shlo...@iglu.org.il> wrote on 04/08/2010 08:37:10 PM:
>> > Uh, what are you really trying to do?  There are helper modules that
> make
>> > using attributes much easier.
>> 
>> Yes, I'm wondering about it too.
> 
> I'm trying to use method attributes to get a certain behaviour with some
> syntactic sugar. Like, for example:
> 
> ---%<---
> sub do_heavy_work :Forks {
>         return heavy_thinking();
> }
> --->%---
> 
> ... getting this one to fork. I have the surrounding stuff already, i.e.
> a certain accessor method that takes the name of the instance method as
> parameter and calls it in the fashion of
> "$instance->$method_name(@params)". I'd like to check in the accessor
> method whether the sub I'm about to call has the ":Forks" attribute and
> do a fork before actually calling it if it has.

Yikes, I do not like that design.  Forking should be defined in its own 
independent location, not as some part of a global funnel that all method 
calls pass through.

I suspect you would have an easier time if you wrote what sounds like a 
largish project using Moose and composed in a forkable role.  If you must 
use method attributes there is MooseX::MethodAttributes but (and I am 
getting beyond my experience here) it does not appear popular.

-- 
Peter Scott
http://www.perlmedic.com/     http://www.perldebugged.com/
http://www.informit.com/store/product.aspx?isbn=0137001274
http://www.oreillyschool.com/courses/perl1/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to