[6276] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 898 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 5 08:57:39 1997

Date: Wed, 5 Feb 97 05:00:29 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 5 Feb 1997     Volume: 7 Number: 898

Today's topics:
     Re: @ (Mike Stok)
     Re: building perl on linux (Mike Heins)
     Cleaning up defunct processes on SunOS <rubin@research.att.com>
     Compile DBI <ob@online.neurotec.de>
     Re: DNS lookups in perl (Thanks!) <kmm96jog@mds.mdh.se>
     Re: DNS lookups in perl (Michael Fuhr)
     Enviroment (Steven R. Johnson)
     Re: Notorious problem with sockets and POP3 - please gi (Gary)
     Perl compiler/translator for PC <nightshadow@thevortex.com>
     Perl on Microsoft IIS, NT Server 4.0 <stemo@powersim.no>
     Re: Perl regexes are *not* greedy (was Pattern Matching (Jeffrey)
     Re: Perl-PVM FAQ or information (Edward Walker)
     perl5.003 on HPUX 9.x MC68000 machines <Peter@TB408.deta.de>
     Re: space stripping (Mike Stok)
     Re: URL Encoding (Jeffrey)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 5 Feb 1997 12:54:05 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: @
Message-Id: <5d9vtd$psh@news-central.tiac.net>

In article <5d8ap4$n30@news.wco.com>, Steve Johnson  <stevej@wco.com> wrote:

>NOTE:  This doesnt always work.. Im running Perl 5.003 on Linux and this
>bombs..  usualy i have to do it this way
>$ad="someone\100"."somewhere.net";

Do you have an example chunk of code where a simple interpolation like

  $ad = "someone\@somewhere.net";

blows up?  It would be interesting to see the code and know a bit about
the environment.

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


------------------------------

Date: 5 Feb 1997 12:35:46 GMT
From: mheins@prairienet.org (Mike Heins)
Subject: Re: building perl on linux
Message-Id: <5d9ur2$ceu@vixen.cso.uiuc.edu>

Jeff Bland (jbland@.ccia.com) wrote:
: 
: -- 
: I have just spent the last 6 hours trying to build perl on my linux box.
: 
: Obviously, since I am writing this, it didn't work.
: 
: its a standard slackware build, 3.1 i think.  I haven't changed anything
: that would affect the system (installed things but not much else).
: 
: it dies saying ld can't find the -ldl lib.
: 
: now dammit, the config script finds it, I explicity say -L/lib and 
: -L/usr/lib and it just won't friggin work.
: 
: I *need* this to work, please.....
: 

Slackware is distributed without libldl.so -- they may have one or
a fix if you contact them.

In the meantime, you can build Perl by replying 'no' to the dynamic
loading question and then not letting it be taken back by the
next "WHOA!".

This only builds the included modules in statically, and doesn't
affect your ability to install dynamic extensions. It doesn't add
much in executable size (24K), and I have found it works fine, in
fact so well that I haven't bothered to fix my Slackware.

-- 
Regards,                                                      ___       ___
Mike Heins     [mailed and posted]  http://www.iac.net/~mikeh|_ _|____ |_ _|
                                    Internet Robotics         | ||  _ \ | |
This post reflects the              Oxford, OH  45056         | || |_) || | 
opinion of my employer.             <mikeh@iac.net>          |___|  _ <|___|
                                    513.523.7621 FAX 7501        |_| \_\   


------------------------------

Date: Mon, 3 Feb 1997 22:07:46 GMT
From: Avi Rubin <rubin@research.att.com>
Subject: Cleaning up defunct processes on SunOS
Message-Id: <32F661B2.446B9B3D@research.att.com>

We are developing a multithreaded (many forks) application,
and on an SGI machine, we use 

$SIG{CHLD} = \&REAPER;


sub REAPER {
my $waitedpid;

    $waitedpid = wait;
    logmsg "reaped $waitedpid". ($? ? " with exit $?" : "");

}

to get rid of defunct/zombie processes. It works great. However,
when we go over to a sparcstation running SunOS 4.1.x, the
program dies upon reaping the first child. We also tried to add
the line, $SIG{CHLD} = \&REAPER; as the first line of the REAPER
subroutine, as indicated in the Camel book (p. 340). It didn't help.

Anybody come across this before? The problem is that even though
our child processes are exiting, they don't seem to go away when
we do a ps. Eventually, we have over 100 of them, and we can't
even form a command from the shell. When we ^C the program, they
all go away.

Please respond to rubin@research.att.com as I don't read news
very often.

Thanks.


------------------------------

Date: 5 Feb 1997 08:19:35 GMT
From: "Oliver Belikan" <ob@online.neurotec.de>
Subject: Compile DBI
Message-Id: <01bc133e$1d32cd60$7d64a8c0@OliverB.intern.online.neurotec.de>

HP-UX 10.10, ORACLE 7.3.2.1.0, PERL 5.003

by compiling DBI.c i receive error 1646 (illegal pointer combination) on
line 966. 
What4s the Problem ? 

Is it possible PERL runs not correct ?


------------------------------

Date: Wed, 5 Feb 1997 13:02:44 +0100
From: Jonas Oberg <kmm96jog@mds.mdh.se>
Subject: Re: DNS lookups in perl (Thanks!)
Message-Id: <Pine.GSO.3.95.970205130110.4071B-100000@legolas.mdh.se>

> I'm currently working on Net::DNS, a module for doing DNS lookups
> in Perl.  Here's a lookupprimarymx subroutine that uses it:

Thanks to you, and everyone else who has answered my question. I think
I'll give Net::DNS a try first since it seems like quite a handy tool to
use, tho.

------[ Jonas - Just another intelligent shade of blue ]------
http://www.mds.mdh.se/~kmm96jog - PGP key available via finger
--------------------------------------------------------------



------------------------------

Date: 4 Feb 1997 22:24:32 -0700
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: DNS lookups in perl
Message-Id: <5d95ig$q9v@nova.dimensional.com>

joeyGibson@mindspring.com (Joey Gibson) writes:

>On Tue, 4 Feb 1997 16:13:32 +0100, Jonas Oberg <kmm96jog@mds.mdh.se>
>wrote:
>||| Is it possible to do a DNS lookup from inside a perl script?
>||| I've got a program which is piped a message and picks out the bare bone
>||| sender address (Such as jonas@coyote.eu.org) in $sender. I now want to
>||| lookup the primary mail exchanger for coyote.eu.org.  I'd like something
                ^^^^^^^^^^^^^^^^^^^^^^
>||| like
>||| $mx = lookupprimarymx($sender);
     ^^^^^^^^^^^^^^^^^^^^^

>Here is a Perl script I wrote last year to simulate NSLookup. It is
>actually quite easy. There isn't really any error checking, but you can
>adapt it however you want. I wrote this under WindowsNT, but it should
>work with any Perl 5.

-snip-
># Fetch the info from the DNS server.
>($name, $aliases, $addrType, $length, @addresses) = gethostbyname
>$ARGV[0];
-snip-

The requestor specifically said he wanted to look up DNS MX records,
while your example uses gethostbyname, which looks up A records.  This
won't give the desired results.

I'm currently working on Net::DNS, a module for doing DNS lookups
in Perl.  Here's a lookupprimarymx subroutine that uses it:

    sub lookupprimarymx {
        my $dname = shift;
        my $res = new Net::DNS::Resolver;
        my $query = $res->query($dname, "MX");
        if (defined($query)) {
            my @mx = sort { $a->preference <=> $b->preference} $query->answer;
            return $mx[0]->exchange;
        }
        else {
            return undef;
        }
    }

For example, mds.mdh.se has the following MX records:

    mds.mdh.se.     IN      MX      0 legolas.mdh.se.
    mds.mdh.se.     IN      MX      5 lennart.mdh.se.
    mds.mdh.se.     IN      MX      10 sunic.sunet.se.

The above subroutine will return "legolas.mdh.se".

You should be able to find Net::DNS on CPAN very soon.  You can
also get a copy at:

    http://www.dimensional.com/~mfuhr/perldns/

Please be aware that the module is still in development, but in
general it works.
-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


------------------------------

Date: 5 Feb 1997 07:24:10 GMT
From: stevej@mistic.net (Steven R. Johnson)
Subject: Enviroment
Message-Id: <5d9ciq$6cp@news.wco.com>


I have a perl script set up as a menu.. I have it set as a users shell in
/etc/password, one of the options is to launch the news reader (tin).  The news
server address is defined by $NNTPSERVER  in the /etc/profile  Now for some
reason when the perl script launches the news reader the enviroment variable
never gets defined.  How do I keep enviroment variables intact?

-Steve



------------------------------

Date: Wed, 05 Feb 1997 07:57:29 GMT
From: gniemcew@dti.net (Gary)
Subject: Re: Notorious problem with sockets and POP3 - please give me a clue
Message-Id: <32f83d1c.31151253@news.alt.net>

On 5 Feb 1997 05:45:34 GMT, shishir@ruby.ora.com (Shishir Gundavaram)
wrote:

>Try unbuffering SOCKET here:
>
>$handle = select (SOCKET);
>$| = 1;
>select ($handle);
>
>: print "\nConnected.\n\n";
>
>[rest deleted]

This was exactly it (!). Thanks, appreciate it...

Gary
gniemcew@dti.net



------------------------------

Date: Wed, 05 Feb 1997 19:46:13 -0800
From: Nightshadow <nightshadow@thevortex.com>
Subject: Perl compiler/translator for PC
Message-Id: <32F95405.34@thevortex.com>

Does Perl exist for the dos PC? If so, where can I find a
such a compiler/translator. Thanx and sorry for posting this, but
I've searche high and low and just couldn't find any.

-- 
                  /\
      /vvvvvvvvvvvv \------------------------------
      `^^^^^^^^^^^^ /========== Nightshadow =====/
                  \/
    "War does not determine who's right, war determines who's left."


------------------------------

Date: Wed, 05 Feb 1997 13:13:51 +0100
From: Steinar Moen <stemo@powersim.no>
Subject: Perl on Microsoft IIS, NT Server 4.0
Message-Id: <32F8797F.4171@powersim.no>

Perl doesn't work on my Server.

I have installed Perl5 on my Windows NT Server 4.0, running MS IIS 3.0.
I've also enabled the Execute permission on my cgi-bin directory. (This
is a virtual directory)
Is there anything else I have to do? (Enabling Perl etc...?)

When using Netscape to access my perl-script, I'm just asked where to
download the file...
(I have tried to switch the read access off, only having Execute access
left, and get stopped with no permission to read the file.)

Is there anybody who knows anything about this? ..who are using IIS and
Perl?


Thank you.

Steinar Moen, Norway


------------------------------

Date: 05 Feb 1997 11:16:18 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: tchrist@mox.perl.com (Tom Christiansen)
Subject: Re: Perl regexes are *not* greedy (was Pattern Matching Question)
Message-Id: <JFRIEDL.97Feb5201618@tubby.nff.ncl.omron.co.jp>

[mail and post]

Tom Christiansen <tchrist@mox.perl.com> wrote:
|> :|> Perl does greedy expression matching by default, which means it tries to
|> :|> match as much as possible with your pattern.
|> :
|> :This is a common misconception, but it's not really true.
|> 
|> Jeffrey, now be nice to the poor poster.

Now, Tom, I thought I *was* being nice :-)

[actually, after sending it, I sent a note to the original author telling
 him that I was just using his comment to go off on a speech, rather than
 jumping all over him specfically]

|> It *is* true that perl REs are greedy -- for certain commonly employed
|> laymen's definitions of the term "greedy". [....]

The way you describe it, yes, I suppose it could be considered that way. 
Sounds like the ``1+1=3, for certain values of 1'' thing :-)
I think Intel made a processor that could do that.

Anyway, your description doesn't fit the prevailing ``match as much as
possible with your pattern'' misconception to which I was replying.

|> For example, suppose you've got these stock options that are about to
|> vest.  Now, it's true that you might make more if you left your stock
|> options cook a while longer, but you take them out right away.  This is
|> not an abnormal definition of greed, and it is this definition that
|> Perl's REs employ, as well you know.  

I'm well versed in options trading, and lemetellyou, as non-deterministic
as an NFA is, it's sure a lot more deterministic than stocks! :-)
[I know options trading and stock options are unrelated, but it's easier
 to make my joke this way]

|> For the rest of the audience: in Perl REs, eagerness applied to direct,
|> predictable, LEFT-TO-RIGHT fulfillment is far more important than 
|> a potentially bigger return later down the line.

That's got the right flavor, but creating this new LEFT-TO-RIGHT saying
sounds a bit scary to me. Once you add in the non-greedy components, people
will get their eyes tangled, not to mention their brains. And with a
description like this, discussions of efficiency become non-existant. And
what about when trying to explain how /(this|that).*?(tom|larry)/ will
match against "that tom this larry"... the RIGHT-TO-LEFT, although perhaps
making sense, becomes strained.

|> DFAs are not easy to write, nor are they easy to explain. Simple
|> left-to-right processing is much easier to explain and understand for
|> beginners, amongst others.

I'd rather just explain it for what it is. It's the non-greedy method of
explaining -- you don't get a lot of immediate satisfaction because the
details take a bit to explain, but in the end the understanding is much
MUCH more solid. Mmm, or would this be considered the greedy method of
explaining? :-)

I'd like to thing that my TPJ#2 article makes a good introduction. It's
eight pages, so takes some time, but it explains what's really happening.
[TPJ#2 = second issue of _The Perl Journal_, http://www.tjp.com/tjp]

|> And modifiers are certainly greedy by anyone's book.

Not by yours! (at least when you explain *?, ??, +?, etc :-)

	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@omron.co.jp> Omron Corp, Nagaokakyo, Kyoto 617 Japan
O'Reilly & Associates' _Mastering Regular Expressions_
                                   http://enterprise.ic.gc.ca/~jfriedl/regex/


------------------------------

Date: 5 Feb 1997 07:56:32 GMT
From: edward@nsrc.nus.sg (Edward Walker)
Subject: Re: Perl-PVM FAQ or information
Message-Id: <5d9efg$g8e@nuscc.nus.sg>

Dominic Dunlop (domo@tcp.ip.lu) wrote:
: John Jennewine wrote:
: > Is there any source or location where Perl-PVM is documented and described?

: A microscopic amount of research with Alta Vista takes me straight to
: <http://www.nsrc.nus.sg/STAFF/edward/Pvm.html>.  Or you can go to
: <ftp://ftp.cs.ruu.nl/users/mirror/CPAN/authors/Edward_Walker> or
: similar.  (You can get to a CPAN site near you via the multiplexor at
: <http://www.perl.com/perl/news/cpan-mux.html>.)

I've included below the pod formatted man page for Perl-PVM.  
Hope this is useful.

Edward Walker

-----------------------------Cut Here------------------------------

=head1 NAME

Parallel::Pvm - Perl extension for the Parallel Virtual Machine (PVM) Message Passing System

=head1 SYNOPSIS

  use Parallel::Pvm;

=head1 DESCRIPTION

The B<PVM> message passing system 
enables a programmer to configure a group of 
(possibly heterogenous) computers connected by 
a network into a 
parallel virtual machine.  
The system was developed by 
the University of Tennessee, Oak Ridge National 
Laboratory and Emory University. 

Using PVM, applications can 
be developed which spawns parallel processes onto 
nodes in the virtual machine to perform specific tasks.  
These parallel tasks can also periodically exchange 
information using a set of message passing functions 
developed for the system.  

PVM applications have mostly been developed in the scientific 
and engineering fields.  However applications 
for real-time and client/server systems can also be developed.  
PVM simply provides a convenient way for managing 
parallel tasks and communications  
without need for B<rexec> or B<socket> level programming.

As a utility, PVM enables an organisation to leverage on the computers 
already available for parallel processing.  
Parallel applications can be started during non-peak 
hours to utilise idle CPU cycles.  
Or dedicated workstation clusters connected via 
a high performance network like B<ATM> can be used for high 
performance computing.  

It is recommended that you read the PVM manual pages and the book
"PVM: Parallel Virtual Machine, A users's guide and tutorial 
for networked parallel computing".  Both the PVM system and the 
book can be obtained from the HTTP address http://www.epm.ornl.gov/pvm.

For the rest of 
this document we will provide a tutorial introduction to 
developing PVM applications using perl.  The interface for some 
of the PVM functions have been changed of course to give it a 
more perl-like feel.  

Remember think perl think parallel!  Good Luck!  

=head2 Environment Variables

After installing PVM on your computer, there are two mandatory 
environment variables that have to be set in your .login or .cshrc
files; B<PVM_ROOT> and B<PVM_ARCH>.  
B<PVM_ROOT> points to the base of the B<PVM> 
installation directory, and B<PVM_ARCH> specifies the architecture 
of the computer on which B<PVM> is running.   An example of how this can 
be set for csh is shown below,

	setenv PVM_ROOT /usr/local/pvm3
	setenv PVM_ARCH `$PVM_ROOT/lib/pvmgetarch`

=head2 Setting up your rsh permission

In order for PVM applications to run, B<rsh> permission 
has to be enabled.  This involves creating a B<.rhosts> 
file in your B<HOME> directory containing, for each line, the host and 
account name you wish to allow remote execution privillages.
An example B<.rhosts> file to allow a PVM application to 
remotely execute on the host B<onyx> and B<prata> using the 
account B<edward> is shown below,

	onyx	edward
	prata	edward

=head2 Configuring your parallel virtual machine

Parallel process management and communications is handled by a set of 
distributed deamons running on each of the nodes of the 
virtual machine.  The daemon executable, B<pvmd>, is started 
when a computer is added to the virtual machine.  
A computer can be added to the virtual machine either statically 
in a console program or using a B<hostfile>, 
or dynamically within the application code itself.

The first method of configuring your virtual machine 
is to use the console program B<$PVM_ROOT/lib/pvm>.  
Run it from the command prompt.  The console program will first add the 
local host into the virtual machine and display the prompt 
	
	pvm>

To add a host, eg B<onyx>, as a node in your parallel virtual machine, simply
type

	pvm> add onyx

To display the current virtual machine configuration type

	pvm> conf

which will display node information pertaining to the host name, 
host id, host architecture, relative speed and data format.  
The console program has a number of other commands which can 
be viewed by typing B<help>.  

The second method of configuring your virtual machine is to use 
a B<hostfile>.   The B<hostfile> is simply an ASCII text file 
specifing the host names of the computers to be added into your 
virtual machine.  

Additional options may be also be defined 
for the nodes pertaining to the working directory, 
execution path, login name, alternative hostname etc. A simple
example of a B<hostfile> is shown below. 

	* wd=$HOME/work ep=$HOME/bin
	onyx
	prata.nsrc.nus.sg
	laksa ep=$HOME/perl5/bin

In the above example B<hostfile> we are adding the 
hosts B<onyx>, B<prata.nsrc.nus.sg> and B<laksa> into the 
virtual machine. We are also specifying the working 
directory, B<wd>, in which we want our application 
to run, and the execution path, B<ep>, in which we want PVM
to look for executables. 

The B<*> in the first line 
defines a global option for all the hosts specified after it.
We can however provide an option locally to over-ride this
global option.  This is seen for the host B<laksa> where 
we have specified its execution path to be B<$HOME/perl5/bin> 
instead of the B<$HOME/bin>.  

The third method of configuring your virtual machine 
is to call the functions B<Parallel::Pvm::addhosts> or B<Parallel::Pvm::delhosts> 
within your application.  You must still start your master
B<pvmd> daemon first. This can be achieved by starting 
B<pvm> and typing B<quit> or simply typing  

	echo quit | pvm

The PVM application can then be started where 
we can add the hosts B<prata> and B<laksa> by calling

	Parallel::Pvm::addhosts("prata","laksa");

Or we can delete a host from our configuration by calling 

	Parallel::Pvm::delhosts("laksa");

PVM also provides a function, B<Parallel::Pvm::conf>, to query the configuration 
of the parallel virtual machine. An example code to check the current 
configuration is shown below.

	($info,@conf) = Parallel::Pvm::conf ;
	if ( $info == PvmOk ){
	  foreach $node (@conf){
	   print "host id = $node->{'hi_tid'}\n";
	   print "host name = $node->{'hi_name'}\n";
	   print "host architecture = $node->{'hi_arch'}\n";
	   print "host speed = $node->{'hi_speed'}\n";
	  }
	}

=head2 Enrolling a task into PVM

A task has to expilictly enroll into PVM 
in order for it to be known by other PVM tasks.  
This can often be done by the call 
	
	$mytid = Parallel::Pvm::mytid ;

where B<$mytid> is the task id, B<TID>, assigned by the 
PVM system to the calling process.  Note however that 
calling any PVM function in a program will also enroll it 
into the system.  

=head2 Spawning parallel tasks

A PVM application can spawn parallel tasks in your parallel 
virtual machine.  Assuming there is exists an executable called 
B<client>, we can spawn four B<client> tasks in our virtual 
machine by calling 

	($ntask,@tids) = Parallel::Pvm::spawn("client",4);

For each of the four spawned processes, the PVM system first 
allocates a host node and looks for the executable in the 
execuation path of that host.  If the executable is found it 
is started.  

The task which called the B<Parallel::Pvm::spawn> is known as 
the B<parent> task.  
The number of B<children> tasks which are actually spawned by 
B<Parallel::Pvm::spawn> is returned in the scalar B<$ntask>.  
The B<@tids> array returns the task id, B<TID>, of the spawned 
B<children> tasks which will be useful later for 
communicating with them.  A B<TID> < 0 indicates a task failure 
to spawn and can be used to determine the nature of 
the problem.  Eg.

	foreach $tid (@tids){
	   if ( $tid < 0 ){
	      if ( $tid == PvmNoMem )
		 warn "no memory ! \n";
	      }else if ( $tid == PvmSysErr ){
	         warn "pvmd not responding ! \n";
	      } ... 

	   }
	}

For more sophisticated users, B<Parallel::Pvm::spawn> may be given additional 
argument parameters to control how/where you want a task to be spawned.
For example, you can specifically spawn B<client> in the internet 
host B<onyx.nsrc.nus.sg> by calling

	Parallel::Pvm::spawn("client",1,PvmTaskHost,"onyx.nsrc.nus.sg");

Or you can spawn B<client> on host nodes only of a particular architecture, 
say RS6K workstations, by calling

	Parallel::Pvm::spawn("client",4,PvmTaskArch,"RS6K");

Also, if the spawned remote executable requires an argument B<argv>, 
you can supply this by calling

	Parallel::Pvm::spawn("client",4,PvmTaskArch,"RS6K",argv);

Note that tasks which have been spawned by using B<Parallel::Pvm::spawn> 
do not need to be explicitly enrolled into the pvm system.  

=head2 Exchanging messages between tasks

Messages can be sent to a task enrolled into PVM by specifying 
the example code sequence

	Parallel::Pvm::initsend ;
	Parallel::Pvm::pack(2.345,"hello dude");
	Parallel::Pvm::pack(1234);
	Parallel::Pvm::send($dtid,999);

In our example we first call B<Parallel::Pvm::initsend> to initialize 
the internal PVM send buffer.  
We then call B<Parallel::Pvm::buffer> to fill this buffer with a double (2.345),
, a string ("hello dude"), and an integer (1234).  
Having filled the send buffer with the data that is to be sent, 
we call B<Parallel::Pvm::send> to do the actual send to the task identifed by the B<TID> 
B<$dtid>.   We also label the sending message to disambiguate it with 
other messages with a tag.  This is done with the 999 argument in 
B<Parallel::Pvm::send> function.  

For the destination task, we can receive the message sent by 
performing a blocking receive with the function B<Parallel::Pvm::recv>.  
A code sequence for the above example on the recipent 
end will be 

	if ( Parallel::Pvm::recv >= 0 ){
	   $int_t = Parallel::Pvm::unpack ;
	   ($double_t,$str_t) = Parallel::Pvm::unpack ;
	}

Note that we must unpack the message in the reverse order in which we packed 
our message.  
In our example B<Parallel::Pvm::recv> will receive any message sent to it.  
In order to selectively receive a message, we could specify 
the B<TID> of the source task and the message B<tag>.  For
example, 

	$tag = 999;
	Parallel::Pvm::recv($stid,$tag) ;

Other message passing functions that you may find useful are 
B<Parallel::Pvm::psend>, B<Parallel::Pvm::trecv>, B<Parallel::Pvm::nrecv> and B<Parallel::Pvm::precv>.  

=head2 Parallel I/O 

Note that the file descriptors in a parent task are not
inherented in the spawned B<children> tasks unlike B<fork>.  
By default any file I/O will be performed in the working 
directory specified in the B<hostfile> if no 
absolute path was provided for the opened file.  
If no working directory is specified, the default is the 
B<$HOME> directory.  For directories which are not NFS mounted, 
this would mean that each task performs its own separate 
I/O.  

In the case of B<tty> output, tasks which are not 
started from the command prompt will have their 
B<stdout> and B<stderr> directed to the file pvml.<uid>.  
This may be redirected to a B<parent> task by 
calling 

	Parallel::Pvm::catchout;

for B<stdout> or 

	Parallel::Pvm::catchout(stderr);

for B<stderr>.   You can direct the B<stdout> or B<stderr> output 
of a task to another B<TID> , other then its parent, by calling 

	Parallel::Pvm::setopt(PvmOutTid,$tid);

=head2 Incorporating fault tolerance

The function B<Parallel::Pvm::notify> can be used to incorporate some 
fault tolerance into your PVM application.  
You may use it to ask the PVM 
to monitor the liveliness of a set of hosts or tasks
during the execution of a PVM application. 
For example you can instrument 
your application to monitor 3 tasks with B<TID> B<$task1>, 
B<$task2>, and B<$task3>, by using the code segments 

	@monitor = ($task1,$task2,$task3);
	Parallel::Pvm::notify(PvmTaskExit,999,@monitor_task);
	...

	if ( Parallel::Pvm::probe(-1,999) ){
	   $task = Parallel::Pvm::recv_notify ;
	   print "Oops! task $task has failed ... \n" ; 
	}

If either B<$task1>, B<$task2> or B<$task3> 
fails,  the notification will take the form of 
a single message with the 
tag 999.  The message content will inform you of 
the B<TID> of the failed task.  

A similar scheme may be employed for the notification of host 
failures in your parallel virtual machine.  

=head2 Client/Server example

B<Client:>

	use Pvm;
	use File::Basename;
	...

	# Look for server tid and assume 
	# server name is 'service_provider'

	@task_list = Parallel::Pvm::tasks ;
	foreach $task (@task_list){
	   $a_out = $task->{'ti_a_out'} ;
	   $base = basename $a_out ;
	   if ( $base eq 'service_provider' )
		$serv_tid = $task->{'ti_tid'} ;
	}

	# This is just one way (not necessarily the
	# best) of getting a server tid.
	# You could do the same thing by reading 
	# the server tid posted in a file. 

	...
	
	# send request for service
	Parallel::Pvm::send($serv_tid,$REQUEST);

	# receive service from server
	Parallel::Pvm::recv(-1,$RESPONSE);
	@service_packet = Parallel::Pvm::unpack ;
	...

B<Server:>

	while(1){
	   ...

	   if ( Parallel::Pvm::probe(-1,$REQUEST) ){

	      # a service request has arrived !
	      $bufid = Parallel::Pvm::recv ;
	      ($info,$bytes,$tag,$stid) = Parallel::Pvm::bufinfo($bufid) ;

	      if ( fork == 0 ){
	         # fork child process to handle service
	         ...
 
	         # provide service
	         Parallel::Pvm::initsend ;
	         Parallel::Pvm::pack(@service);
	         Parallel::Pvm::send($stid,$RESPONSE);
	         
	         # exit child process
	         exit ;
	      }
	   }	   
	   ...
	
	}

=head2 PVM groups 

The PVM dynamic group functions have not been ported to perl yet.  
These functions provide facilities for collecting processes under 
a single B<group> label, and applying aggregate operations onto 
them.  Examples of these functions are B<Parallel::Pvm::barrier>, B<Parallel::Pvm::reduce>, 
B<Parallel::Pvm::bcast> etc.  
One of our concerns is that these group functions may be 
changed or augmented in the future releases of PVM 3.4*. A decision 
for porting the group functions will be made after 
PVM 3.4 has been released.  

=head1 FUNCTIONS

=over 4

=item B<Parallel::Pvm::addhosts> 

Adds one or more host names to a parallel virtual machine. Eg.

	$info = Parallel::Pvm::addhosts(@host_list) ;

=item B<Parallel::Pvm::bufinfo>

Returns information about the requested message buffer. Eg.

	($info,$bytes,$tag,$tid) = Parallel::Pvm::bufinfo($bufid);

=item B<Parallel::Pvm::catchout>

Catches output from children tasks.  Eg.

	# Parallel::Pvm::catchout(stdout);
	$bufid = Parallel::Pvm::catchout; 

=item B<Parallel::Pvm::config>

Returns information about the present virtual machine configuration. Eg.

	($info,@host_ref_list) = Parallel::Pvm::config ;

=item B<Parallel::Pvm::delhosts>

Deletes one or more hosts from the virtual machine. Eg.

	$info = Parallel::Pvm::delhosts(@host_list);

=item B<Parallel::Pvm::exit>

Tells the local PVM daemon that the process is leaving.  Eg.

	$info = Parallel::Pvm::exit ;

=item B<Parallel::Pvm::freebuf>

Disposes of a message buffer. Eg.

	$info = Parallel::Pvm::freebuf($bufid);

=item B<Parallel::Pvm::getopt>

Shows various libpvm options.  Eg.

	$val = Parallel::Pvm::getopt(PvmOutputTid);
	$val = Parallel::Pvm::getopt(PvmFragSize);

=item B<Parallel::Pvm::getrbuf>

Returns the message buffer identifier for the active receive buffer. Eg.

	$bufid = Parallel::Pvm::getrbuf ;


=item B<Parallel::Pvm::getsbuf>

Returns the message buffer identifier for the active send buffer.  Eg. 

	$bufid = Parallel::Pvm::getsbuf ;

=item B<Parallel::Pvm::halt>

Shuts down the entire PVM system. Eg. 

	$info = Parallel::Pvm::halt ;

=item B<Parallel::Pvm::hostsync>

Gets time-of-day clock from PVM host. Eg.

	($info,$remote_clk,$delta) = Parallel::Pvm::hostsync($host) ;

where B<delta> is the time-of-day equivalent to B<local_clk - remote_clk>. 

=item B<Parallel::Pvm::initsend>

Clears default send buffer and specifies message encoding. Eg.

	# Parallel::Pvm::initsend(PvmDataDefault) ;
	$bufid = Parallel::Pvm::initsend

=item B<Parallel::Pvm::kill>

Terminates a specified PVM process.

	$info = Parallel::Pvm::kill($tid);

=item B<Parallel::Pvm::mcast>

Multicast the data in the active message buffer to a set of tasks.  Eg.

	$info = Parallel::Pvm::mcast(@tid_list,$tag);

=item B<Parallel::Pvm::mkbuf>

Creates a new message buffer. Eg.

	# Parallel::Pvm::mkbuf(PvmDataDefault);
	$bufid = Parallel::Pvm::mkbuf ;

	$bufid = Parallel::Pvm::mkbuf(PvmDataRaw);

=item B<Parallel::Pvm::mstat>

Returns the status of a host in the virtual machine.  Eg. 

	$status = Parallel::Pvm::mstat($host);

=item B<Parallel::Pvm::mytid>

Returns the tid of the calling process.

	$mytid = Parallel::Pvm::mytid ;

=item B<Parallel::Pvm::notify>

Requests notification of PVM events. Eg.

	$info = Parallel::Pvm::notify(PvmHostDelete,999,$host_list);

	# turns on notification for new host
	$info = Parallel::Pvm::notify(PvmHostAdd);

        # turns off notification for new host
	$info = Parallel::Pvm::notify(PvmHostAdd,0);

=item B<Parallel::Pvm::nrecv>

Nonblocking receive.  Eg.

	# Parallel::Pvm::nrecv(-1,-1);
	$bufid = Parallel::Pvm::nrecv ;

	# Parallel::Pvm::nrecv($tid,-1);
	$bufid = Parallel::Pvm::nrecv($tid) ;

	$bufid = Parallel::Pvm::nrecv($tid,$tag) ;

=item B<Parallel::Pvm::pack>

Packs active message buffer with data. Eg.

	$info = Parallel::Pvm::pack(@data_list);

=item B<Parallel::Pvm::parent>

Returns the tid of the process that spawned the calling process.  Eg.

	$tid = Parallel::Pvm::parent ;

=item B<Parallel::Pvm::perror>

Prints the error status of the las PVM call.

	$info = Parallel::Pvm::perror($msg);

=item B<Parallel::Pvm::precv>

Receives a message directly into a buffer.  

	# Parallel::Pvm::precv(-1,-1);
	@recv_buffer = Parallel::Pvm::precv ;

	# Parallel::Pvm::precv($tid,-1);
	@recv_buffer = Parallel::Pvm::precv($tid);

	@recv_buffer = Parallel::Pvm::precv($tid,$tag);

Note that the current limit for the receive buffer is 100 KBytes.  

=item B<Parallel::Pvm::probe>

Checks whether a message has arrived.  Eg.

	# Parallel::Pvm::probe(-1,-1);
	$bufid = Parallel::Pvm::probe ;

	# Parallel::Pvm::probe($tid,-1);
	$bufid = Parallel::Pvm::probe($tid);

	$bufid = Parallel::Pvm::probe($tid,$tag);

=item B<Parallel::Pvm::psend>

Packs and sends data in one call.  Eg.

	$info = Parallel::Pvm::psend($tid,$tag,@send_buffer);

=item B<Parallel::Pvm::pstat>

Returns the status of the specified PVM process.  Eg.

	$status = Parallel::Pvm::pstat($tid);

=item B<Parallel::Pvm::recv>

Receives a message.  Eg.

	# Parallel::Pvm::recv(-1,-1);
	$bufid = Parallel::Pvm::recv ;

	# Parallel::Pvm::recv($tid,-1);
	$bufid = Parallel::Pvm::recv($tid) ;

	$bufid = Parallel::Pvm::recv($tid,$tag);

=item B<Parallel::Pvm::recvf>

Redefines the comparison function used to accept messages.  Eg.

	Parallel::Pvm::recvf(\&new_foo);

=item B<Parallel::Pvm::recv_notify>

Receives the notification message initiated by B<Parallel::Pvm::notify>.  This 
should be preceded by a B<Parallel::Pvm::probe>.  Eg.

	# for PvmTaskExit and PvmHostDelete notification
	if ( Parallel::Pvm::probe(-1,$notify_tag) ){
		$message = Parallel::Pvm::recv_notify(PvmTaskExit) ;
	}

	# for PvmHostAdd notification
	@htid_list = Parallel::Pvm::recv_notify(PvmHostAdd);

=item B<Parallel::Pvm::recvf_old>

Resets the comparison function for accepting messages to the 
previous method before a call to B<Parallel::Pvm::recf>.  

=item B<Parallel::Pvm::reg_hoster>

Registers this task as responsible for adding new PVM hosts.  Eg.

	$info = Parallel::Pvm::reg_hoster ;

=item B<Parallel::Pvm::reg_rm>

Registers this task as a PVM resource manager.  Eg.

	$info = Parallel::Pvm::reg_rm ;

=item B<Parallel::Pvm::reg_tasker>

Registers this task as responsible for starting new PVM tasks.  Eg.

	$info = Parallel::Pvm::reg_tasker ;

=item B<Parallel::Pvm::send>

Send the data in the active message buffer.  Eg.  

	# Parallel::Pvm::send(-1,-1);
	$info = Parallel::Pvm::send ;

	# Parallel::Pvm::send($tid,-1);
	$info = Parallel::Pvm::send($tid);

	$info = Parallel::Pvm::send($tid,$tag);

=item B<Parallel::Pvm::sendsig>

Sends a signal to another PVM process.  Eg.

	use POSIX qw(:signal_h);
	...

	$info = Parallel::Pvm::sendsig($tid,SIGKILL);

=item B<Parallel::Pvm::setopt>

Sets various libpvm options.  Eg.

	$oldval=Parallel::Pvm::setopt(PvmOutputTid,$val);

	$oldval=Parallel::Pvm::setopt(PvmRoute,PvmRouteDirect);

=item B<Parallel::Pvm::setrbuf> 

Switches the active receive buffer and saves the previous buffer.  Eg.

	$oldbuf = Parallel::Pvm::setrbuf($bufid);

=item B<Parallel::Pvm::setsbuf>

Switches the active send buffer.  Eg.

	$oldbuf = Parallel::Pvm::setsbuf($bufid);

=item B<Parallel::Pvm::spawn>

Starts new PVM processes.  Eg.

	# Parallel::Pvm::spawn("compute.pl",4,PvmTaskDefault,"");
	($ntask,@tid_list) = Parallel::Pvm::spawn("compute.pl",4);

	($ntask,@tid_list) = Parallel::Pvm::spawn("compute.pl",4,PvmTaskHost,"onyx");

	($ntask,@tid_list) = Parallel::Pvm::spawn("compute.pl",4,PvmTaskHost,"onyx",argv);

=item B<Parallel::Pvm::tasks>

Returns information about the tasks running on the virtual machine. Eg.

	# Parallel::Pvm::tasks(0); Returns all tasks
	($info,@task_list) = Parallel::Pvm::tasks ;

	# Returns only for task $tid 
	($info,@task_list) = Parallel::Pvm::tasks($tid) ;
	

=item B<Parallel::Pvm::tidtohost>

Returns the host ID on which the specified task is running.  Eg.

	$dtid = Parallel::Pvm::tidtohost($tid);

=item B<Parallel::Pvm::trecv>

Receive with timeout.  Eg.

	# Parallel::Pvm::trecv(-1,-1,1,0); time out after 1 sec
	$bufid = Parallel::Pvm::trecv ;

	# time out after 2*1000000 + 5000 usec 	
	$bufid = Parallel::Pvm::trecv($tid,$tag,2,5000);


=item B<Parallel::Pvm::unpack>

Unpacks the active receive message buffer.  Eg.

	@recv_buffer = Parallel::Pvm::unpack ;

=back

=head1 AUTHOR

Edward Walker, edward@nsrc.nus.sg,
National Supercomputing Research Centre, Singapore

=head1 SEE ALSO

perl(1), pvm_intro(1PVM)

=cut


------------------------------

Date: Wed, 05 Feb 1997 09:14:44 +0100
From: Peter Stein <Peter@TB408.deta.de>
Subject: perl5.003 on HPUX 9.x MC68000 machines
Message-Id: <32F84174.5A5C@TB408.deta.de>

Hi there,

I'm new to this group, and perhaps this has been answered zillions
of times before. But then again, just mail me back the answer right
from the cellar of the archives :)

I've got a big problem compiling perl5.003 (up to patchlevel _11)
on my HP machines running HPUX 9.0x. These are MC68000 based machines
(series 9000/[3|4}xx. 

I tried gcc-2.7.2.1, resulting in bad configurations,
as not finding accept() or vprintf() system calls and not getting
compiled many files.

I also tried the HP-C compiler, which configured everything right
(as far as I can tell :|), but chocked on the optimizing flags
and didn't compile the POSIX part.

So if anyone got this problem solved before, please let me know.
You will reach me per e-mail at 

peter@deta.de

or if that doesn't work because of some reverse DNS problems we noticed
lately, at

peter@stein.harz.de

Answeres posted to the group will also get noticed :))


Thanks in advance


------------------------------

Date: 5 Feb 1997 12:07:28 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: space stripping
Message-Id: <5d9t60$mu2@news-central.tiac.net>

In article <6li8d5.q05.ln@localhost>, Tad McClellan <tadmc@flash.net> wrote:

[about the hip owls book, Mastering Regular Expressions by Jeffrey Friedl]

>I've checked for it several times at Borders and Book Stop. Neither
>even could tell that it was a book in print...

Softpro (my local bookstore) has it, it's a shame that they have so few
branches as they keep a pretty good selection of books.  MRE even makes it
onto their best sellers list for Denver
(http://www.ishops.com/softpro/denver.html)  It's worthwhile checking out
www.softpro.com, I've never mail ordered from them 'cos they're so close
to one of my favourite CD stores that I'm in there quite often...

Sorry for the lack of perl content,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


------------------------------

Date: 05 Feb 1997 10:54:58 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
Subject: Re: URL Encoding
Message-Id: <JFRIEDL.97Feb5195458@tubby.nff.ncl.omron.co.jp>


Abigail  <abigail@ny.fnx.com> wrote:
|> ++ Neal Kaiser <icculus@student.umass.edu> wrote:
|> ++ |> How would I ENCODE a URL, much like the way netscape does when your
|> ++ |> form input type is GET??
|> ++ |
|> ++ |> But, I can't seem to reverse this to encode it.  I know how to reverse
|> ++ |> the first step, but the second one is giving me problems.
|> ++ 
|> ++ I use:
|> ++     $text =~ s/([^\w])/sprintf("%%%02x", ord($1))/ge;
|> ++ 
|> ++ It's a bit overzealous in that it encodes things that don't need to
|> ++ be, but it doesn't hurt.
|> 
|> Oh sure it *does* hurt. Some characters do have a special meaning, and
|  [blah blah blah]

I guess, Abigail, that I didn't state the assumptions that I felt were
obvious. You apply it only to the form data as you build the URL to be
sent.

Sorry if this confused anyone else.

	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@omron.co.jp> Omron Corp, Nagaokakyo, Kyoto 617 Japan
O'Reilly & Associates' _Mastering Regular Expressions_
                                   http://enterprise.ic.gc.ca/~jfriedl/regex/




------------------------------

Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V7 Issue 898
*************************************

home help back first fref pref prev next nref lref last post