Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Colon Operator/Seperator

by tomazos (Deacon)
on Oct 06, 2005 at 19:56 UTC ( [id://498030] : perlquestion . print w/replies, xml ) Need Help??

tomazos has asked for the wisdom of the Perl Monks concerning the following question:

I was looking through the perldoc for Test::Class and came across something I hadn't seen before...

package Example::Test; use base qw(Test::Class); use Test::More; sub subtraction : Test { is( 2-1, 1, 'subtraction works ); };

What is that strange colon doing between subtraction and Test - and what is it up to?

Can someone tell me what it is called and which Perl man page documents it?

-Andrew.

Replies are listed 'Best First'.
Re: Colon Operator/Seperator
by Zaxo (Archbishop) on Oct 06, 2005 at 20:06 UTC

    It marks the start of the attribute list for subtraction. Also see perlsub. Test::Class provides the handler for the Test attribute.

    Perl operators and punctuation are context-driven, overlapping, and overloaded to the gills. That's why it's so much fun :-) Just like a human language.

    After Compline,
    Zaxo

Re: Colon Operator/Seperator
by runrig (Abbot) on Oct 06, 2005 at 20:02 UTC