Operating System - OpenVMS
1748122 Members
3246 Online
108758 Solutions
New Discussion юеВ

Re: Perl on OpenVMS multithread

 
Bruno Seghers
Advisor

Perl on OpenVMS multithread

Hi,

I'm a new poeple in the perl world
Here is the code I try to execute and after the result. Is there a way to solve this ?

Thanks for Help

Seghers Bruno
Belgium

#!/usr/bin/perl
#leaks memory- Threads::Queue is for the old Threads <5.7
use strict;
use threads;

use Thread::Queue;

my @threads;
my $thread;

my $q = Thread::Queue->new();
$q->enqueue(1..10000);
print "Items in the queue: ",$q->pending,"\n";
for (1..5) {
push @threads, threads->new(\&ttest);
print "spawned thread:";
}
foreach $thread (@threads){
$thread->join;
}

sub ttest {
while (my $cnt = $q->pending) {
my $item = $q->dequeue;
print "$cnt\n";
last if $cnt == 0 ;
}
}



Results of execution :

USRDISK0:[USERS.MEESSEN.WORK]>perl test_thr.pl
test_thr.pl line 4:

This Perl hasn't been configured and built properly for the threads
module to work. (The 'useithreads' configuration option hasn't been used.)

Having threads support requires all of Perl and all of the XS modules in
the Perl installation to be rebuilt, it is not just a question of adding
the threads module. (In other words, threaded and non-threaded Perls
are binary incompatible.)

If you want to the use the threads module, please contact the people
who built your Perl.

Cannot continue, aborting.
BEGIN failed--compilation aborted at /perl_root/lib/VMS_AXP/5_8_6/threads.pm line 28.
Compilation failed in require at test_thr.pl line 4.
BEGIN failed--compilation aborted at test_thr.pl line 4.
%SYSTEM-F-ABORT, abort
USRDISK0:[USERS.MEESSEN.WORK]>
5 REPLIES 5
Bruno Seghers
Advisor

Re: Perl on OpenVMS multithread

Info about perl installed :

BKS005/SEGH/BKS> perl -v

This is perl, v5.8.6 built for VMS_AXP

Copyright 1987-2004, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

Craig A Berry
Honored Contributor

Re: Perl on OpenVMS multithread

You pretty much have to do what it says and build your own thread-enabled Perl from source. I would start with the Perl 5.10 source here:

http://www.cpan.org/src/perl-5.10.0.tar.gz

You'll need gunzip, a tar utility, the HP C compiler, and MMK (MMS should work but doesn't). Once you've got the kit unpacked, have a look at README.vms. The short version of what you'll need to do is:

$ @configure -"Duseithreads"

$ mmk
$ mmk test
$ mmk install
Hein van den Heuvel
Honored Contributor

Re: Perl on OpenVMS multithread


Well,

The message means it.
You'll have to build your own perl with Threads enabled, or find a (systems) person to do so for you.
Personally I have no experience with that so can not help you. Craig Berry, a perl/vms wizard, does stop by here, and can possibly provide a more complete answer.

In the mean time I suggest you look (google) around for a perl 5.10 kit and check the build instructions.

You may also want to cross-post in the perl.vmsperl newgroup. Other OpenVMS Perl resources (like John Malmberg) focus more on those than the itrc forum:

http://groups.google.com/group/perl.vmsperl/search?hl=en&group=perl.vmsperl&q=threads

btw 1... not relevant for this question, but if when posting source code in this forum, it is best to check 'Retain Format', otherwise it will eat your spaces, harming readability.

btw 2... The versions of perl on the more or less public access system Eisner and hp-testdrive have not been build with threads either.

fwiw,
Hein.
Hein van den Heuvel
Honored Contributor

Re: Perl on OpenVMS multithread

Hein wrote> "Craig Berry, a perl/vms wizard, does stop by here, and can possibly provide a more complete answer."

He did stop by, and he did provide a complete answer between the time that I saw the question and before I hit my 'submit' button.

:-)

Oh well, That'll teach me to jump in. (not!)

Hein.
Bruno Seghers
Advisor

Re: Perl on OpenVMS multithread

Thank you for info and thank you for spending time on a beginner question.

Seghers Bruno