On Tuesday 20 March 2007, Oded Arbel wrote:
> On Tue, 20 Mar 2007 11:54:17 +0200, "Shlomi Fish" <[EMAIL PROTECTED]> wrote:
> > Hi Oded!
> >
> > On 3/20/07, Oded Arbel <[EMAIL PROTECTED]> wrote:
> >> On Tue, 2007-03-20 at 00:28 +0200, Shlomi Fish wrote:
> >> > Hi all!
> >> >
> >> > Back on the last Israel.pm meeting I've discussed attributes (
> >> > http://perldoc.perl.org/attributes.html ) with Sagiv in the context of
> >> > Catalyst.
> >>
> >> Ok, I've read the doc, and it talks about attributes being a short hand
> >> for attributes::->import( sth => sth, sth), but what does that do ?
> >
> > Well, attributes associate more data to the function or variable,
> > besides its name. So you can query the variable for the data
> > associated with it and treat it differently based on it.
> >
> > Or are you referring to the implementation details?
>
> No - just what it does. So I understand its just a way to mark subroutines
> (and variables) with a specific keyword. so I can do something like this:
>
> ----
> sub myfunc : isverysecret {
> # do something secret
> }
>
> manage_callbacks \&myfunc;
>
> sub manage_callbacks {
> shift;
> if (attributes::get $_ == 'isverysecret') { # do something }
> }
>
> ----
>
> or some such (barring the syntax is probably all wrong), right ?
Yes.
Regards,
Shlomi Fish
---------------------------------------------------------------------
Shlomi Fish [EMAIL PROTECTED]
Homepage: http://www.shlomifish.org/
Chuck Norris wrote a complete Perl 6 implementation in a day but then
destroyed all evidence with his bare hands, so no one will know his secrets.
_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl