atom feed3 messages in org.perl.module-authorsRe: Bundling a script with a CPAN mod...
FromSent OnAttachments
Shmuel FombergJul 2, 2011 4:44 pm 
Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯Jul 3, 2011 5:07 am 
David CantrellJul 4, 2011 8:47 am 
Subject:Re: Bundling a script with a CPAN module?
From:Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 (dax@cpan.org)
Date:Jul 3, 2011 5:07:07 am
List:org.perl.module-authors

documentation that explains how [to include an installable script in a distro]

Put it in the `bin` directory. <http://p3rl.org/Module::Build::API#script_files> The shebang must point to a Perl, `/usr/bin/env perl` does not work.

is MM support it too?

Yes, but I did not verify it.

how do I make sure that the shebang line in the installed script points to the same Perl that installs this module?

This happens automatically, see <http://p3rl.org/Module::Build::API#fix_shebang_line> and <http://kobesearch.cpan.org/htdocs/Module- Build/Module/Build/Base.pm.html#fix_shebang_line->.

how do I make sure that a batch file is generated on Windows?

This happens automatically.

Follow along with this example:

/tmp/Foo-Bar$ tree . ├── bin │ └── foobar └── Build.PL

1 directory, 2 files

/tmp/Foo-Bar$ cat bin/foobar #!/usr/bin/perl print "hello world!";

/tmp/Foo-Bar$ cat Build.PL use Module::Build; Module::Build->new( module_name => 'Foo::Bar', dist_version => 1, dist_author => 'Foo', dist_abstract => 'bar', )->create_build_script;

/tmp/Foo-Bar$ perl Build.PL ⋮ Creating new 'Build' script for 'Foo-Bar' version '1'

/tmp/Foo-Bar$ ./Build Building Foo-Bar

/tmp/Foo-Bar$ tree blib blib ├── arch └── script └── foobar

2 directories, 1 file

/tmp/Foo-Bar$ cat blib/script/foobar #!/home/daxim/local/share/perlbrew/perls/perl-5.14.1/bin/perl

eval 'exec /home/daxim/local/share/perlbrew/perls/perl-5.14.1/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell print "hello world!";

When <http://grep.cpan.me/> is available again, search for "not running under some shell" and see what else comes up.