[Dbix-class] How to bypass a overidden method?

Brandon Black blblack at gmail.com
Fri Jun 29 16:51:03 GMT 2007


On 6/29/07, Ramprabhu Kaliaperumal <ramprabhu.kaliaperumal at oracle.com> wrote:
> I wrote a override method 'insert' in my class, which does password
> field encryption before inserting into db.
>
> But there are some situation where I don't need to have this override
> method 'insert' get executed .. and just call the super 'insert' method.
>
> Is there is any way to by-pass the overridden method.
>

If you need both a new behavior and the original behavior available to
users of the class, try using a new name for the new behavior.  e.g.,
instead of what you probably have now:

sub insert {
    my $self = shift;
    [.......]
    $self->next::method(@_);
}

Do something like:

sub insert_encrypted {
    my $self = shift;
    [...]
    $self->insert(@_);
}



More information about the Dbix-class mailing list