Layout.pm 808 Bytes
Newer Older
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 39 40 41 42 43 44
package C4::Patroncards::Layout;

use strict;
use warnings;

use base qw(C4::Creators::Layout);

use autouse 'Data::Dumper' => qw(Dumper);


__PACKAGE__ =~ m/^C4::(.+)::.+$/;
my $me = $1;

sub new {
    my $self = shift;
    push @_, "creator", $me;
    return $self->SUPER::new(@_);
}

sub save {
    my $self = shift;
    push @_, "creator", $me;
    return $self->SUPER::save(@_);
}

sub retrieve {
    my $self = shift;
    push @_, "creator", $me;
    return $self->SUPER::retrieve(@_);
}

sub delete {
    if (ref($_[0])) {
        my $self = shift;  # check to see if this is a method call
        push @_, "creator", $me;
        return $self->SUPER::delete(@_);
    }
    else {
        push @_, "creator", $me;
        return __PACKAGE__->SUPER::delete(@_); # XXX: is this too hackish?
    }
}

1;