Bolts/Role/Opaque.pm

filter: Statementstmt 100% 5 / 5 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 6 / 6 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« Bolts/Role/Locator.pm ↑ Summary Bolts/Role/SelfLocator.pm »
1 package Bolts::Role::Opaque;
2 1 $Bolts::Role::Opaque::VERSION = '0.143170';
3 # ABSTRACT: Make a bag/artifact opaque to acquisition
4  
5 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7  
8 1 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.143170
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
« Bolts/Role/Locator.pm ↑ Summary Bolts/Role/SelfLocator.pm »