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

Re: Image.pm not found

by chrstphrchvz (Scribe)
on Jun 26, 2019 at 05:56 UTC ( #11101906=note: print w/replies, xml ) Need Help??


in reply to Image.pm not found

"not found: No such file or directory at /opt/local/lib/perl5/site_perl/5.26/darwin-thread-multi-2level/GD/Image.pm line 64."

I'm guessing you're using MacPorts (which is how I usually use Perl on macOS); /opt/local is the default MacPorts prefix, and /perl5/site_perl is where cpan/cpanm (from MacPorts) would try installing modules. Have you tried installing GD from MacPorts (i.e. not through cpan/cpanm)?

sudo port install p5.26-gd

Edit: You first mention Perl 5.28 (on the newer MacBook), but this error has 5.26; so maybe what you're after is installing p5.28-gd instead.

Some things to be mindful of with MacPorts are that it offers multiple versions of Perl, which can be installed simultaneously. (5.26 and 5.28 are the ones currently with installable modules.) Since each Perl version installed by MacPorts is independent, so are any modules that are installed for each version.

Although MacPorts' Perl can be invoked using a perl command if the perl5 port is installed, it may be safer to specify which version of Perl to use using a versioned command, e.g. perl5.28. Some utilities currently don't have unversioned commands, e.g. cpanm must be specified as cpanm-5.28.

Edit 2: Rather than jumping straight into MacPorts details, I should probably instead advocate taking a step back to decide how you're going to use Perl on these Macs: whether to use a general-purpose package manager (Homebrew, MacPorts, Fink), a Perl-specific distribution (Perlbrew, ActivePerl, etc.), or going with macOS' included system Perl. I don't think it is a good choice to get comfortable with macOS' included Perl; it's virtually unsupported compared to the alternatives, and it will not be present in some future macOS version (the upcoming version of macOS, 10.15 "Catalina", claims to include Perl and other scripting languages only for compatibility), so you may eventually have to find an alternative anyways. Each choice for obtaining Perl has different audiences/purposes/goals/etc., and I have no idea which one the Perl community is most familiar with or willing to help others navigate. But I'm inclined to guess that either Homebrew or Perlbrew is the most popular choice.

Replies are listed 'Best First'.
Re^2: Image.pm not found
by linus8989 (Novice) on Jun 26, 2019 at 07:56 UTC

    Good question. I might have tried them all after encountering multiple errors throughout the process. That probably also explained that I can see so many perl versions and I can see multiple Image.pm file on the working mac. But the macbook that is NOT working will not find the Image.pm file when I am doing the search. Which is why I am suspecting that I have not completely installed the GD module. I will study all the suggestions above and install the GD module properly. I am actually a user and not a perl coder, but I have been coding using other programming languages. I thought installing GD is a simple step. Obviously I am wrong.

    FYI, I did use Homebrew, and sudo cpan GD command, and I also installed the cpanminus, etc. I have never used the Perlbrew. Should I use it? Thank you.

      I have never used the Perlbrew. Should I use it?

      It depends; I would want others to chime in on this. I tried Perlbrew recently; it's a lot closer to downloading and compiling Perl from scratch, so it seems intended for the serious or experienced Perl user that likes to have more control over their Perl than afforded by a turnkey distribution or package manager. So I have the impression of it being overkill for end-users, but that being said, it might still be more beginner friendly than I realize, for example if there's good resources out there for guiding beginners. One advantage it would have is consistency across OSes.

      For end-users (i.e. non-programmers) or beginners, I think a more turnkey Perl distribution may be preferable, for example ActivePerl. However, if you're tech-savvy enough to be comfortable with using OS package managers like Homebrew, then that option may work fine: just look into how it organizes pre-packaged Perl modules, and how using tools like cpanm to get any modules that aren't prepackaged will work alongside the prepackaged ones. Maybe ask the package manager's community directly instead for installation advice, since many others in the Perl community won't be experts on it.

        I just tried to install the macport again and use "sudo port install 5.26-gd" and no error message upon completion of the installation. However, the same error message "...Image.pm" not found when I ran the perl script. I can find the PD folder and PD.pm Image.pm on the working imac, but not on the macbook. Again, I suspected that the GD is not properly installed. Hahaha... I tried this for 3 days now, and including past multiple attempts in the past couple of years. This was a great perl script written for me and I hate to give it up. Again, thank you for your help.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11101906]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2022-09-25 17:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?