UndefObject/maybe.pm

filter: Statementstmt 100% 7 / 7 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 9 / 9 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
AUTOLOAD
1.0
CRAP 1.0
« UndefObject.pm ↑ Summary
1 package Patterns::UndefObject::maybe;
2  
3 =head1 NAME
4  
5 Patterns::UndefObject::maybe - Install a 'maybe' top lwvel package
6  
7 =head1 SYNOPSIS
8  
9 use Patterns::UndefObject::maybe;
10  
11 my $name = $user_rs->maybe::find(100)->name
12 || 'Unknown Username';
13  
14 =head1 DESCRIPTION
15  
16 See L<Patterns::UndefObject> for project details. This package does
17 everything that those documents describe, but instead if doing it via
18 an importable method (Maybe) or via a factory method, it installs a
19 top level 'maybe' namespace. You may find this approach more appealoing,
20 or you might find it to be a namespace polluter. You decide.
21  
22 =head1 AUTHOR
23  
24 See L<Patterns::UndefObject>
25  
26 =head1 COPYRIGHT & LICENSE
27  
28 See L<Patterns::UndefObject>
29  
30 =cut
31  
32 package maybe;
33  
34 1 ▶use Patterns::UndefObject;
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 3 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=1 SCAR=0.0
37 3 my $invocant = shift;
38 3 my ($method) = our $AUTOLOAD =~ /^maybe::(.+)$/;
39 3 return Patterns::UndefObject->maybe($invocant->$method(@_));
40 }
41  
42 1 1;
« UndefObject.pm ↑ Summary