Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Reinvent a broken wheel?

by nysus (Parson)
on Jul 07, 2003 at 18:03 UTC ( [id://272046]=perlquestion: print w/replies, xml ) Need Help??

nysus has asked for the wisdom of the Perl Monks concerning the following question:

I'm in the middle of writing a module to replace a CPAN module that I consider to be poorly written. But I've never written a module for CPAN before and I'm wondering if it's worth my time to submit this one if there is a similar module out there.

That's the gist of my question. If you want to hear the gory details...

I was on CPAN yesterday looking for a tool to download images from a website and came across HTTP-GetImages. It purportedly does what I want, except it doesn't. It appears to be broken. For instance, the author wrote his own malfunctioning hack to generate absolute file paths instead of using URI.pm. It doesn't handle search links contained in javascript pop-up boxes. And it seems to me to needlessly use anonymous arrays and hashes, adding to the comlexity of maintaing and debugging the code.

I spent about an hour looking through above module's code and finally decided that instead of trying to fix the module, it would be more fun and give me badly needed practice writing my own module from scratch. So far, so good, I'm about halfway done with my release.

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff";
$nysus = $PM . $MCF;
Click here if you love Perl Monks

Replies are listed 'Best First'.
Re: Reinvent a broken wheel?
by Abigail-II (Bishop) on Jul 07, 2003 at 21:00 UTC
    There's nothing wrong with putting a module on CPAN that has the same functionality as an existing module. It's not that the first person to put something on CPAN is somekind of super-coder whose code can't be improved. Anyone can upload something on CPAN, and there isn't any code review. Too often people give the impression that if it's on CPAN, it has to be good code. This is not true - there's good code on CPAN, but there's also a lot of bad code. Code that's broken, inefficient, platform or environment specific, or which has a lousy API.

    If there's a piece of code on CPAN that doesn't do what you want, or which you consider not up to your standards, by all means, rewrite it and upload it on CPAN. In the worst case, all it does it take some diskspace on some CPAN mirrors. But others might agree with you and prefer your implementation over what's already there, and your contribution will enrich CPAN.

    Go for it.

    Abigail

      Interesting insight. Are there no gatekeepers to the CPAN respository, then? Do modules get at least a cursory glance?

      Sounds like CPAN needs some kind of peer rating system so it's easier to find the quality code.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

        Are there no gatekeepers to the CPAN respository, then?

        About the only restriction is that the code cannot have a license that doesn't allow the code to be freely distributable.

        Do modules get at least a cursory glance?

        No. There's no dresscode at the door. And all minorities are welcome.

        Sounds like CPAN needs some kind of peer rating system so it's easier to find the quality code.
        No, I don't think it does, and luckely, those in charge don't think so either. I think it will be the death of CPAN if there was some kind of organization that decided which code was CPAN-worthy and which wouldn't.

        There's no CPAN cabal.

        Abigail

        There are smoke testers, but that's about it. Do a search here and you'll see the concept of a ratings system for CPAN has come up often, as it likely has in other venues.

        --
        I'm not belgian but I play one on TV.

Re: Reinvent a broken wheel?
by chromatic (Archbishop) on Jul 07, 2003 at 18:10 UTC

    Maybe it's more fun, but I think it might be better real-world experience to fix code that sorta works. I'd personally rather there be one good module on the CPAN than several halfway-working modules.

    That's just me, though, so do what you think best. Please write lots of tests, though, so at least your module is more maintainable.

      Hmmm, it just occured to me that maybe I could go down both paths. First I'll finish my module from scratch for my own good. Then I could approach the fellows who wrote the original and I'll have something to show them.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

Re: Reinvent a broken wheel?
by tadman (Prior) on Jul 07, 2003 at 18:09 UTC
    I'd love to have something that was as good as GNU wget which is just unbelievably good at doing that sort of thing, with the only down-side being that it's a shell tool and not a Perl module. It has a lot of functionality that can be engaged with just a command-line switch, something that you'd have to write for yourself in Perl using most of the modules I'm familiar with.

    If all you need to do is download images, that's the program to use. It might even be advantageous to make Perl generate the list for it to download, and then let it take care of the gory details.

      libnet comes with a program called GET that is like a mini wget in pure perl. Its installed automatically in your /perl/bin directory. Not sure if you have to install libnet explicitly or if it comes with the standard build tho.


      ---
      demerphq

      <Elian> And I do take a kind of perverse pleasure in having an OO assembly language...
Re: Reinvent a broken wheel?
by flounder99 (Friar) on Jul 07, 2003 at 18:20 UTC
    Have you tried contacting the author? Most will gladly accept patches (as long as they work) Even if the patch is a complete rewrite. (again as long as it works better)

    --

    flounder

      Yeah, I thought about it, but honestly I really haven't written enough Perl programs to be the guy's peer. I'm borderline newbie/intermediate in my programming skills.

      That's why I was I thinking about approaching him/them after I come up with my solution.

      Thanks.

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

        Approach now. I did that with PDF::Template and discovered that he had a lot of good ideas on top of mine. He was also extremely happy to hand over maintainership to someone more excited about continuing on the work. Hey, you never know! :-)

        ------
        We are the carpenters and bricklayers of the Information Age.

        Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

        Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

Re: Reinvent a broken wheel?
by Albannach (Monsignor) on Jul 07, 2003 at 21:17 UTC
    If you do decide to build another module, I'd like you to consider a section in your documentation that compares your efforts to those that already exist. This will assist those seeking code in their decisions. Of course you don't want to cast aspersions on other authors, but something to tell the rest of us *why* you did this would be appreciated by me at least.

    --
    I'd like to be able to assign to an luser

Re: Reinvent a broken wheel?
by kral (Monk) on Jul 08, 2003 at 07:03 UTC
    I suggest to go forward with your project.
    It can be better or worse module than the CPAN's one, but in each case you learn something.
    And I think this is the most important thing.
    ----------
    kral
    (sorry for my english)
Re: Reinvent a broken wheel?
by giulienk (Curate) on Jul 08, 2003 at 13:31 UTC
Re: Reinvent a broken wheel?
by David Caughell (Monk) on Jul 08, 2003 at 18:48 UTC

    I think that this forum is probably the last place that someone would want to call a CPAN module poorly written or malfunctioning!

    (especially before you contact the author)

    Dave.

      Why? All I'm saying is that, in my opinion, his code doesn't appear to work well and is unnecessarily complicated. I mean, I don't have to contact George Lucas before I publish the fact that I think his last Star Wars movie sucked, do I?

      $PM = "Perl Monk's";
      $MCF = "Most Clueless Friar Abbot Bishop Pontiff";
      $nysus = $PM . $MCF;
      Click here if you love Perl Monks

        You referred to yourself as a "borderline newbie/intermediate." Are you really sure the code he wrote was of low quality or did he just use certain constructs and idioms that you're just not familiar or comfortable with yet?

        Either way, I as well would encourage you to go ahead and write your module, if for nothing other than the learning experience.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://272046]
Approved by hardburn
Front-paged by hsmyers
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-19 08:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found