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
26
27
28
29
30
31
32
33
|
use utf8;
use Data::Dumper;
sub p ($) {
use warnings;
use strict 'refs';
print Data::Dumper::Dumper(shift @_);
}
package Point;
sub BEGIN {
use warnings;
use strict 'refs';
require base;
do {
'base'->import('Class::Accessor::Fast')
};
}
use warnings;
use strict 'refs';
'Point'->mk_accessors('x', 'y');
package main;
my $p = 'Point'->new;
p $p;
$p->x(128);
$p->y(256);
eval {
do {
$p->z(32)
}
};
warn $@ if $@;
p($p->x);
p($p->y);
p $p;
|