I think we need to start cleaning up the namespaces we use for our Tie:: modules. I use Tie::What::How, since it lends itself to self-documentation and at least hints at how it might inherit if it needs to. Specifically, Tie::RandomInteger should probably be renamed to something like Tie::Scalar::RandInt or at least Tie::Integer::Random. I bring this up because I see so many convoluted module names for tie().

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Tie-dy up our namespaces
by davorg (Chancellor) on Dec 31, 2001 at 14:33 UTC

    I agree completely. I've always used the naming convention that japhy recommends for my tied objects. I always thought it was the standard - until I found huge numbers of tied modules with (seemingly) random names. It always takes me ages to find IO::Scalar because I assume it's going to be called something like Tie::Filehandle::Scalar or something like that.

    --
    <http://www.dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

      . It always takes me ages to find IO::Scalar because I assume it's going to be called something like Tie::Filehandle::Scalar or something like that.

      Just remember that IO::Scalar->new returns a blessed glob reference, so it can be used just like an IO::Handle object or one of the other IO::* module objects. In fact, I don't think there's any reason to use the tied interface to IO::Scalar anymore... :-)

      Though I have heard somewhere that putting a tied interface in the same module as an object interface can cause some problems, can anyone confirm or deny this??

Re: Tie-dy up our namespaces
by Juerd (Abbot) on Jan 02, 2002 at 14:44 UTC
    You're absolutely right. I renamed Tie::RandomInteger to Tie::Scalar::RandomInteger. But I don't see why RandomInteger should be shortened (RandInt).

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

      I don't see any real information being lost in the shortening of "RandomInteger" to "RandInt", just as I've never seen confusion over "substr" instead of "substring", or "rindex" instead of "reverseindex".

      _____________________________________________________
      Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

        The main confusion that I have seen is that sometimes people will assume the word has been shortened one way when it was in fact shortened in another.

        This can be a pain. More of a pain than typing it all out every time? Dunno. But my habit is to shorten, so I do it anyways.

        Perhaps some time I will make an experiment of being verbose for a while and decide if I like the results of that better.