Gtk3/Component/Role/FromBuilder.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod n/a totaltotal 0.0% 0 / 26 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::FromBuilder;
3 # ABSTRACT: Role that loads a Glade UI file into a Gtk3::Builder
4 $Intertangle::API::Gtk3::Component::Role::FromBuilder::VERSION = '0.005';
5 use Moo::Role;
6 use Intertangle::API::Gtk3::Helper;
7 use Renard::Incunabula::Common::Types qw(InstanceOf);
8  
9 requires 'ui_file';
10  
11 has builder => (
12 is => 'lazy', # _build_builder
13 isa => InstanceOf['Gtk3::Builder'],
14 );
15  
16 method _build_builder() :ReturnType(InstanceOf['Gtk3::Builder']) {
17 return Gtk3::Builder->new;
18 }
19  
20 before BUILD => method(@) {
21 $self->builder->add_from_file( $self->ui_file );
22 $self->builder->connect_signals;
23 };
24  
25  
26 1;
27  
28 __END__
29  
30 =pod
31  
32 =encoding UTF-8
33  
34 =head1 NAME
35  
36 Intertangle::API::Gtk3::Component::Role::FromBuilder - Role that loads a Glade UI file into a Gtk3::Builder
37  
38 =head1 VERSION
39  
40 version 0.005
41  
42 =head1 DESCRIPTION
43  
44 This role is used to load a Glade file into the C<builder> attribute.
45  
46 This role can be combined with L<Intertangle::API::Gtk3::Component::Role::UIFileFromPackageName>
47 so that the contents of the C<ui_file> attribute are automatically populated
48 based on the package that the role is being included in.
49  
50 =head1 ATTRIBUTES
51  
52 =head2 ui_file
53  
54 A C<Str> that contains the path to a Glade file to be loaded.
55  
56 Consumers of this role must implement this.
57  
58 =head2 builder
59  
60 A C<Gtk3::Builder> that contains the contents of the Glade file referenced in
61 C<ui_file>.
62  
63 =head1 AUTHOR
64  
65 Zakariyya Mughal <zmughal@cpan.org>
66  
67 =head1 COPYRIGHT AND LICENSE
68  
69 This software is copyright (c) 2017 by Zakariyya Mughal.
70  
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73  
74 =cut