in reply to Re: Re: Re: Re: (bbfu) (Exporter::VA) Re: Exporter::Dream
in thread Exporter::Dream

Versioning was the main incentive for creating it. I wanted to be able to get rid of default exports in a new version of a module, while still having backward compatibility.

The ability to do this pretty much implies aliasing. Pragmas started out as a minor footnote feature but grew with feedback that there is a larger interest in that (and it's one reason why people write their own import()).

As for setting the default version equal to the current version, you don't "need" to do anything. If you don't declare any versioned exports, the whole concept is moot. In any case, the default version is optional and will take the current version if you don't declare it. So you can pretty much ignore features you don't need at the moment.

If you want an exporter whose main purpose is to be small and light, I think such a design would get rid of as many features as possible. Looking at your code, I see that requiring the function names to have no sigil (rather than making it optional) simplifies the code. Keeping that note, why have non-functions supported, when by far the most common thing to export is functions. Look at what the short version code in Exporter does. Several modules define their own importer that are similar to Exporter but different. I've not looked at Exporter::Lite.

Why isn't Exporter::VA on CPAN yet? I don't know. The powers that be seem to be slow and/or not very clear. It's in my directory, just not indexed.

—John

  • Comment on Re: Re: Re: Re: Re: (bbfu) (Exporter::VA) Re: Exporter::Dream

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: (bbfu) (Exporter::VA) Re: Exporter::Dream
by Juerd (Abbot) on Jan 06, 2003 at 18:37 UTC

    Looking at your code, I see that requiring the function names to have no sigil (rather than making it optional) simplifies the code.

    It saved me a couple of lines, and a lot of logic, indeed. Since I'm against using sigils on subs, I decided to simply not support them. (Note that of course, when you are referencing a sub, using a sigil is more or less needed (you don't want to type *subname{CODE} all the time :P)). I don't care much about how many lines my code has. But as logic is added, maintainability decreases.

    Keeping that note, why have non-functions supported, when by far the most common thing to export is functions.

    I quite like for example how LWP::Simple can export $ua. It makes life pleasant. And I can implement it using a few regexes and a hash - no real logic is needed, so I just did. LWP::Simple gave me most inspiration for this module. I usually have it export get and $ua, but I also often use a get and an $ua myself (yes, I do mix LWP::Simple with full blown LWP::UserAgent stuff). It's how I thought of the prefix. It's a shame we use exporters instead of importers, really.

    Why isn't Exporter::VA on CPAN yet? I don't know. The powers that be seem to be slow and/or not very clear. It's in my directory, just not indexed.

    That's probably because you used a zipfile. Try distributing the module as a gzipped tarball instead. If you use FTP, make sure you upload using binary transfer, not ascii.

    I no longer believe in module registration. I registered all of my modules, and none is in the (still manually maintained) module list. Did not get any response at all. Doesn't matter much, since everyone uses search.cpan.org and/or CPAN.pm or CPANPLUS anyway, and modules get added to that index automatically.

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

      So, the index we see in search.cpan.org is not the same "approved only" list that the namespace registration talks about? And you think that this index doesn't like ZIP files, even though PAUSE and the other infrastructure does?

      Thanks for the tip.

      —John

        So, the index we see in search.cpan.org is not the same "approved only" list that the namespace registration talks about? And you think that this index doesn't like ZIP files, even though PAUSE and the other infrastructure does?

        search.cpan.org and the generated module list (used by installers like CPAN and CPANPLUS) have indeed nothing to do with namespace registration. I'm not sure if PAUSE supports zipfiles for distributing modules. I think it does not (you can upload other files, but not all are processed). Maybe PAUSE doesn't support your non-standard installation method, or perhaps you uploaded it using FTP ASCII transfer. I think you'll have to try. Use the log tail to see if your file is processed.

        - Yes, I reinvent wheels.
        - Spam: Visit eurotraQ.