Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Unknown perl idiom using : (colon)

by RHainsworth (Acolyte)
on Aug 19, 2007 at 12:22 UTC ( #633596=perlquestion: print w/ replies, xml ) Need Help??
RHainsworth has asked for the wisdom of the Perl Monks concerning the following question:

I found the following use of : in a module. I have scanned the perl docs I thought relevant (tie and module), but cant find what it means. Can anyone point me to an explanation of what is happening?

The specific line is my $value: Value = 0;

I know that Value is a package below XUL::Node::MVC but what I cant figure out is what '$value:' is doing, or is it ': Value'? Is this a tie? Is it a shortcut for Value->new? The context is in an example (XUL/Node/Application/ in XUL::Node viz.,

use strict; use warnings; use Carp; use XUL::Node::MVC; use base 'XUL::Node::Application'; sub start { my $value: Value = 0; # <--- I dont understand this line Window(SIZE_TO_CONTENT, VBox( HBox( Button(label => '+', Click => sub { $v +alue++ }), Button(label => '-', Click => sub { $v +alue-- }), ), Label(value => $value), TextBox(DISABLED, value => $value), ), ); return tied($value); # DO NOT REMOVE!- this is for unit testing MVC # and for unit tests only. Lets us check the valu +e # from the outside } 1;

Comment on Unknown perl idiom using : (colon)
Select or Download Code
Replies are listed 'Best First'.
Re: Unknown perl idiom using : (colon)
by moritz (Cardinal) on Aug 19, 2007 at 12:25 UTC
Re: Unknown perl idiom using : (colon)
by jdporter (Canon) on Aug 19, 2007 at 13:10 UTC
      thank you both for the clue.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://633596]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (14)
As of 2015-11-24 22:42 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (664 votes), past polls