Gtk3/Component/Role/UIFileFromPackageName.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 31 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 use Renard::Incunabula::Common::Setup;
2 package Intertangle::API::Gtk3::Component::Role::UIFileFromPackageName;
3 # ABSTRACT: Role to obtain name of Glade UI file from the name of the package
4 $Intertangle::API::Gtk3::Component::Role::UIFileFromPackageName::VERSION = '0.005';
5 use Moo::Role;
6  
7 use Renard::Incunabula::Common::Types qw(File);
8 use File::Spec;
9 use File::Basename;
10 use Module::Util qw(:all);
11  
12 has ui_file => (
13 is => 'ro',
14 isa => File,
15 coerce => 1,
16 default => method() {
17 my $module_name = ref $self;
18 my $package_last_component = (split(/::/, $module_name))[-1];
19 my $module_file = find_installed($module_name);
20 File::Spec->catfile(dirname($module_file), "@{[ $package_last_component ]}.glade")
21 }
22 );
23  
24 1;
25  
26 __END__
27  
28 =pod
29  
30 =encoding UTF-8
31  
32 =head1 NAME
33  
34 Intertangle::API::Gtk3::Component::Role::UIFileFromPackageName - Role to obtain name of Glade UI file from the name of the package
35  
36 =head1 VERSION
37  
38 version 0.005
39  
40 =head1 DESCRIPTION
41  
42 See the description of the attribute C<ui_file> for more information.
43  
44 =head1 ATTRIBUTES
45  
46 =head2 ui_file
47  
48 A C<Str> that contains the path to a Glade UI file that resides in the same
49 directory as the C<.pm> file for the package that this role is used with.
50  
51 For example, given a package C<Foo::Bar> from the file C<lib/Foo/Bar.pm>, the
52 contents of C<ui_file> will be C<lib/Foo/Bar.glade>.
53  
54 See the C<ui_file> attribute in L<Intertangle::API::Gtk3::Component::Role::FromBuilder>.
55  
56 =head1 AUTHOR
57  
58 Zakariyya Mughal <zmughal@cpan.org>
59  
60 =head1 COPYRIGHT AND LICENSE
61  
62 This software is copyright (c) 2017 by Zakariyya Mughal.
63  
64 This is free software; you can redistribute it and/or modify it under
65 the same terms as the Perl 5 programming language system itself.
66  
67 =cut