RHainsworth has asked for the wisdom of the Perl Monks concerning the following question:
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;
|
|---|
| 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 (Paladin) on Aug 19, 2007 at 13:10 UTC | |
by RHainsworth (Acolyte) on Aug 19, 2007 at 13:57 UTC |