in reply to Can't locate Email/MIME.pm in @INC

As Ken points out Email::Mime is not included with the standard version of Perl and I too would advise using perlbrew to set up your own environment. However if you just want to try out sending an email you could use either Mail::Mailer or Net::SMTP which should already be installed - just put use Mail::Mailer; or use Net::SMTP; at the top of your script and then run it to find out - if you don't get an error then you have them available.

Replies are listed 'Best First'.
Re^2: Can't locate Email/MIME.pm in @INC
by netperl (Initiate) on Mar 21, 2014 at 22:05 UTC
    installed perl5 using perlbrew and installed Email using clan as Ken had advised..still getting the same error about @INC I also tried use Mail::Mailer and use Net::SMTP at the top, no dice... How do I make sure where is the version of perl what I just installed? I mean does it put it in a sep. env. automatically?
      I also tried use Mail::Mailer and use Net::SMTP at the top, no dice
      In what way did it fail - can you show the script you used and the error.

      To find the perlbrew perl open up Terminal and type in:

      echo $PERLBREW_PATH Sample output: /Users/user/perl5/perlbrew/bin:/Users/user/perl5/perlbrew/perls/perl-5 +.14.1/bin
      There may be another way to do this but using that output you would have the first line of your script:
      #!/Users/user/perl5/perlbrew/perls/perl-5.14.1/bin/perl5.14.1
        "#!/Users/user/perl5/perlbrew/perls/perl-5.14.1/bin/perl5.14.1"

        That shebang line locks the script into using a single version of Perl. While that might be what you want in some circumstances, I don't think that would be the norm.

        This shebang line (which I indicated in "Re^3: Can't locate Email/MIME.pm in @INC" below) allows you to upgrade Perl and use it with all your scripts without having to edit every one of those scripts.

        #!/usr/bin/env perl

        It also makes it easy to test your current codebase with new versions of Perl: a single "perlbrew switch new-perl-version" to check for backward-compatibility and a single "perlbrew switch old-perl-version" to rollback (if that's required).

        -- Ken

      "installed perl5 using perlbrew and installed Email using clan as Ken had advised."

      Did you use the "perlbrew switch ..." command shown in the App::perlbrew documentation I linked to in my earlier reply?

      You'll see "perl -v" after most of those "perlbrew switch ..." commands: this will tell you the current version of Perl that you're using. As I mentioned earlier, "Apple includes its own customised version of Perl": the "perl -v" output will probably indicate the version has been patched if you're still using the System Perl. Here's what I get when running that for the current version (i.e. perl) and the System Perl (i.e. /usr/bin/perl):

      $ perl -v This is perl 5, version 18, subversion 1 (v5.18.1) built for darwin-th +read-multi-2level ...
      $ /usr/bin/perl -v This is perl 5, version 12, subversion 3 (v5.12.3) built for darwin-th +read-multi-2level (with 2 registered patches, see perl -V for more detail) ...
      "still getting the same error about @INC"

      The "/Library/Perl/..." and "/System/Library/Perl/..." paths in @INC indicate the System Perl. If you are getting the same output, then you're still using the System Perl.

      However, while that could indicate you haven't done "perlbrew switch ..." yet (or correctly), it's probably more likely to be related to your shebang line. [If you're still having problems (after all of this), advise us exactly how you're running your script: that may pinpoint the problem (if it still exists).]

      I use the following shebang line for all of my Perl scripts:

      #!/usr/bin/env perl

      You can add options after that if you want (see perlrun). A common one you'll see in my posts is:

      #!/usr/bin/env perl -l
      "How do I make sure where is the version of perl what I just installed?"

      "which perl" (from the command line) will tell you this. If it reports /usr/bin/perl, you're still using the System Perl: refer back to my earlier comments about "perlbrew switch ...".

      -- Ken

        Update: Tried notest install and force install - but the result is the same. Failure in installing perl. Back to the drawing board once again!