Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6f49cae0f4
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 39 lines (33 sloc) 1.131 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
use strict;
use warnings;

use Class::Struct;
struct TrepanPosition => {pkg => '$', filename => '$', line => '$',
                          event => '$'};

package TrepanPosition;
sub eq($$)
{
    my ($self, $other) = @_;
    return 0 unless defined $self && defined $other;
    return (
$self->filename eq $other->filename
&& $self->line eq $other->line
&& $self->event eq $other->event)
}

sub inspect($) {
    my $self = shift;
    return sprintf("pkg: %s, file: %s, line: %s, event: %s",
$self->pkg, $self->filename, $self->line, $self->event);
}

unless (caller) {
    my $line = __LINE__;
    my $pos1 = TrepanPosition->new(pkg=>__PACKAGE__, filename=>__FILE__,
line => $line, event=>'brkpt');
    my $pos2 = TrepanPosition->new(pkg=>__PACKAGE__, filename=>__FILE__,
line => $line, event=>'brkpt');
    my $pos3 = TrepanPosition->new(pkg=>__PACKAGE__, filename=>__FILE__,
line => __LINE__, event=>'brkpt');
    printf "pos1 is%s pos2\n", $pos1->eq($pos2) ? '' : ' not';
    printf "pos1 is%s pos3\n", $pos1->eq($pos3) ? '' : ' not';
    print $pos1->inspect, "\n";
    
}
1;
Something went wrong with that request. Please try again.