File Coverage

blib/lib/Perl6ish/Syntax/DotMethod.pm
Criterion Covered Total %
statement 6 7 85.7
branch n/a
condition n/a
subroutine 2 3 66.6
pod n/a
total 8 10 80.0


line stmt bran cond sub pod time code
1             package Perl6ish::Syntax::DotMethod;
2 1     1   621 use strict;
  1         2  
  1         26  
3 1     1   830 use Sub::Uplevel;
  1         1429  
  1         6  
4              
5             require Acme::Dot;
6              
7             sub import {
8 0     0     uplevel 1, \&Acme::Dot::import;
9             }
10              
11              
12             1;
13              
14             =head1 NAME
15              
16             Perl6ish::Syntax::DotMethod - Allow methods to be invoked with dot.
17              
18             =head1 SYNOPSIS
19              
20             package Cow;
21             use Perl6ish::Syntax::DotMethod;
22              
23             sub new { bless {}, shift }
24              
25             sub sound { "moooo" };
26              
27             package main;
28             my $animal = new Cow;
29              
30             # Cow methods can be invoked with dot.
31             print "A cow goes " . $animal.sound();
32              
33             =head1 DESCRIPTION
34              
35             This syntax extension allows your instance methods to be invked with a
36             dot. It is only supposed to be used when you're defining classes. It
37             does not turn all objects methods invokable with a dot.
38              
39             It's not source-filtering, but operator overloading. Under the hood,
40             the real work is done in L.
41              
42             =head1 AUTHOR
43              
44             Kang-min Liu Egugod@gugod.orgE
45              
46             =head1 SEE ALSO
47              
48             L
49              
50             =cut
51