Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Business::ISSN - where is is_valid_checksum

by CaMelRyder (Pilgrim)
on Aug 04, 2008 at 15:31 UTC ( #702089=perlquestion: print w/ replies, xml ) Need Help??
CaMelRyder has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've been trying to use Business::ISSN to recognize issns. The problem is that this module doesn't do what it's man page says. Here is an except from the man page :

#EXPORTABLE FUNCTIONS use Business::ISSN qw( is_valid_checksum ); #verify the checksum if( is_valid_checksum(’01234567’) ) { ... }
You can clearly see that is exports is_valid_checksum. However, when I try to use this module like this:

use Business::ISSN qw(is_valid_checksum); my $issn = '0742-4477'; print "Valid = " . is_valid_checksum($issn);
It bombs out with this:

"is_valid_checksum" is not exported by the Business::ISSN module Can't continue after import errors at test.pl line 1 BEGIN failed--compilation aborted at test.pl line 1.

Any ideas as to why I can't import this function? Just so you know, the object-oriented way of using this module doesn't work either. Same jazz with finding 'new'. Has anybody seen anything like this before, or is it just a documentation error?

¥peace from CaMelRyder¥

Comment on Business::ISSN - where is is_valid_checksum
Select or Download Code
Re: Business::ISSN - where is is_valid_checksum
by pc88mxer (Vicar) on Aug 04, 2008 at 15:38 UTC
    There is a bug in the code:
    @EXPORT_OK = qw(is_valid_cheksum); ^^^^^^^
Re: Business::ISSN - where is is_valid_checksum
by toolic (Chancellor) on Aug 04, 2008 at 16:21 UTC
    I find pc88mxer's astute discovery astonishing.

    Navigating to CPAN and searching for Business::ISSN reveals that this module was uploaded nearly 10 years ago. However, there are no bugs reported against it. Well, perhaps no one (other than the author) has ever tried to use the module. This is reasonable since a person has to have the need for such a thing, then the person has to search and find it.

    But, how on earth has it passed the rigors of CPAN testing? It has 46 passes and no fails on a variety of Perl versions and platforms.

    So, I downloaded and installed this module myself. Sure enough, it passes its tests and installs cleanly. Curious.

    Hmm, let me take a look at what is checked. The one and only exportable function is not checked!

    CaMelRyder, please report this as a bug on CPAN. Perhaps someone came before you and did not take the time to do so.

    Morals of this story:

    • Testing, testing, testing.
    • Scrutinize the source code.
    • Be a good citizen and report bugs.
      Okay, sending a bug report with perlbug. Thanks for the impeccible response time!!!
      ¥peace from CaMelRyder¥
Re: Business::ISSN - where is is_valid_checksum
by brian_d_foy (Abbot) on Aug 06, 2008 at 11:39 UTC

    I've taken over the module (with Sami's permission), fixed the bug, and uploaded Business-ISSN-0.91.

    The code is fully tested now, but if you find any more problems, please post them to RT as you did with this report.

    Curiously, the ISSN code was derived from Business::ISBN, the second module I ever wrote. Looking at the code was going back in the time to see many of the worst practices I used to have, so updating the module gave me a chance to undo all of that and make amends. :)

    Good luck :)

    --
    brian d foy <brian@stonehenge.com>
    Subscribe to The Perl Review
      It is collaboration efforts like this that make Perl, in general, and PerlMonks, in particular, a great community.
      • pc88mxer for diagnosing the problem and providing a specific bug fix,
      • CaMelRyder for submitting the bug report,
      • and brian_d_foy for assuming ownership of the module, implementing the bug fix, creating the test to check the bug fix, creating more tests to check other things, and finally uploading the new version to CPAN.
      No one was under any obligation to do any of this. That's what's so cool about it.

      ++'s all around.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://702089]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (9)
As of 2014-09-17 18:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (94 votes), past polls