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;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.