I'm creating commands that I can execute by voice for my Mac. In order to do this, I want to create AppleScripts that call my perl script. For example, here's an AppleScript that will call a Perl script which moves files off the Desktop and into Documents folder:

do shell script "/Users/stevied/bin/clean_desktop.pl"

The Perl script works fine when run from the command line, but when executing the script from my AppleScript, the modules I use aren't found and I get this error:

Can't locate Modern/Perl.pm in @INC (you may need to install the Moder +n::Perl module) (@INC contains: /Library/Perl/5.18/darwin-thread-mult +i-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread- +multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 +/System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/ +Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level + /System/Library/Perl/Extras/5.18 .) at /Users/stevied/bin/clean_desk +top.pl line 3. BEGIN failed--compilation aborted at /Users/stevied/bi +n/clean_desktop.pl line 3.

I have perlbrew installed. The current shebang line for the perl script is #! /usr/bin/env perl. I tried adding the following line to my perl script:

/Users/stevied/perl5/lib/perl5;

Running the AppleScript now yields this horrific looking error:

dyld: lazy symbol binding failed: Symbol not found: _Perl_xs_handshake Referenced from: /Users/stevied/perl5/lib/perl5/darwin-thread-multi- +2level/auto/Mac/SystemDirectory/SystemDirectory.bundle Expected in: flat namespace dyld: Symbol not found: _Perl_xs_handshake Referenced from: /Users/stevied/perl5/lib/perl5/darwin-thread-multi- +2level/auto/Mac/SystemDirectory/SystemDirectory.bundle Expected in: flat namespace

Is there anything I can do to get this working?

$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks


In reply to How do you run a perl script using a custom perl build from an AppleScript? by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.