On Tue, 03 Jan 2017 01:11:06 +0100, Erik Colson <e...@ecocode.net> wrote:

> Elizabeth Mattijsen <l...@dijkmat.nl> writes:
> 
> > How about starting with Inline::Perl5 and “use 
> > Device::SerialPort:from<Perl5>” ?  
> 
> I considered that solution, but had some fears.. So I figured I might be
> overlooking other (maybe bether) options ?
> 
> About Device::SerialPort
> 
> The module uses XS. Is that supported with Inline ?

Yes

> How do I install the module ? Do I just issue cpanm Device::SerialPort ?

I personally use «cpan Device::SerialPart», but yes, that's it

> How do I tell perl6 which perl5 to use ? Is Inline launching a separate
> perl5 with the usual environment settings (PATH, PERL5LIB etc) ?

Here are my (still working) Text::CSV_XS and DBI examples. These
scripts are from April 2015, so the syntax might have been made even
easier by now

--8<--- Text::CSV_XS
#!perl6

use v6;
use Slang::Tuxic;
use Inline::Perl5;

my $p5 = Inline::Perl5.new;

$p5.use ("Text::CSV_PP");

my @rows;
my $csv = $p5.invoke ("Text::CSV_PP", "new")
    or die "Cannot use CSV: ", $p5.invoke ("Text::CSV_PP", "error_diag");
$csv.binary (1);
$csv.auto_diag (1);

my Int $sum = 0;
for lines () :eager {
    $csv.parse ($_);
    $sum += $csv.fields.elems;
    }
$sum.say;
-->8---

--8<--- DBI
#!perl6

use v6;
use Slang::Tuxic;
use Inline::Perl5;

my $p5 = Inline::Perl5.new;

$p5.use ("DBI");

my $dbh = $p5.invoke ("DBI", "connect", "dbi:Pg:");

my $sth = $dbh.prepare ("select count (*) from url");
$sth.execute;
$sth.bind_columns (\my $count);
my @count = $sth.fetchrow_array;
@count[0].say;
-->8---

-- 
H.Merijn Brand  http://tux.nl   Perl Monger  http://amsterdam.pm.org/
using perl5.00307 .. 5.25   porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/        http://www.test-smoke.org/
http://qa.perl.org   http://www.goldmark.org/jeff/stupid-disclaimers/

Attachment: pgpeADWhxT8yb.pgp
Description: OpenPGP digital signature

Reply via email to