Hi! Please consider following me on twitter: @hanekomu.

Scalar::Properties

After reading a journal entry here, James Duncan sent me some pretty cool code showing how to get constant overloading and literals-as-objects working as intended. At that point, Scalar::Properties had become an inevitability. Let me amuse you with an excerpt of the module's 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;

Write a comment | Bookmark and Share

posted at: 13:40 | path: /dev | permalink | 0 comments | 0 trackbacks

Comments are closed for this story.

Trackbacks are closed for this story.