Scalar::Properties 0.12
Sponsored Links
Scalar::Properties 0.12 Ranking & Summary
File size:
0.010 MB
Platform:
Any Platform
License:
Perl Artistic License
Price:
Downloads:
886
Date added:
2007-05-21
Publisher:
James A. Duncan and Marcel Grunauer
Scalar::Properties 0.12 description
Scalar::Properties is a Perl module package that contains run-time properties on scalar variables.
SYNOPSIS
use Scalar::Properties;
my $val = 0->true;
if ($val && $val == 0) {
print "yup, its true alright...n";
}
my @text = (
hello world->greeting(1),
forget it,
hi there->greeting(1),
);
print grep { $_->is_greeting } @text;
my $l = hello world->length;
Scalar::Properties attempts to make Perl more object-oriented by taking an idea from Ruby: Everything you manipulate is an object, and the results of those manipulations are objects themselves.
hello world->length
(-1234)->abs
"oh my god, its full of properties"->index(g)
The first example asks a string to calculate its length. The second example asks a number to calculate its absolute value. And the third example asks a string to find the index of the letter g.
Using this module you can have run-time properties on initialized scalar variables and literal values. The word properties is used in the Perl 6 sense: out-of-band data, little sticky notes that are attached to the value. While attributes (as in Perl 5s attribute pragma, and see the Attribute::* family of modules) are handled at compile-time, properties are handled at run-time.
Internally properties are implemented by making their values into objects with overloaded operators. The actual properties are then simply hash entries.
Most properties are simply notes you attach to the value, but some may have deeper meaning. For example, the true and false properties plays a role in boolean context, as the first example of the Synopsis shows.
Properties can also be propagated between values. For details, see the EXPORTS section below. Here is an example why this might be desirable:
pass_on(approximate);
my $pi = 3->approximate(1);
my $circ = 2 * $rad * $pi;
# now $circ->approximate indicates that this value was derived
# from approximate values
Please dont use properties whose name start with an underscore; these are reserved for internal use.
You can set and query properties like this:
$var->myprop(1)
sets the property to a true value.
$var->myprop(0)
sets the property to a false value. Note that this doesnt delete the property (to do so, use the del_props method described below).
$var->is_myprop, $var->has_myprop
returns a true value if the property is set (i.e., defined and has a true value). The two alternate interfaces are provided to make querying attributes sound more natural. For example:
$foo->is_approximate;
$bar->has_history;
SYNOPSIS
use Scalar::Properties;
my $val = 0->true;
if ($val && $val == 0) {
print "yup, its true alright...n";
}
my @text = (
hello world->greeting(1),
forget it,
hi there->greeting(1),
);
print grep { $_->is_greeting } @text;
my $l = hello world->length;
Scalar::Properties attempts to make Perl more object-oriented by taking an idea from Ruby: Everything you manipulate is an object, and the results of those manipulations are objects themselves.
hello world->length
(-1234)->abs
"oh my god, its full of properties"->index(g)
The first example asks a string to calculate its length. The second example asks a number to calculate its absolute value. And the third example asks a string to find the index of the letter g.
Using this module you can have run-time properties on initialized scalar variables and literal values. The word properties is used in the Perl 6 sense: out-of-band data, little sticky notes that are attached to the value. While attributes (as in Perl 5s attribute pragma, and see the Attribute::* family of modules) are handled at compile-time, properties are handled at run-time.
Internally properties are implemented by making their values into objects with overloaded operators. The actual properties are then simply hash entries.
Most properties are simply notes you attach to the value, but some may have deeper meaning. For example, the true and false properties plays a role in boolean context, as the first example of the Synopsis shows.
Properties can also be propagated between values. For details, see the EXPORTS section below. Here is an example why this might be desirable:
pass_on(approximate);
my $pi = 3->approximate(1);
my $circ = 2 * $rad * $pi;
# now $circ->approximate indicates that this value was derived
# from approximate values
Please dont use properties whose name start with an underscore; these are reserved for internal use.
You can set and query properties like this:
$var->myprop(1)
sets the property to a true value.
$var->myprop(0)
sets the property to a false value. Note that this doesnt delete the property (to do so, use the del_props method described below).
$var->is_myprop, $var->has_myprop
returns a true value if the property is set (i.e., defined and has a true value). The two alternate interfaces are provided to make querying attributes sound more natural. For example:
$foo->is_approximate;
$bar->has_history;
Scalar::Properties 0.12 Screenshot
Scalar::Properties 0.12 Keywords
Properties 0.12
Scalar Variables
Perl module
module package
properties
value
Perl
true
example
run-time
Scalar::Properties
ScalarProperties
Scalar::Properties 0.12
Libraries
Programming
Bookmark Scalar::Properties 0.12
Scalar::Properties 0.12 Copyright
WareSeeker periodically updates pricing and software information of Scalar::Properties 0.12 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Scalar::Properties 0.12 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed
Featured Software
Want to place your software product here?
Please contact us for consideration.
Contact WareSeeker.com
Related Information
Related Software
Config::Properties is a Perl module to read and write property files. Free Download
WWW::Webrobot::Properties is a Perl module that implements a config format like java.util.Properties. Free Download
Scalar::Number is a Perl module with numeric aspects of scalars. Free Download
Scalar::Footnote is a Perl module that can attach hidden scalars to references. Free Download
Scalar::Util is a selection of general-utility scalar subroutines. Free Download
Scalar::Defer is a Perl module to calculate values on demand. Free Download
Scalar::MultiValue is a Perl module to create a SCALAR with multiple values. Free Download
Data::ICal::Entry::Alarm::Procedure is a Perl module that represents a procedure-call alarm in an iCalendar file. Free Download
Latest Software
Popular Software
Favourite Software