blib/lib/Search/Tools/Object.pm

filter: Statementstmt 91.6% 11 / 12 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 85.0% 17 / 20 CC 3 SCAR 6.3
CC
3
Cov
81%
__ANON__
2.5
__ANON__
2.1
BEGIN
1.0
CRAP 1.9
« blib/lib/Search/Tools/TokenListPP.pm ↑ Summary blib/lib/Search/Tools/RegEx.pm »
1 package Search::Tools::Object;
2 34 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 34 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 has 'debug' => (
6 is => 'rw',
7 333 ▶ default => sub { $ENV{PERL_DEBUG} || 0 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$ENV{"PERL_DEBUG"} or 0 0 333 333
8 498 ▶ coerce => sub {
Subroutine __ANON__: called CC=2 SCAR=9.2
9 498 ▶ return 0 if !$_[0]; # allow for undef or zero
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 498 0 498
10 0 return $_[0];
11 }
12 34 );
13  
14 34 our $VERSION = '1.007';
15  
16 34 1;
17  
18 =pod
19  
20 =head1 NAME
21  
22 Search::Tools::Object - base class for Search::Tools objects
23  
24 =head1 SYNOPSIS
25  
26 package MyClass;
27 use Moo;
28 extends 'Search::Tools::Object';
29 has 'foo' => ( is => 'rw' );
30 has 'bar' => ( is => 'rw' );
31
32 1;
33
34 # elsewhere
35
36 use MyClass;
37 my $object = MyClass->new;
38 $object->foo(123);
39 print $object->bar . "\n";
40  
41 =head1 DESCRIPTION
42  
43 Search::Tools::Object is a simple Moo subclass.
44  
45 Prior to version 1.00 STO was a subclass of Rose::ObjectX::CAF.
46  
47 Prior to version 0.24 STO was a subclass of Class::Accessor::Fast.
48  
49 =head1 METHODS
50  
51 =head2 debug( I<n> )
52  
53 Get/set the debug value for the object. All objects inherit this attribute.
54 You can use the C<PERL_DEBUG> env var to set this value as well.
55  
56 =head1 AUTHOR
57  
58 Peter Karman C<< <karman@cpan.org> >>
59  
60 =head1 BUGS
61  
62 Please report any bugs or feature requests to C<bug-search-tools at rt.cpan.org>, or through
63 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-Tools>.
64 I will be notified, and then you'll
65 automatically be notified of progress on your bug as I make changes.
66  
67 =head1 SUPPORT
68  
69 You can find documentation for this module with the perldoc command.
70  
71 perldoc Search::Tools
72  
73  
74 You can also look for information at:
75  
76 =over 4
77  
78 =item * RT: CPAN's request tracker
79  
80 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Search-Tools>
81  
82 =item * AnnoCPAN: Annotated CPAN documentation
83  
84 L<http://annocpan.org/dist/Search-Tools>
85  
86 =item * CPAN Ratings
87  
88 L<http://cpanratings.perl.org/d/Search-Tools>
89  
90 =item * Search CPAN
91  
92 L<http://search.cpan.org/dist/Search-Tools/>
93  
94 =back
95  
96 =head1 COPYRIGHT
97  
98 Copyright 2009 by Peter Karman.
99  
100 This package is free software; you can redistribute it and/or modify it under the
101 same terms as Perl itself.
102  
103 =head1 SEE ALSO
104  
105 Search::QueryParser
« blib/lib/Search/Tools/TokenListPP.pm ↑ Summary blib/lib/Search/Tools/RegEx.pm »