in reply to Re: Irony of import
in thread Irony of import

Except that if you want to customize the export, you don't use Exporter and write an "import" function instead. I grok it, but that's because I'm used to it -- it just struck me suddenly as kind of funny.

If designing from first principles, I'd be more inclined to have the builtin "importing" function (aka use) call a module's "export" function. That way, the function name is a command. "When I want to import, I tell it to export."

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Replies are listed 'Best First'.
Re^3: Irony of import
by adrianh (Chancellor) on Aug 29, 2005 at 13:50 UTC
    If designing from first principles, I'd be more inclined to have the builtin "importing" function (aka use) call a module's "export" function. That way, the function name is a command. "When I want to import, I tell it to export."

    And then you'll have somebody come along and ask "why when I add stuff to my symbol table do I call export - surely I'm importing stuff?" :-)

    You can argue it either way.