Re: [basex-talk] Starting multiple sessions in BaseX with Perl: compilation failed at Carp.pm

2016-06-30 Thread Bram Vanroy | KU Leuven
So I ran strace and this is the result

$ strace perl gendervariatie-multiple.pl 2>&1 | grep -i carp
stat("/usr/local/lib64/perl5/Carp.pmc", 0x7fff387d8190) = -1 ENOENT (No such 
file or directory)
stat("/usr/local/lib64/perl5/Carp.pm", 0x7fff387d80e0) = -1 ENOENT (No such 
file or directory)
stat("/usr/local/share/perl5/Carp.pmc", 0x7fff387d8190) = -1 ENOENT (No such 
file or directory)
stat("/usr/local/share/perl5/Carp.pm", 0x7fff387d80e0) = -1 ENOENT (No such 
file or directory)
stat("/usr/lib64/perl5/vendor_perl/Carp.pmc", 0x7fff387d8190) = -1 ENOENT (No 
such file or directory)
stat("/usr/lib64/perl5/vendor_perl/Carp.pm", 0x7fff387d80e0) = -1 ENOENT (No 
such file or directory)
stat("/usr/share/perl5/vendor_perl/Carp.pmc", 0x7fff387d8190) = -1 ENOENT (No 
such file or directory)
stat("/usr/share/perl5/vendor_perl/Carp.pm", 0x7fff387d80e0) = -1 ENOENT (No 
such file or directory)
stat("/usr/lib64/perl5/Carp.pmc", 0x7fff387d8190) = -1 ENOENT (No such file or 
directory)
stat("/usr/lib64/perl5/Carp.pm", 0x7fff387d80e0) = -1 ENOENT (No such file or 
directory)
stat("/usr/share/perl5/Carp.pmc", 0x7fff387d8190) = -1 ENOENT (No such file or 
directory)
stat("/usr/share/perl5/Carp.pm", {st_mode=S_IFREG|0644, st_size=7611, ...}) = 0
open("/usr/share/perl5/Carp.pm", O_RDONLY) = 4
read(4, "package Carp;\n\nour $VERSION = '1"..., 4096) = 4096

A lot of 'no such file or directory', but I assume that is normal and that Perl 
just looks until it finds the file? Maybe you can see something that's wrong 
here?

Thanks again!

Bram

-Oorspronkelijk bericht-
Van: Liam R. E. Quin [mailto:l...@w3.org] 
Verzonden: woensdag 29 juni 2016 23:26
Aan: Bram Vanroy | KU Leuven <bram.vanr...@student.kuleuven.be>; 'BaseX' 
<basex-talk@mailman.uni-konstanz.de>
Onderwerp: Re: [basex-talk] Starting multiple sessions in BaseX with Perl: 
compilation failed at Carp.pm

On Wed, 2016-06-29 at 21:47 +0200, Bram Vanroy | KU Leuven wrote:
> When I try to get the version manually from the command line, this 
> works fine.
> 
> perl -le 'use Carp; print $Carp::VERSION;'
> # returns 1.11

OK

> I'm at loss. I have no idea at all why the program would crash on such 
> a line!
Is there by any chance more than one version of Perl on your system?
You could try using strace to see which files were accessed - strace 
./your-script 2>&1 | grep -i carp might be useful.

> You say you didn't manage to start multiple basex sessions either.
> Can I ask what the cause of this was? Did Basex' Perl API throw an 
> error, and if so which one?

I didn't get an error but my script fails (or throws an exception) the second 
time I try to use a BaseX session; I can open several but only the first one 
used with $s->query() actually works. It might be that
$query->more() thinks it's got past the end of the results or something.

I didn't try for long though.

Liam

--
Liam R. E. Quin <l...@w3.org>
The World Wide Web Consortium (W3C)



[basex-talk] Starting multiple sessions in BaseX with Perl: compilation failed at Carp.pm

2016-06-29 Thread Bram Vanroy | KU Leuven
Hi there BaseX people!

 

Original post on StackOverflow:
http://stackoverflow.com/questions/38086358/starting-multiple-sessions-in-ba
sex-with-perl-compilation-failed-at-carp-pm

 

I wanted to see if I could start multiple BaseX sessions (on a single
server) to try some things out, but I can't even get the sessions to launch
- heck, I can't even get the Perl script to compile! This is odd to me,
because the same code works perfectly without multiple sessions.

 

Let's say I have a subroutine that creates sessions given an amount. E.g.
the following code would create 3 sessions (variables for dbhost, user and
password left out):

 

CreateSessions(3);

 

# For testing

my $session = $sessions[0];

 

sub CreateSessions {

  my ($amountofsessions) = @_;

  our @sessions = ();

  for (my $i = 0; $i < $amountofsessions; $i++) {

my $session = Session->new($dbhost, 1950, $usr, $pw);

push(@sessions, $session);

  }

}

 

I also tried other approaches, e.g. creating each session individually and
assigning it to a variable, and then building an array with these variables.
The same problem occurs:

 

Compilation failed in require at /usr/share/perl5/Carp.pm line 33.

 

When I look up that file and that line, it states:

 

eval { require Carp::Heavy };

 

 

Which, I guess, means that I don't have the Carp module installed? But I do
not understand why I would need this, and why that the Perl script works
when I only create one session.

 

Is it possible to launch multiple sessions from Perl that can work
simultaneously, and if so, how do you launch these sessions and access them?
It's important to note that in PHP, for another project but the same
database, having multiple sessions does work. In other words, there I can
have multiple sessions that run in parallel.

 

We're on BaseX 7.9 and Perl 5.10.1. (Old, I know, but I can't change it.)

 

 

Thank you for your time!

 

Bram