Hi,
Inline::Perl5 is probably not the recommended entry point to perl6.
But it's, so far, the only aspect of perl6 I've come across that has piqued my interest in perl6 - and it looks like it's going to become *my* entry point (for that given reason).
Nevertheless, I'm happy to apologise for this unorthodoxy on my part if that's deemed appropriate.
(Blame Doug Hunt on the PDL mailing list for having mentioned Inline::Perl5 on the PDL-dev mailing list ;-)

So ... I have a perl5 module named Math::Float128. Basically, it does __float128 arithmetic, and it builds fine on most platforms if you use a recent port of the gcc compiler.
As an exercise, I thought it would be interesting (for me) to access that module and its functionality from perl6.
On Ubuntu 14.04 I have:
sisyphus@sisyphus5-desktop:~/p6$ perl6 -v This is Rakudo version 2015.12 built on MoarVM version 2015.12 implementing Perl 6.c. sisyphus@sisyphus5-desktop:~/p6$ perl -v This is perl 5, version 22, subversion 0 (v5.22.0) built for x86_64-li +nux ....
And, after muddling my way through the installation of Inline::Perl5 (with the assistance of a number of patient monks), I've come up with this perl6 script (which works fine):
use Inline::Perl5; my $p5 = Inline::Perl5.new; $p5.use('Math::Float128'); my $f128 = $p5.invoke('Math::Float128', 'new', '1.2345'); say "$f128"; $f128.print; say ''; # insert the newline say "ok";
That correctly outputs:
sisyphus@sisyphus5-desktop:~/p6$ perl6 use.pl 1.23450000000000000000000000000000009e+00 1.23450000000000000000000000000000009e+00 ok
Based on that it seems to me that the perl5 overloading of "" is being correctly accessed - as that's the only way I can think of that both

say "$f128";
and
$f128.print;

would render correctly.

Is that assessment correct ? (That's my first question).

Inspired by the success of

$f128.print;
I tried
$f128.say;

But that just outputs:
Inline::Perl5::Perl5Object.new(ptr => NativeCall::Types::Pointer.new(1 +00938200), perl5 => Inline::Perl5.new)
Why ? (That's my second question).

Is there a better way to access __float128 arithmetic using perl6 ? (My third and last question ... for tonight ;-)

Cheers,
Rob

In reply to [perl6] More Inline::Perl5 musings by syphilis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.