Fernan Aguero wrote:
> Hi,
> 
> I'd like to overload (or would it be override?) the
> merge_session_to_user sub in
> Catalyst::Plugin::Session::PerUser to be able to guide the
> hash merge (i.e. create new hash value keys for conflicting
> keys).
> 
> Now, where and how should I do the overriding? Excuse my ignorance
> ... but I've never done this and searching for 'Perl
> overload' always gets me to instructions on how to overload
> built-in operators ...
> 
> Thanks in advance,
> 
> Fernan

Redefine is the term in perl-lingua.


In MyApp.pm:

{
  no warnings 'redefine';

  sub merge_session_to_user {
    # your new sub

    # ...

    # To call the previous implementation if you should want it:
    # $self->NEXT::merge_session_to_user(@args);
  }
}

The key thing to remember here is that all Cat plugins 'pollute' the $c
namespace, which isa Myapp.

HTH
Ash

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to