File Coverage

blib/lib/Verby/Context.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package Verby::Context;
4 1     1   2884 use Moose;
  0            
  0            
5              
6             extends qw/Verby::Config::Data::Mutable/;
7              
8             our $VERSION = "0.05";
9              
10             require overload;
11              
12             with qw(MooseX::LogDispatch);
13              
14             has 'use_logger_singleton' => ( default => 1 );
15              
16             around logger => sub {
17             my ( $next, $self, @args ) = @_;
18              
19             return $self->SUPER::logger(@args) || $self->$next(@args);
20             };
21              
22             __PACKAGE__
23              
24             __END__
25              
26             =pod
27              
28             =head1 NAME
29              
30             Verby::Context - A sort of scratchpad every L<Verby::Step> gets from
31             L<Verby::Dispatcher>.
32              
33             =head1 SYNOPSIS
34              
35             sub do {
36             my $self = shift;
37             my $context = shift;
38              
39             print $context->rockets; # get a value
40             gDi
41             $context->milk("very"); # set a value
42             }
43              
44             =head1 DESCRIPTION
45              
46             A context has two roles in L<Verby>. The first is to control what a
47             L<Verby::Action> will do, by providing it with parameters, and the other is to
48             share variables that the action sets, so that other steps may have them too.
49              
50             It is a mutable L<Verby::Config::Data> that derives from the global context.
51              
52             =head1 METHODS
53              
54             =over 4
55              
56             =item B<logger>
57              
58             =back
59              
60             =head1 EXAMPLE USAGE
61              
62             See the annotated F<scripts/module_builder.pl> for how a context is used in
63             practice.
64              
65             =head1 THE LOGGER FIELD
66              
67             $c->logger;
68              
69             See L<MooseX::LogDispatch>.
70              
71             =head1 BUGS
72              
73             None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it.
74              
75             =head1 CODE COVERAGE
76              
77             We use B<Devel::Cover> to test the code coverage of the tests, please refer to COVERAGE section of the L<Verby> module for more information.
78              
79             =head1 SEE ALSO
80              
81             =head1 AUTHOR
82              
83             Yuval Kogman, E<lt>nothingmuch@woobling.orgE<gt>
84              
85             =head1 COPYRIGHT AND LICENSE
86              
87             Copyright 2005-2008 by Infinity Interactive, Inc.
88              
89             L<http://www.iinteractive.com>
90              
91             This library is free software; you can redistribute it and/or modify
92             it under the same terms as Perl itself.
93              
94             =cut