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

I'm running on Mac 10.2.8 with Perl 5.6.0

I recently downloaded a CPAN module File-Copy-Recursive-0.05. In the past I have (after making sure it was pure Perl - e.g., no C in it) simply moved it to the correct directory with proper permissions like

"/System/Library/Perl/File/Copy"

after making sure all the required modules were installed. Now I note that I have only done this a few times but, never had a problem.

With the above mentioned module it didn't work; kept saying that it didn't return true (from the script that used it).

Now for the strangeness

In hacking around the module I discovered if I removed the

# comments

it ran perfectly????????

Anyone have a clue.

Replies are listed 'Best First'.
Re: CPAN module strangeness
by brian_d_foy (Abbot) on Apr 05, 2005 at 19:02 UTC

    What happened when you tried to install in properly? Did it pass `make test`?

    Since it is pure Perl, you shouldn't have any problem installing it through the Makefile, and you should do that when you can. I'm curious if you'd see the same odd behaviour after doing that.

    --
    brian d foy <brian@stonehenge.com>
      I used the following while logged into the terminal as root

      perl -MCPAN -e 'install File::Copy::Recursive;'

      I don't remember the exact wording but it said something like

      module package opened - looking good

      starting Makefile.PL

      then there was some type of message saying it couldn't

      it then tried the test with the same results
      Terminal log

      % perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for File::Copy::Recursive [Robert-Computer:/&Download Stuff/&Sat/File-Copy-Recursive-0.05] rober +t% make mkdir blib mkdir blib/lib mkdir blib/lib/File mkdir blib/lib/File/Copy mkdir blib/arch mkdir blib/arch/auto mkdir blib/arch/auto/File mkdir blib/arch/auto/File/Copy mkdir blib/arch/auto/File/Copy/Recursive mkdir blib/lib/auto mkdir blib/lib/auto/File mkdir blib/lib/auto/File/Copy mkdir blib/lib/auto/File/Copy/Recursive mkdir blib/man3 cp Recursive.pm blib/lib/File/Copy/Recursive.pm Manifying blib/man3/File::Copy::Recursive.3 [Robert-Computer:/&Download Stuff/&Sat/File-Copy-Recursive-0.05] rober +t% make test PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib -I/System/Libra +ry/Perl/darwin -I/System/Library/Perl -e 'use Test::Harness qw(&runte +sts $verbose); $verbose=0; runtests @ARGV;' t/*.t t/1.................Can't locate Test/More.pm in @INC (@INC contains: +blib/arch blib/lib /System/Library/Perl/darwin /System/Library/Perl/d +arwin /System/Library/Perl/darwin /System/Library/Perl /System/Librar +y/Perl/darwin /System/Library/Perl/darwin /System/Library/Perl /Libra +ry/Perl/darwin /Library/Perl/darwin /Library/Perl /Library/Perl/darwi +n /Library/Perl /Network/Library/Perl/darwin /Network/Library/Perl /N +etwork/Library/Perl . /System/Library/Perl/darwin /System/Library/Per +l /Library/Perl/darwin /Library/Perl /Library/Perl /Network/Library/P +erl/darwin /Network/Library/Perl /Network/Library/Perl .) at t/1.t li +ne 8.<BR> BEGIN failed--compilation aborted at t/1.t line 8. t/1.................dubious + Test returned status 2 (wstat 512, 0x200) FAILED--1 test script could be run, alas--no output ever seen<BR> make: *** [test_dynamic] Error 2 [Robert-Computer:/&Download Stuff/&Sat/File-Copy-Recursive-0.05] rober +t%

      Edit by BazB: add code tags.

        You don't have Test::More installed because you're using an older version of Perl. Skip the `make test` step when you install modules (or upgrade your perl).

        In the CPAN.pm shell, use a "force install" to let it ignore the test failure.

        Good luck :)

        --
        brian d foy <brian@stonehenge.com>
Re: CPAN module strangeness
by cog (Parson) on Apr 05, 2005 at 17:38 UTC
    I have an idea...

    Copy that file, the altered one, to a different directory. One of yours, just as a backup.

    Now, install the module again, but this time do it properly.

    And finally, compare the original file, the file you changed and the result of the installation.

      Thanks for all the comments. Further clarification:

      The module runs with the POD. The only change I've made is removing the comments on lines 8, 22 and 37. And modified lines 10 - 14 to

      require Exporter;
      use vars qw(@ISA @EXPORT);
      @ISA = qw(Exporter);
      @EXPORT = qw(fcopy rcopy dircopy);

      As far as installing it properly and looking for the difference, can't seem to do it. From what I've read on various sites module installation is iffy with 10.2.x

      Will be gone for a few hours, will check back this evening.

      thanks again.

        I've not had any problems with CPAN under MacOS 10.2, 10.3, or um... any others versions of OS X. (and I've never used 10.0 or 10.1)

        CPAN is your friend. If it throws errors, try posting the error messages, as there's a good chance that people can help out, rather than just skipping it entirely.

        module installation is iffy with 10.2.x

        I'm running 10.3.8, so I don't know about that, but... that seems odd... :-\

Re: CPAN module strangeness
by ikegami (Patriarch) on Apr 05, 2005 at 17:37 UTC

    The last statement of the module must return true for it to load. That's why you'll almost always see 1; at the end of a module. I just checked, and the file does have a 1; at the end. Something got modified or you wouldn't be getting that error.

      To be clear: it's the last evaluated statement that must be true, and that's not necessarily the last statement in the file. :)

      --
      brian d foy <brian@stonehenge.com>
      If 5.6.0 requires the "1;" at the end, the problem might well be that the POD is after that "1;"... I don't know, but if he removes the POD and it starts working... could be that...

        The last statement must evaluate to true, not necessarily the last line.