Front page | perl.module-authors |
Postings from June 2008
Exporter::Safe?
Thread Next
From:
Ovid
Date:
June 20, 2008 05:45
Subject:
Exporter::Safe?
Message ID:
7784.54926.qm@web65708.mail.ac4.yahoo.com
Buried deep within some code, someone used a module (Test::Most 0.03)
which exports a 'set' function. They weren't actually using that
module. It was just leftover cruft. Unfortunately, the parent class
of that module inherited from Class::Accessor.
Test::Most exports 'set' and Class::Accessor calls a 'set' method.
Oops.
I'm trying to think of the best way to deal with this. My first
thought is to create a drop in replacement for Exporter which will not
export a function if caller->can($function) *unless* the person
explicitly lists it in the import list with a unary plus:
use Test::Most plan => 3, '+set';
Are there better strategies?
Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog - http://use.perl.org/~Ovid/journal/
Thread Next