| File: | blib/lib/App/Test/Generator/Template.pm |
| Coverage: | 100.0% |
| line | stmt | bran | cond | sub | time | code |
|---|---|---|---|---|---|---|
| 1 | package App::Test::Generator::Template; | |||||
| 2 | ||||||
| 3 | 22 22 22 | 127305 19 286 | use strict; | |||
| 4 | 22 22 22 | 37 15 397 | use warnings; | |||
| 5 | 22 22 22 | 384 11946 46 | use autodie qw(:all); | |||
| 6 | ||||||
| 7 | 22 22 22 | 55814 199 47 | use utf8; | |||
| 8 | 22 22 22 | 3800 6380 1463 | use Data::Section::Simple; | |||
| 9 | ||||||
| 10 | our $VERSION = '0.41'; | |||||
| 11 | ||||||
| 12 - 69 | =head1 NAME
App::Test::Generator::Template - Template for the test files generated by App::Test::Generator
=head1 VERSION
Version 0.41
=head1 SYNOPSIS
The template for the test files generated by App::Test::Generator.
=head1 METHODS
=head2 get_data_section
Returns a reference to the named template, read from this module's
C<__DATA__> section via L<Data::Section::Simple>.
my $template_ref = App::Test::Generator::Template->get_data_section('test.tt');
my $template_ref = App::Test::Generator::Template::get_data_section('test.tt');
=head3 Arguments
=over 4
=item * C<$template_file>
The name of the C<@@>-delimited section to retrieve. The only value
currently defined in this module's C<__DATA__> section is C<test.tt>.
May be called either as a class method (C<< Template->get_data_section(...) >>,
in which case the leading class-name argument is stripped before lookup)
or as a plain function.
=back
=head3 Returns
A scalar reference to the template content. If C<$template_file> does
not match a defined C<@@> section, returns a reference to C<undef>.
=head3 Side Effects
None. Does not write to disk or modify any global state.
=head3 API specification
=head4 input
{
template_file => { type => SCALAR, optional => 1 },
}
=head4 output
{ type => SCALARREF }
=cut | |||||
| 70 | ||||||
| 71 | sub get_data_section | |||||
| 72 | { | |||||
| 73 | 97 | 195166 | if($_[0] && ($_[0] eq __PACKAGE__)) { | |||
| 74 | 92 | 70 | shift; | |||
| 75 | } | |||||
| 76 | ||||||
| 77 | 97 | 205 | return \Data::Section::Simple::get_data_section($_[0]); | |||
| 78 | } | |||||
| 79 | ||||||
| 80 | 1; | |||||
| 81 | ||||||
| 82 - 90 | =head1 AUTHOR Nigel Horne, C<< <njh at nigelhorne.com> >> Portions of this module's initial design and documentation were created with the assistance of L<ChatGPT|https://openai.com/> (GPT-5), with final curation and authorship by Nigel Horne. =cut | |||||
| 91 | ||||||