Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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/MultipleViewsExample.pm) 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
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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2014-04-20 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (487 votes), past polls