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.60';
3 39     39   13578 use strict;
  39         36  
  39         836  
4 39     39   108 use warnings;
  39         34  
  39         733  
5              
6             # ABSTRACT: common return value for many ubic interfaces
7              
8              
9 39     39   9420 use Ubic::Result::Class;
  39         52  
  39         161  
10 39     39   975 use Scalar::Util qw(blessed);
  39         72  
  39         1803  
11 39     39   136 use parent qw(Exporter);
  39         39  
  39         131  
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 954 my ($str, $msg) = @_;
22 322 100 66     1870 if (blessed $str and $str->isa('Ubic::Result::Class')) {
23 155         423 return $str;
24             }
25 167         1879 return Ubic::Result::Class->new({ type => "$str", msg => $msg });
26             }
27              
28              
29             1;
30              
31             __END__