line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Language::LispPerl::Var; |
2
|
|
|
|
|
|
|
$Language::LispPerl::Var::VERSION = '0.007'; |
3
|
6
|
|
|
6
|
|
23
|
use Moose; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
41
|
|
4
|
6
|
|
|
6
|
|
27959
|
use Moose::Util::TypeConstraints; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
48
|
|
5
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
7683
|
use Language::LispPerl::Printer; |
|
6
|
|
|
|
|
11
|
|
|
6
|
|
|
|
|
129
|
|
7
|
6
|
|
|
6
|
|
20
|
use Language::LispPerl::Reader; |
|
6
|
|
|
|
|
8
|
|
|
6
|
|
|
|
|
1023
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'name' => ( is => 'ro', isa => 'Str', required => 1 ); |
10
|
|
|
|
|
|
|
has 'value' => ( is => 'rw' , isa => union(['Undef', |
11
|
|
|
|
|
|
|
'Str', |
12
|
|
|
|
|
|
|
class_type( 'Language::LispPerl::Atom'), |
13
|
|
|
|
|
|
|
class_type('Language::LispPerl::Seq') ] ) ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub to_hash{ |
16
|
12
|
|
|
12
|
0
|
15
|
my ($self) = @_; |
17
|
|
|
|
|
|
|
return { |
18
|
12
|
|
|
|
|
317
|
name => $self->name(), |
19
|
|
|
|
|
|
|
value => Language::LispPerl::Printer::to_perl( $self->value() ), |
20
|
|
|
|
|
|
|
__class => $self->blessed(), |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub from_hash{ |
25
|
6
|
|
|
6
|
0
|
11
|
my ($class, $hash) = @_; |
26
|
|
|
|
|
|
|
return $class->new({ |
27
|
6
|
|
|
|
|
10
|
map{ $_ => Language::LispPerl::Reader::from_perl( $hash->{$_} ) } keys %$hash |
|
18
|
|
|
|
|
42
|
|
28
|
|
|
|
|
|
|
}); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 NAME |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Language::LispPerl::Var - A variable with a name (ro) and a value (rw) |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |