File Coverage

lib/Decl/Semantics/Value.pm
Criterion Covered Total %
statement 23 24 95.8
branch 3 4 75.0
condition n/a
subroutine 6 7 85.7
pod 3 3 100.0
total 35 38 92.1


line stmt bran cond sub pod time code
1             package Decl::Semantics::Value;
2            
3 12     12   82 use warnings;
  12         30  
  12         483  
4 12     12   78 use strict;
  12         25  
  12         854  
5            
6 12     12   78 use base qw(Decl::Node);
  12         25  
  12         1217  
7 12     12   80 use Decl::Semantics::Code;
  12         29  
  12         4159  
8            
9             =head1 NAME
10            
11             Decl::Semantics::Value - implements a named value in an event context
12            
13             =head1 VERSION
14            
15             Version 0.01
16            
17             =cut
18            
19             our $VERSION = '0.01';
20            
21            
22             =head1 SYNOPSIS
23            
24             This class serves two purposes: first, it's an example of what a semantic node class should look like, and second, it
25             will probably end up being the class that builds most of the code references in a declarative program.
26            
27             =head2 defines(), tags_defined()
28            
29             Called by Decl::Semantics during import, to find out what xmlapi tags this plugin claims to implement.
30            
31             =cut
32 0     0 1 0 sub defines { ('value'); }
33 12     12 1 91 sub tags_defined { Decl->new_data(<
34             value (body=vanilla)
35             EOF
36            
37             =head2 build_payload
38            
39             The C function is then called when this object's payload is built (i.e. in the stage when we're adding semantics to our
40             parsed syntax).
41            
42             The parent's payload will always have been created by the time this function is called.
43            
44             =cut
45            
46             sub build_payload {
47 12     12 1 30 my ($self, $is_event) = @_;
48 12 50       55 return $self if $self->{built};
49 12         48 my $cx = $self->parent;
50            
51 12         76 Decl::Semantics::Code::build_payload($self, 0, 'this', 'key', 'value');
52 12         27 $self->{built} = 1;
53            
54 12 100       48 if ($self->{callable}) {
55 4         9 $self->{callable} = 0;
56 4         29 $cx->register_varhandler ($self->name, $self->{sub});
57             }
58            
59 12         90 $cx->{hashtie}->just_store ($self->name, $self->label);
60 12         36 return $self;
61             }
62            
63            
64             =head1 AUTHOR
65            
66             Michael Roberts, C<< >>
67            
68             =head1 BUGS
69            
70             Please report any bugs or feature requests to C, or through
71             the web interface at L. I will be notified, and then you'll
72             automatically be notified of progress on your bug as I make changes.
73            
74             =head1 LICENSE AND COPYRIGHT
75            
76             Copyright 2010 Michael Roberts.
77            
78             This program is free software; you can redistribute it and/or modify it
79             under the terms of either: the GNU General Public License as published
80             by the Free Software Foundation; or the Artistic License.
81            
82             See http://dev.perl.org/licenses/ for more information.
83            
84             =cut
85            
86             1; # End of Decl::Semantics::Value