File Coverage

lib/Ubic/Result.pm
Criterion Covered Total %
statement 19 19 100.0
branch 2 2 100.0
condition 2 3 66.6
subroutine 6 6 100.0
pod 1 1 100.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Ubic::Result;
2             $Ubic::Result::VERSION = '1.59';
3 40     40   14070 use strict;
  40         45  
  40         934  
4 40     40   123 use warnings;
  40         27  
  40         822  
5              
6             # ABSTRACT: common return value for many ubic interfaces
7              
8              
9 40     40   10007 use Ubic::Result::Class;
  40         68  
  40         165  
10 40     40   1131 use Scalar::Util qw(blessed);
  40         68  
  40         2077  
11 40     40   147 use parent qw(Exporter);
  40         46  
  40         143  
12              
13             our @EXPORT_OK = qw(
14             result
15             );
16             our %EXPORT_TAGS = (
17             all => \@EXPORT_OK,
18             );
19              
20             sub result {
21 322     322 1 1147 my ($str, $msg) = @_;
22 322 100 66     2172 if (blessed $str and $str->isa('Ubic::Result::Class')) {
23 155         458 return $str;
24             }
25 167         1917 return Ubic::Result::Class->new({ type => "$str", msg => $msg });
26             }
27              
28              
29             1;
30              
31             __END__