File Coverage

blib/lib/Perl6/Pod/FormattingCode/A.pm
Criterion Covered Total %
statement 18 33 54.5
branch 0 2 0.0
condition n/a
subroutine 6 10 60.0
pod 0 4 0.0
total 24 49 48.9


line stmt bran cond sub pod time code
1             #===============================================================================
2             #
3             # DESCRIPTION: Replaced by contents of specified macro/object
4             #
5             # AUTHOR: Aliaksandr P. Zahatski,
6             #===============================================================================
7             package Perl6::Pod::FormattingCode::A;
8              
9             =pod
10              
11             =head1 NAME
12              
13             Perl6::Pod::FormattingCode::A - Replaced by contents of specified macro/object
14              
15             =head1 SYNOPSIS
16              
17             =alias PROGNAME Earl Irradiatem Eventually
18             =alias VENDOR 4D Kingdoms
19             =alias TERMS_URL L
20            
21             The use of A is subject to the terms and conditions
22             laid out by A, as specified at A.
23              
24              
25             =head1 DESCRIPTION
26              
27             A variation on placement codes is the CE> code, which is replaced
28             by the contents of the named alias or object specified within its delimiters.
29             For example:
30              
31             =alias PROGNAME Earl Irradiatem Eventually
32             =alias VENDOR 4D Kingdoms
33             =alias TERMS_URL L
34              
35             The use of A is subject to the terms and conditions
36             laid out by A, as specified at A.
37              
38             Any compile-time Perl 6 object that starts with a sigil is automatically
39             available within an alias placement as well. Unless the object is already
40             a string type, it is converted to a string during document-generation by
41             implicitly calling C<.perl> on it.
42              
43             So, for example, a document can refer to its own filename (as
44             C$?FILEE>), or to the subroutine inside which the specific Pod is nested
45             (as C$?ROUTINEE>), or to the current class (as C$?CLASSE>).
46             Similarly, the value of any program constants defined with sigils can be
47             easily reproduced in documentation:
48              
49             # Actual code...
50             constant $GROWTH_RATE of Num where 0..* = 1.6;
51              
52             =pod
53             =head4 Standard Growth Rate
54              
55             The standard growth rate is assumed to be A<$GROWTH_RATE>.
56              
57             Non-mutating method calls on these objects are also allowed, so a
58             document can reproduce the surrounding subroutine's signature
59             (C$?ROUTINE.signatureE>) or the type of a constant
60             (C$GROWTH_RATE.WHATE>).
61              
62             =cut
63              
64 3     3   16 use warnings;
  3         8  
  3         84  
65 3     3   15 use strict;
  3         6  
  3         57  
66 3     3   13 use Data::Dumper;
  3         5  
  3         127  
67 3     3   1530 use Perl6::Pod::FormattingCode;
  3         10  
  3         74  
68 3     3   18 use Perl6::Pod::Utl;
  3         5  
  3         62  
69 3     3   14 use base 'Perl6::Pod::FormattingCode';
  3         6  
  3         847  
70             our $VERSION = '0.01';
71              
72             sub new {
73 0     0 0   my $class = shift;
74 0           my $self = $class->SUPER::new(@_);
75 0           my $alias_value = $self->context->{_alias}->{$self->{content}->[0]};
76 0 0         if (my $tree = Perl6::Pod::Utl::parse_para($alias_value) ) {
77 0           $self->{content} = $tree;
78             }
79 0           return $self;
80             }
81              
82             sub to_xhtml {
83 0     0 0   my $self = shift;
84 0           my $to = shift;
85 0           $to->visit_childs($self);
86             }
87              
88             sub to_docbook {
89 0     0 0   my $self = shift;
90 0           my $to = shift;
91 0           $to->visit_childs($self);
92             }
93              
94             sub to_latex {
95 0     0 0   my $self = shift;
96 0           my $to = shift;
97 0           $to->visit_childs($self);
98             }
99              
100             1;
101             __END__