| 1 | package Decl::Semantics::Value; | ||||||||||
| 2 | |||||||||||
| 3 | 13 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 13 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 13 | ▶ | use base qw(Decl::Node); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 13 | ▶ | use Decl::Semantics::Code; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 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 | 13 | 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 | ▶ | sub defines { ('value'); } | ||||||||
|
Subroutine
defines: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 33 | 12 | ▶ | sub tags_defined { Decl->new_data(<<EOF); } | ||||||||
|
Subroutine
tags_defined: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 34 | value (body=vanilla) | ||||||||||
| 35 | EOF | ||||||||||
| 36 | |||||||||||
| 37 | =head2 build_payload | ||||||||||
| 38 | |||||||||||
| 39 | The C<build> 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 | 12 | ▶ | sub build_payload { | ||||||||
|
Subroutine
build_payload: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 47 | 12 | my ($self, $is_event) = @_; | |||||||||
| 48 | 12 | ▶ | return $self if $self->{built}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 12 | my $cx = $self->parent; | |||||||||
| 50 | |||||||||||
| 51 | 12 | Decl::Semantics::Code::build_payload($self, 0, 'this', 'key', 'value'); | |||||||||
| 52 | 12 | $self->{built} = 1; | |||||||||
| 53 | |||||||||||
| 54 | 12 | ▶ | if ($self->{callable}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 4 | $self->{callable} = 0; | |||||||||
| 56 | 4 | $cx->register_varhandler ($self->name, $self->{sub}); | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | 12 | $cx->{hashtie}->just_store ($self->name, $self->label); | |||||||||
| 60 | 12 | return $self; | |||||||||
| 61 | } | ||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | =head1 AUTHOR | ||||||||||
| 65 | |||||||||||
| 66 | Michael Roberts, C<< <michael at vivtek.com> >> | ||||||||||
| 67 | |||||||||||
| 68 | =head1 BUGS | ||||||||||
| 69 | |||||||||||
| 70 | Please report any bugs or feature requests to C<bug-decl at rt.cpan.org>, or through | ||||||||||
| 71 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Decl>. 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 | 13 | 1; # End of Decl::Semantics::Value | |||||||||