File Coverage

blib/lib/Bolts/Role/Opaque.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Bolts::Role::Opaque;
2             $Bolts::Role::Opaque::VERSION = '0.143171';
3             # ABSTRACT: Make a bag/artifact opaque to acquisition
4              
5 1     1   555 use Moose::Role;
  1         2  
  1         8  
6              
7              
8             1;
9              
10             __END__
11              
12             =pod
13              
14             =encoding UTF-8
15              
16             =head1 NAME
17              
18             Bolts::Role::Opaque - Make a bag/artifact opaque to acquisition
19              
20             =head1 VERSION
21              
22             version 0.143171
23              
24             =head1 SYNOPSIS
25              
26             package MyApp::Secrets;
27             use Moose;
28              
29             with 'Bolts::Role::Opaque';
30              
31             sub foo { "secret" }
32              
33             package MyApp;
34             use Bolts;
35              
36             artifact 'secrets' => (
37             class => 'MyApp::Secrets',
38             );
39              
40             my $bag = MyApp->new;
41             my $secrets = $bag->acquire('secrets'); # OK!
42             my $foo = $secrets->foo; # OK!
43              
44             # NO NO NO! Croaks.
45             my $foo_direct = $bag->acquire('secrets', 'foo'); # NO!
46              
47             =head1 DESCRIPTION
48              
49             Marks an artifact/bag so that the item cannot be reached via the C<acquire> method.
50              
51             Why? I don't know. It seemed like a good idea.
52              
53             =head1 AUTHOR
54              
55             Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
56              
57             =head1 COPYRIGHT AND LICENSE
58              
59             This software is copyright (c) 2014 by Qubling Software LLC.
60              
61             This is free software; you can redistribute it and/or modify it under
62             the same terms as the Perl 5 programming language system itself.
63              
64             =cut