Perl 6 script in Perl 5 module distribution
I can include the Perl 6 script in the distribution of the Perl 5 module:
dzil new My::Dist
cd My-Dist/
echo '# ABSTRACT: boilerplate' >> lib/My/Dist.pm
mkdir bin
echo '#!/usr/bin/env perl6' > bin/hello.p6
echo 'put "Hello world!";' >> bin/hello.p6
dzil install
hello.p6
which hello.p6
Perl 5 script in the distribution of Perl 6 modules
However, it’s hard for me, including Perl 5 scripts in the Perl 6 distribution.
The module directory contains a file META6.jsonand a subdirectory called bin. There binis a Perl 5 file named hello.pl.
zef install .works without errors in the top directory. But when I try to start, hello.plI get an error message. Let's go find out if the Perl 6 script shell has been installed for hello.pl, and that is exactly what gives me the error. If I run the original hello.pldirectly, it works fine.
META6.json
{
"perl" : "6.c",
"name" : "TESTING1234",
"license" : "Artistic-2.0",
"version" : "0.0.2",
"auth" : "github:author",
"authors" : ["First Last"],
"description" : "TESTING module creation",
"provides" : {
},
"depends" : [ ],
"test-depends" : [ "Test", "Test::META" ]
}
bin/hello.pl
use v5.10;
use strict;
use warnings;
say 'Hello world!';
, hello.pl, :
===SORRY!===
Could not find Perl5 at line 2 in:
/home/username/.perl6
/path/to/perl6/rakudo-star-2017.07/install/share/perl6/site
/path/to/perl6/rakudo-star-2017.07/install/share/perl6/vendor
/path/to/perl6/rakudo-star-2017.07/install/share/perl6
CompUnit::Repository::AbsolutePath<64730416>
CompUnit::Repository::NQP<43359856>
CompUnit::Repository::Perl5<43359896>
which hello.pl , /path/to/perl6/rakudo-star-2017.07/install/share/perl6/site/bin/hello.pl. :
/path/to/perl6/rakudo-star-2017.07/install/share/perl6/site/bin/hello.pl
sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
CompUnit::RepositoryRegistry.run-script("hello.pl", :dist-name<TESTING1234>, :$name, :$auth, :$ver);
}
Rakudo (https://rt.perl.org/Ticket/Display.html?id=131911), , .