Proper shebang line for running perl script with an AppleScript on a perlbrew install

applescriptperl

I have the following simple AppleScript which calls a perl script I wrote to clean the desktop:

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

The 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
Modern::Perl module) (@INC contains:
/Library/Perl/5.18/darwin-thread-multi-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_desktop.pl line 3. BEGIN failed–compilation
aborted at /Users/stevied/bin/clean_desktop.pl line 3.

I have perlbrew installed. The current shebang line for the perl script is:

#! /usr/bin/env perl

Best Answer

See first comment here for answer: http://www.perlmonks.org/?node_id=1191380