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


Perl6ish documentation Contained in the Perl6ish distribution.

Index


Code Index:

NAME

Top

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

SYNOPSIS

Top

    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

Top

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

Top

Kang-min Liu <gugod@gugod.org>

SEE ALSO

Top

Acme::Dot


Perl6ish documentation Contained in the Perl6ish distribution.

package Perl6ish::Syntax::DotMethod;
use strict;
use Sub::Uplevel;

require Acme::Dot;

sub import {
    uplevel 1, \&Acme::Dot::import;
}


1;