File Coverage

File:blib/lib/App/Test/Generator/Template.pm
Coverage:100.0%

linestmtbrancondsubtimecode
1package App::Test::Generator::Template;
2
3
24
24
24
130838
20
272
use strict;
4
24
24
24
38
21
446
use warnings;
5
24
24
24
398
11872
63
use autodie qw(:all);
6
7
24
24
24
60147
227
71
use utf8;
8
24
24
24
4640
7699
1597
use Data::Section::Simple;
9
10our $VERSION = '0.46';
11
12 - 69
=head1 NAME

App::Test::Generator::Template - Template for the test files generated by App::Test::Generator

=head1 VERSION

Version 0.46

=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
71sub get_data_section
72{
73
106
202647
        if($_[0] && ($_[0] eq __PACKAGE__)) {
74
101
108
                shift;
75        }
76
77
106
361
        return \Data::Section::Simple::get_data_section($_[0]);
78}
79
801;
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