Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks Corion, Tux, duelafn.
Not much to add except that the level of support for perl5 extensions seems pretty good.

In general, I haven't yet found a way to access overloaded operators directly.
Instead I'm calling the overloading subroutines by name - eg:
use Inline::Perl5; my $p5 = Inline::Perl5.new; $p5.use('Math::Float128'); my $f1 = $p5.invoke('Math::Float128', 'new', '2.5'); my $f2 = $p5.invoke('Math::Float128', 'new', '3.0'); my $swap = 0; # Set to true if order of # operands is to be swapped # Set $f3 to $f1 divided by $f2 my $f3 = $f1._overload_div($f2, $swap); say "# $f3"; # Outputs, as expected: # 8.33333333333333333333333333333333365e-01
I was hoping to be able to do something like:
my $f3 = $f1 / $f2;
but that doesn't work, so I have to resort to calling Math::Float128::_overload_div() by name.

That's no big deal, but it still puzzles me that say "# $f3"; apparently manages to access the Math::Float128 overloading of "" without any need for me to call Math::Float128::_overload_string() by name.
Yet for all other overloaded operators I'm having to call the relevant subroutine.
The penny will drop when it's ready to fall ;-)

I'm also wondering whether Inline::Perl5 will work on MS Windows. Any experience of that here ?
I think it should be ok:
C:\>perl -V:useshrplib useshrplib='true';

At some stage I'll grab a Windows version of perl6 ... and find out ...

Cheers,
Rob

In reply to Re^2: [perl6] More Inline::Perl5 musings by syphilis
in thread [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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-24 17:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found