Bug in version.pl

jonasbn on 2004-10-23T07:21:05

My little script which is shipped with Module::Info::File, the subclass of Module::Info seems to have a bug, it gives the following error: "Can't call method "version" on unblessed reference at ./version.pl line 64".

I have not located the bug myself but I received a mail from another danish guy who got an error running it with the CGI module on a Linux box running perl 5.8.5 (perl, v5.8.5 built for i686-linux-thread-multi).

I have mailed back and forth with the guy in order to obtain some data to resolve the bug. Since the problem is not as simple a programming mistake from my side (unfortunately).

The problem is that the class Module::Info::File is a subclass of Module::Info, which is not my module and when calling the version.pl script with a module name (also the last resort), I use the method new_from_module from Module::Info.

So I have obtained the following data from the bug reporter:

  • version.pl is version 0.04, which is the latest shipped with
  • Module::Info::File, which is version 0.07
  • Module::Info, version 0.26 (which is latest version)
I also mailed him a version, with an enable debug flag and got the following result:
$VAR1 = {
         'name' => 'CGI',
         'dir' => '/usr/local/perl-5.8.5/lib/5.8.5'
       };
Which also eliminates the problem if he had been using the script in an unforseen way (though the script can handle several types of arguments).

I also got the following:
$VAR1 = bless( {
                'version' => '1.07',
                'name' => 'File::Find',
                'file' => '/usr/local/perl-5.8.5/lib/5.8.5/File/Find.pm',
                'dir' => '/usr/local/perl-5.8.5/lib/5.8.5'
              }, 'Module::Info::File' );
File::Find located in /usr/local/perl-5.8.5/lib/5.8.5 is version: 1.07
This shows that the script is actually working. So I asked a fellow Perl Monger to test this script, since he was running perl 5.8.5, on FreeBSD though, but he could not replicate the problem and he got perfect data for CGI.

I have now mailed the bug reporter and asked him to test with other short module names like: DBI or DateTime, it is going to be interesting to see what shows up.

I am also working on a test to demonstrate the problem.

Suggestions for other attempts are more then welcome.