Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Handy dandy CPAN pollution

by Tommy (Chaplain)
on Dec 26, 2002 at 19:56 UTC ( [id://222398]=note: print w/replies, xml ) Need Help??


in reply to Handy dandy CPAN pollution


>The author introduced a new root namespace: Handy::. This is a big
>mistake.

This isn't permanent. It is being changed, and rightly so. It was never meant to remain under that namespace. The bulk of the code present isn't going to remain in the module. The module isn't needed by File::Util anymore and won't remain among it's prerequisites -I just hadn't handled that yet. Further, the module isn't to remain on the CPAN when File::Util is updated (very soon) so that it doesn't use Handy::Dandy.


>He used OOorNo, which he also wrote himself. A useless module that gives you
>your arguments without the first one if that's a class or object.

Refer to CGI::self_or_default( )
How useful you find this routine is a matter of situational basis and opinion.


>This has nothing to do with object orientation,

That depends. It is named OOorNo is it not? This code is not to remain under it's current namespace either, and the module removed from CPAN.


>it's just some very strange and useless syntactic sugar: you can now use
>Package->function and $object->funtion instead of Package::function. Yay?

use Foo qw( bar baz );

Foo->bar(woot);

I don't think so.


>Documentation
>
>Yeah, good question. Where is it?

There's not much documentation since the module isn't going to stay there more than the few days it would be present to provide needed support for File::Util. I don't want to argue about whether this practice of code provision and retraction is correct. It's not. It won't happen again by me. I appologize.


>I see no reason to be nice to this author.  He polluted CPAN

I'm sorry. I'll clean up my mess.


>and didn't read perlfaqs, didn't read
>http://pause.perl.org/pause/query?ACTION=pause_04about

That's presumptuous.

"When you're done with all your preparations, considerations, and investigations, visit the PAUSE and fill in the form for a new module namespace. Take your time filling in the rationale of the module proposal. Consider, your form will be posted to modules@perl.org too, so other developers will probably stumble over this description many years later. The better the decription, the better the chances that your module will actually be used."
"You need not wait for approval. You can upload anytime, even before you fill in the form. Uploading and registering are only loosely coupled." -taken from http://pause.perl.org/pause/query?ACTION=pause_04about.

I don't know all the "unwritten" rules I guess. I'll keep my ears perked up and my eyes open for these.

Replies are listed 'Best First'.
Re: Re: Handy dandy CPAN pollution
by chromatic (Archbishop) on Dec 26, 2002 at 21:30 UTC
    I don't know all the "unwritten" rules I guess.

    Several are actually in the PAUSE documentation you quoted:

    • Consult other people about your module before you upload.
    • Avoid cutesy names.
    • Add to existing modules instead of writing your own.
    • Check $VERSION.

    As well, it's always handy to read perlmodlib.

Re: Re: Handy dandy CPAN pollution
by demerphq (Chancellor) on Dec 27, 2002 at 00:31 UTC
    Hi TOMMY rough day eh? ;-)

    Personally I think Juerd is pretty on the ball with his comments. He expressed them in a pretty hard way but... *shrug* (btw, ive been on the receiving end of his comments before. youll survive ;-)

    Im mostly writing about this OOorNo module. Id like to see you explain what your intentions are with this module. Ive reviewed the implementation, and CGI->self_or_default() that you mention but I still dont grok the purpose of this module, and I in fact think that its broken and dangerous. (A feeling that is compounded as I dont understand its intended use as the documentation is skimpy to say the least.)

    It seems to be intended to be used for subs that are either called as methods or as subs. Problem is that the approach is particularly crude. Notice that the routines for this purpose in CGI bend over backwards to make sure the first argument is the right type before it overlooks it. Your code makes no such effort. If the first argument is an object, _irrelevent_ of its type, then it is ignored. So for instance if I used OOorNo as the basis for a CGI style tag generation routines i would have problems if I used blessed hashes for the tag attributes.

    Some other holes are things like:

    return(undef) unless ($mamma && ref($mamma) eq 'ARRAY');
    This is _horrible_. If I provide a blessed array your code breaks.

    To me both of these modules remind me of some of my own earliest Perl efforts. The thing is that most of it can be done by using other modules in better and more robust ways. I know the temptation of writing your own utility modules. You know exactly what and why the routines do everything that they do. And for your own limited use then that may be ok. But for public use you need to make sure your code is much more robust and much better documented.

    Persoanlly i think you would make far better use of your time by reading the modules on CPAN, and not writing modules to go up there. After all, most of the code in these two modules is either in a perlfaq in a more robust form or in a module in a more robust form, or not done at all for very good reasons. (Personally I think that Lincoln Stein, as wonderful as he is should _never_ have written self_or_default or self_or_CGI. The code in these two routines _barely_ works, and should not be copied. For instance what happens if I pass an object of type CGIOPTIONS as the first arg to a sub that uses this routine? OVID one time wrote an analysis of all the rules that Lincoln broke in CGI. Suffice it to say that generally speaking this module is not one to copy.

    Good luck, hang out read the many many nodes about the things that you are obviously interested in, bounce ideas off the monks, and refrain from CPAN'ing until you have a crowd of people here saying "I wanna get me some o dat!"

    :-)

    --- demerphq
    my friends call me, usually because I'm late....

      "This is _horrible_. If I provide a blessed array your code breaks."

      Thanks, I can't believe I didn't see that. I should have used
      UNIVERSAL::isa( )
      It's strange that I posted something to CPLM a little while back that talked about this. Merlyn chimed in too, explaining why using this technique rather than using CORE::ref( ) was the scalable, portable, correct WTDI. (tmtowtdi).

      I've poured over CGI myself. Basically, that module is a horrible mess. That's ok for someone who wants to use it, as it's not only one of the few messes that work, but one of the even fewer than work well in practice. It's very robust at what it's supposed to do, ie providing all the information a CGI script needs about its surroundings. But internally it's such a thorough mudball that I'm trying to switch to CGI::Simple wherever I have the opportunity (especially as I never use the HTML generator functions of CGI.pm). Ideally, it would get as much use as CGI and we could just as (more, even) confidently recommend it to people who write CGI scripts than we do for CGI today.

      Makeshifts last the longest.

      demerphq said,

      Personally I think that Lincoln Stein, as wonderful as he is should _never_ have written self_or_default or self_or_CGI. The code in these two routines _barely_ works, and should not be copied.

      My personal opinion of CGI.pm is that it is great! I couldn't care less if Lincoln made things harder for people to inherit from his module, because it offers a good deal of original ideas. I like the idea of allowing both OO and non-OO, especially when updating a module to a more object orriented architecture. You then allow for an object which can hold its own options, or an a module global variable, which must be parsed before another one. It allows me to do this:
      # Set variables for the next group of operations. MyMod->opt(1 => 1, 2 => 1); for ( 1..10 ) { MyMod->set( $_ ); MyMod->do_op(); }
      or set options for each object if the object require differant options. Just document the inflexibility of the code, and that people shouldn't try to emulate the code unless they know what they're doing and I think it's pretty fair.
        . I like the idea of allowing both OO and non-OO,

        So do I. The problem is that at a pedantic level the implementation is broken. CGI's more so than OOorNo, but.....

        Just document the inflexibility of the code,

        Neither CGI or OOorNo document the weaknesses of their approach. Reading the source is required to figure out what is wrong, and frankly in both cases Id guess that a fair amount of experience is required to spot the weaknesses.

        IMO part of a computer programmers job is to think about how things can be broken. CGI makes attempts in that direction OOorNo does not. Neither are satisfactory on an abstract level.

        --- demerphq
        my friends call me, usually because I'm late....

        A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://222398]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-16 04:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found