Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: b3873da4e3
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (32 sloc) 0.782 kB
# Test derived from Method::Signatures::Simple:
# Copyright 2008 Rhesa Rozendaal, all rights reserved.
# This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
use strict;
use warnings;
use Test::More tests => 8;
use_ok 'methods';
{
package My::Obj;
use methods;
method make($class: %opts) {
bless {%opts}, $class;
}
method first : lvalue {
$self->{first};
}
method second {
$self->first + 1;
}
method nth($inc) {
$self->first + $inc;
}
}
my $o = My::Obj->make(first => 1);
is $o->first, 1;
is $o->second, 2;
is $o->nth(10), 11;
$o->first = 10;
is $o->first, 10;
is $o->second, 11;
is $o->nth(10), 20;
ok !$o->can('method'), 'autoclean worked'
Jump to Line
Something went wrong with that request. Please try again.