劉康民 > Perl6ish-0.02 > Perl6ish::Syntax::DotMethod

Download:
Perl6ish-0.02.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Perl6ish::Syntax::DotMethod - Allow methods to be invoked with dot.

SYNOPSIS ^

    package Cow;
    use Perl6ish::Syntax::DotMethod;

    sub new { bless {}, shift }

    sub sound { "moooo" };

    package main;
    my $animal = new Cow;

    # Cow methods can be invoked with dot.
    print "A cow goes " . $animal.sound();

DESCRIPTION ^

This syntax extension allows your instance methods to be invked with a dot. It is only supposed to be used when you're defining classes. It does not turn all objects methods invokable with a dot.

It's not source-filtering, but operator overloading. Under the hood, the real work is done in Acme::Dot.

AUTHOR ^

Kang-min Liu <gugod@gugod.org>

SEE ALSO ^

Acme::Dot

syntax highlighting: