AutoCode

 view release on metacpan or  search on metacpan

lib/AutoCode/Root0.pm  view on Meta::CPAN

    while(my @call=caller($i++)){
        $prev->[3]=$call[3];
        push(@out, $prev);
        $prev=\@call;
    }
    $prev->[3]='toplevel';
    push @out, $prev;
    return @out;
}

sub _not_implemented_msg {
    my $self=shift;
    my $pkg=ref $self;
    my $method=(caller(1))[3];
    my $msg="Abstract method [$method] is not implemented by package $pkg.\n";
    return $msg;
}

sub throw_not_implemented {
    my $self=shift;
    $self->throw($self->_not_implemented_msg);
}

sub warn_not_implemented {
    my $self=shift;
    $self->warn($self->_not_implemented_msg);
}

1;

lib/AutoCode/Unimplemented.pm  view on Meta::CPAN

use strict;
use AutoCode::Root;
our @ISA=qw(AutoCode::Root);

sub import {
    my ($caller, $methods, $pkg)=@_;
    my $class = ref($caller)||$caller;
    $pkg||=caller;
    no strict 'refs';
    foreach(@$methods){
        *{"$pkg\::$_"}= sub {shift->not_implemented;};
    }
}

1;
__END__

=head1 NAME

AutoCode::Unimplemented - stuff the unimplemented methods in Interface module



( run in 0.787 second using v1.01-cache-2.11-cpan-0a987023a57 )