File Coverage

lib/Devel/Trepan/Position.pm
Criterion Covered Total %
statement 18 20 90.0
branch 1 2 50.0
condition 3 6 50.0
subroutine 6 7 85.7
pod 0 2 0.0
total 28 37 75.6


line stmt bran cond sub pod time code
1             # Copyright (C) 2011-2014 Rocky Bernstein <rocky@cpan.org>
2 13     13   59467 use warnings; use strict;
  13     13   36  
  13         405  
  13         72  
  13         31  
  13         278  
3              
4 13     13   713 use Class::Struct;
  13         10891  
  13         153  
5 13     13   1577 no strict 'subs';
  13         31  
  13         729  
6             struct Devel::Trepan::Position => {pkg => '$', filename => '$', line => '$',
7             event => '$'};
8 13     13   82 use strict 'subs';
  13         33  
  13         3508  
9              
10             package Devel::Trepan::Position;
11             sub eq($$)
12             {
13 2     2 0 2078 my ($self, $other) = @_;
14 2 50 33     19 return 0 unless defined $self && defined $other;
15             return (
16 2   66     61 $self->filename eq $other->filename
17             && $self->line eq $other->line
18             && $self->event eq $other->event)
19             }
20              
21             sub inspect($) {
22 0     0 0   my $self = shift;
23 0           return sprintf("pkg: %s, file: %s, line: %s, event: %s",
24             $self->pkg, $self->filename, $self->line, $self->event);
25             }
26              
27             unless (caller) {
28             my $line = __LINE__;
29             my $pos1 = __PACKAGE__->new(pkg=>__PACKAGE__, filename=>__FILE__,
30             line => $line, event=>'brkpt');
31             my $pos2 = __PACKAGE__->new(pkg=>__PACKAGE__, filename=>__FILE__,
32             line => $line, event=>'brkpt');
33             my $pos3 = __PACKAGE__->new(pkg=>__PACKAGE__, filename=>__FILE__,
34             line => __LINE__, event=>'brkpt');
35             printf "pos1 is%s pos2\n", $pos1->eq($pos2) ? '' : ' not';
36             printf "pos1 is%s pos3\n", $pos1->eq($pos3) ? '' : ' not';
37             print $pos1->inspect, "\n";
38              
39             }
40             1;