[Israel.pm] Uses for Attributes

Shlomi Fish shlomif at iglu.org.il
Mon Mar 19 15:28:49 PDT 2007


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. He asked me to find places where attributes would be useful. I 
thought of a few there, but here are more I collected:

<<<<<<<<<<<<<<<
1. Catalyst.

    - 
http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod

2. Class::Std.

    http://search.cpan.org/dist/Class-Std/lib/Class/Std.pm
    (Called traits there).

    - : ATTR ; for object fields/slots.

    - : PRIVATE

    - : STRINGIFY

    - : NUMERIFY

    - :BOOLIFY

    - :CUMULATIVE

3. Test::Class.

    - http://search.cpan.org/dist/Test-Class/lib/Test/Class.pm

4. Testing Framework:

    sub ok : testfunc { ... }
    sub is : testfunc { ... ... ok ( ... ) }
    sub is_deeply : testfunc { ... }
    sub my_create_and_compare : testfunc : { ... is_deeply(...) }

    Use the topmost testfunc attribute to determine where the context
    of the caller:

    # Display this line on
    my_create_and_compare ({ %params }, "Testing"); 
    failure.

>>>>>>>>>>>>>>>

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
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.



More information about the Perl mailing list