in reply to Re: Changing a method call in a CPAN module
in thread Changing a method call in a CPAN module

Hmmm ... can you do that in this case? Data::FormValidator::Constraints::Upload *requires* File::MMagic within the valid_file_format method -- so there's nothing in the symbol table you can manipulate beforehand.

In this particular case, I think a subclass is the way to go - derive from Data::FormValidator::Constraints::Upload and just override the valid_file_format method.

-derby
  • Comment on Re^2: Changing a method call in a CPAN module

Replies are listed 'Best First'.
Re^3: Changing a method call in a CPAN module
by Corion (Patriarch) on May 10, 2007 at 12:31 UTC

    Just require it before D:FV:C:U requires it:

    require File::MMagic; local *File::MMagic::new = sub { # ... };