File: 02-use.t

package info (click to toggle)
libclass-accessor-lite-perl 0.08-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 204 kB
  • sloc: perl: 2,284; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 394 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package L;

use strict;
use warnings;
use Class::Accessor::Lite (
    new => 1,
    rw  => [ qw(foo bar baz) ],
    ro  => [ qw(tokuhirom) ],
    wo  => [ qw(yappo) ],
);

use Test::More tests => 6;

my $l = L->new(
    bar       => 1,
    tokuhirom => 2,
);
is ref($l), 'L';
ok ! defined $l->foo;
is $l->bar, 1;
is $l->tokuhirom, 2;
$l->bar(3);
is $l->bar, 3;
$l->yappo(4);
is $l->{yappo}, 4;