Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

MacPerl lies -

by amelinda (Friar)
on Nov 20, 2001 at 05:51 UTC ( #126448=perlquestion: print w/replies, xml ) Need Help??

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

So, this is with the evil MacPerl. This is some legacy code, using a legacy module, and "nobody changed anything." The idea is that the users, on their OS 9 desktops, mount a CD and drag it onto this icon, and it does some stuff. Suddenly, it has started failing with the following error:
#Foo/ did not return a true value File 'executable/perl/file'; Line 1 # BEGIN failed - compilation aborted File 'executable/perl/file'; Line 1 ... propagated File 'executable/perl/file'; Line 2

I am at a loss. I've never touched MacPerl before. Any ideas or wisdom?

FWIW, here is part of the now-non-working code (junk.plx):
use Foo::Foo qw(declare_text); use File::WalkTree; use strict; require ''; # ... do some stuff exit; __END__

And here is part of Foo::Foo:

package Foo:Foo; use strict; # ... a buncha stuff here sub declare_text { # noop if this isn't under MacPerl if($MacPerl::Version) { foreach my $item (@_) { &MacPerl::SetFileInfo('R*ch', 'TEXT', $item); } } return; } #... more stuff 1; __END__

I'm kind of concerned about the lack of a shebang in the .plx file, but that could just be a MacPerl weirdness.

Replies are listed 'Best First'.
Re: MacPerl lies -
by chipmunk (Parson) on Nov 20, 2001 at 09:36 UTC
    Your module file has Unix newlines (line feed) rather than Macintosh newlines (carriage return). This causes Perl to see the entire file as a single line, most of which is probably a really long comment.

    If you transferred the file from a Unix machine via FTP, you will want to make sure to use text mode.

    On your Mac, you can fix the newlines with BBEdit, or create a MacPerl droplet like the following to translate the newlines:

    #!perl -pi tr/\r/\n/;
    (Remember that in MacPerl, \r and \n are reversed, so that \n still corresponds to the local newline character.)
      <insert vociferous cursing here>

      Yes. Actually they were just fine until I changed the newlines in vi (this runs on a server that's OS X, but the clients are OS 9) so that I could actually read the files. I changed them back (in both that module and in the .plx), and now they are happy again.

      :sigh: The more I have to deal with them, the more annoyed I am by these Macs.

        I think you should mean "the more you don't know what you are doing, the more you are annoyed with yourself."

        Read man perlport. It contains all you need to know about writing portable perl, including information on newlines.

        And yes, I am being unnecessarily harsh, but only because I am bored. Don't take it personally.

Re: MacPerl lies -
by belg4mit (Prior) on Nov 20, 2001 at 09:07 UTC
    Well this much I can tell you the absence of #! is not a problem with MacPerl, though without it you can't be using -w. Though you seem to have enough errors on your hands as it is ;-).

    perl -p -e "s/(?:\w);([st])/'\$1/mg"

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2020-10-31 03:51 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (286 votes). Check out past polls.