File Coverage

lib/Pony/Object/Throwable.pm
Criterion Covered Total %
statement 12 12 100.0
branch 1 2 50.0
condition 3 5 60.0
subroutine 3 3 100.0
pod 0 1 0.0
total 19 23 82.6


line stmt bran cond sub pod time code
1             # Class: Pony::Object::Throwable
2             # Simplest Exception class.
3              
4             # "The owls are not what they seem"
5             package Pony::Object::Throwable {
6 5     5   1548 use Pony::Object;
  5         5  
  5         28  
7            
8             protected message => '';
9             protected package => '';
10             protected file => '';
11             protected line => '';
12            
13             # Method: throw
14             # Say "hello" and raise Exception.
15             #
16             # Parameters:
17             # $this - Str||Pony::Object - self
18             # $message - Str - some funny message for poor users.
19             sub throw : Public {
20 8     8 0 796 my $this = shift; # pkg || obj
21 8 50       31 $this = $this->new unless ref $this;
22 8   100     33 $this->message = shift || "no comments";
23 8   33     49 ($this->package, $this->file, $this->line) = @_ || caller;
24            
25 8         20 printf STDERR "\n\"%s\" at %s (%s:%s)\n",
26             $this->message, $this->package, $this->file, $this->line;
27            
28 8         52 die $this;
29 5     5   2339 }
  5         4525  
  5         23  
30             }
31              
32             1;
33              
34             __END__