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             our $VERSION = "1.04";
7              
8 5     5   1863 use Pony::Object;
  5         7  
  5         21  
9              
10             protected message => '';
11             protected package => '';
12             protected file => '';
13             protected line => '';
14              
15             # Method: throw
16             # Say "hello" and raise Exception.
17             #
18             # Parameters:
19             # $this - Str||Pony::Object - self
20             # $message - Str - some funny message for poor users.
21             sub throw : Public {
22 8     8 0 1026 my $this = shift; # pkg || obj
23 8 50       39 $this = $this->new unless ref $this;
24 8   100     45 $this->message = shift || "no comments";
25 8   33     61 ($this->package, $this->file, $this->line) = @_ || caller;
26              
27 8         28 printf STDERR "\n\"%s\" at %s (%s:%s)\n",
28             $this->message, $this->package, $this->file, $this->line;
29              
30 8         66 die $this;
31 5     5   2363 }
  5         5119  
  5         23  
32             }
33              
34             1;
35              
36             __END__