Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

added check for shell in installed script

5 views
Skip to first unread message

Boyd Duffee

unread,
Oct 11, 2012, 3:37:01 AM10/11/12
to module...@perl.org
Hi there,

I found the following line added to a script that I created with
Module::Build 0.4 and used Module::Build 0.38 to install

eval 'exec /usr/bin/perl -wT -S $0 ${1+"$@"}'
if 0; # not running under some shell

I wasn't expecting that and I'm not sure that I want it. It doesn't mention
this behaviour in the docs. Can someone explain why? This is my Build.PL
script.

my $builder = Module::Build->new(
module_name => 'Keele::Utilities::Database',
license => 'perl',
dist_author => q{Boyd Duffee <b.duffee at isc.keele.ac.uk>},
dist_version_from => 'lib/Keele/Utilities/Database.pm',
requires => {
'DBI' => '1.52',
'Keele::Utilities' => '0.03',
'Date::Manip' => 0,
},
build_requires => {
'Test::More' => 0,
},
configure_requires => {
'Module::Build' => 0.38,
},
add_to_cleanup => [ 'Keele-Utilities-Database-*' ],
create_makefile_pl => 'traditional',
script_files => {
'script/get_my_network_usage.pl' => 0,
}
);

if ( $builder->install_destination('script') ne '/usr/local/bin' ) {
my $script_install = $builder->prompt('Script location', '/usr/local/bin');
$builder->install_path('script' => $script_install);
}


thanks,
--
Boyd Duffee Keele University (01782) 734225
Student Facing Systems
<DarthBart> Nobody "codes" in Perl. Perl programs are written by eating
a bag of alphabet pasta and then chasing it with ipecac.
<xaxa> My alphabet spaghetti only had A-Z. Perl uses the *other*
half of ASCII.

Boyd Duffee

unread,
Oct 10, 2012, 12:42:51 PM10/10/12
to module...@perl.org
Hi there,

I found the following line added to a script that I created with
Module::Build 0.4 and used Module::Build 0.38 to install

eval 'exec /usr/bin/perl -wT -S $0 ${1+"$@"}'
if 0; # not running under some shell

I wasn't expecting that and I'm not sure that I want it. It doesn't mention
this behaviour in the docs. This is my Build.PL script.

David Mertens

unread,
Oct 11, 2012, 7:21:35 AM10/11/12
to module...@perl.org
Forgot to reply to all.
---------- Forwarded message ----------
From: "David Mertens" <dcmerte...@gmail.com>
Date: Oct 11, 2012 6:20 AM
Subject: Re: added check for shell in installed script
To: "Boyd Duffee" <b.du...@keele.ac.uk>

I thought this was just standard procedure for preventing silly users from
shooting their foot off by accidentally running your script with a shell,
instead of with Perl. Does EU::MM not do this? Module::Build does a few
things like this with scripts. For example, on Windows it creates .bat
files with the script name so that users can "just run" the script on their
OS.

David

Boyd Duffee

unread,
Oct 11, 2012, 8:18:33 AM10/11/12
to module...@perl.org
On 10/11/2012 12:21 PM, David Mertens wrote:
> I thought this was just standard procedure for preventing silly users from
> shooting their foot off by accidentally running your script with a shell,
> instead of with Perl. Does EU::MM not do this? Module::Build does a few
> things like this with scripts.

This is the first time I've tried to do something outside the absolute
minimum, so I've not tried it on EU::MM and wouldn't know. The thread at
http://www.perlmonks.org/?node_id=825147 has much stronger feelings about the
issue than I do, but seeing as I'm writing a module for internal
distribution, would there be any chance of an option to turn it off (further
down the line perhaps)?
0 new messages