Mason/Interp.pm

filter: Statementstmt 76.9% 20 / 26 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 85.7% 6 / 7 Podpod 100% 1 / 1 totaltotal 69.2% 27 / 39 CC 3 SCAR 15.4
CC
3
Cov
67%
new
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.7
↑ Summary Mason.pm »
1 package HPSG::Mason::Interp;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 =head1 NAME
5  
6 HPSG::Mason::Interp - Mason components for rendering Head-driven Phrase Structure Grammar feature structures to \LaTeX
7  
8 =cut
9  
10 1 ▶use base qw( HTML::Mason::Interp );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use HTML::Mason;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use FindBin;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 ▶use File::ShareDir;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 =head1 VERSION
19  
20 Version 0.04
21  
22 =cut
23  
24 1 our $VERSION = '0.04';
25  
26 =head1 SYNOPSIS
27  
28 use HPSG::Mason::Interp;
29  
30 my %phrase;
31  
32 $phrase{I} =
33 {
34 expression_arg =>
35 {
36 expr_type => 'phrase',
37 syn_arg => { head_arg => { pos => 'noun',
38 agr_arg => { agr_cat => '1sing',
39 per => '1st',
40 num => 'sg',
41 },
42 case => 'nom'
43 },
44 val_arg => { spr => [ ],
45 comps => [ ],
46 mod => [ ],
47 }
48 },
49 sem_arg => { mode => 'ref',
50 index => '{\it i}',
51 restr => [ { reln => 'speaker',
52 inst => 'i',
53 } ]
54 }
55 },
56 tag => 9,
57 daughters => [ 'I' ],
58 };
59  
60 my $outbuf;
61 my $interp = HPSG::Mason::Interp->new( outbuf => \$outbuf);
62  
63 $interp->exec( '/tree.mas', { root => $phrase{I} } );
64  
65 my $fname = 'lex_I.tex';
66  
67 open( my $fh, q{>}, $fname ) or die "couldn't open file '$fname': $!";
68 print $fh $outbuf;
69 close $fh;
70  
71 =head1 FUNCTIONS
72  
73 =head2 new
74  
75 See HTML::Mason::new, we just add the search path for some stock components
76  
77 =cut
78  
79 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
Pod documented
80 0 my $class = shift;
81 0 my %args = @_;
82  
83 0 my $share_dir = File::ShareDir::dist_dir('HPSG-Mason');
84 0 ▶ my %data_dir = exists $args{data_dir} ? ( data_dir => $args{data_dir} ) : ();
Branch: 1 branch
BranchTrueFalseTotal
exists $args{'data_dir'} ? : 0 0 0
85 0 ▶ my $comp_root = $args{comp_root} || [];
Condition0%0/2
$args{'comp_root'} || []
l!l
00
MC/DC0%0/1
$args{'comp_root'} || []
$args{'comp_root'}
Truth table0%0/2
A
A= $args{'comp_root'}
Aresult
11
00
86  
87 return
88 HTML::Mason::Interp->new( comp_root =>
89 [ [ 'HPSG-Mason' => File::Spec->catfile( $share_dir,'comps' ) ],
90 @$comp_root,
91 ],
92 %data_dir,
93 out_method => $args{outbuf},
94 0 );
95 }
96  
97 =head1 AUTHOR
98  
99 C.J. Adams-Collier, C<< <cjac at u.washington.edu> >>
100  
101 =head1 BUGS
102  
103 Please report any bugs or feature requests to C<bug-hpsg-mason at rt.cpan.org>, or through
104 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HPSG-Mason>. I will be notified, and then you'll
105 automatically be notified of progress on your bug as I make changes.
106  
107  
108 =head1 SUPPORT
109  
110 You can find documentation for this module with the perldoc command.
111  
112 perldoc HPSG::Mason::Interp
113  
114  
115 You can also look for information at:
116  
117 =over 4
118  
119 =item * RT: CPAN's request tracker
120  
121 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=HPSG-Mason>
122  
123 =item * AnnoCPAN: Annotated CPAN documentation
124  
125 L<http://annocpan.org/dist/HPSG-Mason>
126  
127 =item * CPAN Ratings
128  
129 L<http://cpanratings.perl.org/d/HPSG-Mason>
130  
131 =item * Search CPAN
132  
133 L<http://search.cpan.org/dist/HPSG-Mason>
134  
135 =back
136  
137  
138 =head1 ACKNOWLEDGEMENTS
139  
140  
141 =head1 COPYRIGHT & LICENSE
142  
143 Copyright 2009 C.J. Adams-Collier, all rights reserved.
144  
145 This program is free software; you can redistribute it and/or modify it
146 under the same terms as Perl itself.
147  
148  
149 =cut
150  
151 1 1; # End of HPSG::Mason::Interp
↑ Summary Mason.pm »