Autrijus Tang wrote:

So, this now works in Pugs with (with a "env PUGS_EMBED=perl5" build):

   use Digest--perl5;

   my $cxt = Digest.SHA1;
   $cxt.add('Pugs!');

   # This prints: 66db83c4c3953949a30563141f08a848c4202f7f
   say $cxt.hexdigest;

This includes the "Digest.pm" from Perl 5.  DBI.pm, CGI.pm etc will
also work.

Now my question is, is my choice of using the "perl5" namespace indicator a sane way to handle this? Is it okay for Perl 6 to fallback to using Perl 5
automatically?  Or should I use something else than "use" entirely?

Thanks,
/Autrijus/
Personally, I question the need for any flag saying it's perl5, and actually would prefer there be no such thing.

Consider S01: "Migration is important. The perl interpreter will assume that it is being fed Perl 5 code unless the code starts with a "class" or "module" keyword, or you specifically tell it you're running Perl 6 code in some other way,", which sounds to me like a "yes" to your fallback question.

On the migration front, when someone ports Digest.pm to Perl6, I get a "free" upgrade, assuming the module author was kind enough to up the version number.


Glancing at S11, I see where you're coming from. There is some logic in giving all the p5 modules an author of "perl5", since they will not have one on their own. However, I think the calling syntax would have to be "use Digest-(Any)-perl5;" to force the usage of a perl5 version.

-- Rod Adams





Reply via email to