In my
Exporter::VA I planned on allowing a hashref parameter be passed as a parameter to
import, instead of found as a package global. Everyone liked the idea. I even went out of my way to allow it to be
last in the list. See
Module Design strawman - Exporter::VA for the original writeup, or
John M. Dlugosz's scratchpad for the latest.
However, when I tested it, I was told "import parameter is not a string..." which is true enough, but not what I wanted to hear!
It looks like the implicit call to import() from a use will check the parameters in ways that a normal call does not.
Why?
Update: tye points out that it is the implementation of import that's doing it! I'm presuming that this parameter didn't get removed earlier as it should, but the point is I'll have to look some place totally different than I was. And as bbfu found out, having the exporter export itself has a strange way of messing with your mind.
Update2: The problem was in passing the wrong value to the function that was supposed to extract the hashref from the parameter list.
I think it's unnecessary to constrain the implementor of import. After all, it's supposed to be "wide open", so why get in my way?
Can anyone give a good reason why it should do this kind of checking? After all, the function itself can check the parameters, if necessary or to coddle the user.
—John
Edit by tye to fix pad link
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.