[6256] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 878 Volume: 7

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 1 11:07:22 1997

Date: Sat, 1 Feb 97 08:00:31 -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           Sat, 1 Feb 1997     Volume: 7 Number: 878

Today's topics:
     Re: #ifdef in perl? <rootbeer@teleport.com>
     2 new pages / 3700+ links about Object-Orientation <manfred.schneider@rhein-neckar.de>
     Re: AIX, perl5, dynamic loading probs (R. Bernstein)
     Associative array efficiency <james.strangio@eq.gs.com>
     Can anyone help? <ng19@dial.pipex.com>
     Control several programs (Peter Baasch)
     Re: dealing w/ junk e-mail OR how to mail from perl scr (Nathan V. Patwardhan)
     Extract links and text from HTML (Kent E. Holsinger)
     Re: Extract links and text from HTML <jander@jander.com>
     Re: Filehandle: open(FILE) while{} close(FILE) (Gilles Maire)
     Re: Filehandle: open(FILE) while{} close(FILE) <jander@jander.com>
     Re: Finding weekends of a particular year? <jander@jander.com>
     Re: help with perl eof processing? (M.J.T. Guy)
     Perl Compiler: undefined sysmbol Perl_cshlen, Perl_cshn <alberty@apexxtech.com>
     Re: perl script ouput from html form (Tad McClellan)
     Re: printing to a file <hub@club-internet.fr>
     Re: problems with exec() function (Neil S. Briscoe)
     Re: Q: converting relative filenames (M.J.T. Guy)
     Re: Question Regarding Pipes+Communication (Neil S. Briscoe)
     Question (Triantafyllos Marakis)
     Re: Regexp for URL in text file (Neil Bowers)
     Re: Report and sort on a delim file field? <hub@club-internet.fr>
     Re: Report and sort on a delim file field? <jander@jander.com>
     Re: Shadow passwords <rootbeer@teleport.com>
     Re: uuencoding <jander@jander.com>
     Re: Variable Interpolation In Associative Array? <jander@jander.com>
     Re: What about two Perl misc groups? henry@no.spam.leeds.ac.uk
     wher can I get perl? <ng19@dial.pipex.com>
     Re: Win32 Buile 302 problems (Duncan Harris)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: Sat, 1 Feb 1997 07:47:45 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Vadim Parizher <Vadim.Parizher@jpl.nasa.gov>
Subject: Re: #ifdef in perl?
Message-Id: <Pine.GSO.3.95.970201073716.19573E-100000@linda.teleport.com>

On Thu, 30 Jan 1997, Vadim Parizher wrote:

> Subject: #ifdef in perl?

> I would hate to maintain two separate code versions.

You shouldn't have to. You can use the Config module to find out what's
supported at runtime, then use whatever code is needed. Or you can test
for a feature directly, something like this.

    BEGIN {
        eval { flock STDOUT, 0 };	# Should be harmless!
        $we_can_flock = $@ eq '';	# No error, if it exists.
    }

    # Then, in your code somewhere
    flock WHATEVER, 2			if $we_can_flock;
    # ...on the (hopeful) assumption that machines without
    # flock don't have to worry about concurrency. :-)

But if you're _sure_ you want to use ifdef's, you should check up -P in
perlrun(1). Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 1 Feb 1997 05:48:25 GMT
From: "Manfred Schneider" <manfred.schneider@rhein-neckar.de>
Subject: 2 new pages / 3700+ links about Object-Orientation
Message-Id: <01bc1003$abb51950$b259c5c1@cetus>


Subject:        Collection of 3700+ links about Object-Orientation
Newsgroups:     Some comp.* newsgroups related to OO 
Reply-To:       manfred.schneider@rhein-neckar.de (Manfred Schneider)
Summary:        Topics and URLs of Cetus Links
Posting-Freq.:  Monthly
Organization:   Private Site

Hello,

are you interested in a collection of more than 3700 links
about Object-Orientation? 

No ads, few graphics, fast and free access!

Main topics of the collection are:

   o   General Information and Links

   o   Distributed Objects, Business Objects, Object Request Brokers,
       ActiveX/OLE, Corba, JavaBeans/RMI, OpenDoc

   o   OOA/OOD Methods and Tools, Diagram Layout

   o   Languages, Ada, C++, Delphi, Eiffel, Java, JavaScript, 
       Modula-3, Oberon, Objective-C, Perl (new!), Python, Sather, 
       Smalltalk, Tcl/Tk (new!), VBScript, Visual Basic, Visual C++

   o   Databases, OO DBMS, OR DBMS, OR Mapping
   o   Patterns, Libraries, Frameworks
   o   Metrics, Reuse, Testing, Numerics
   o   Services and Companies

The collection runs on a server in Heidelberg, Germany.
Mirrors are available for faster access from other countries.

URL of original site:
   o   http://www.rhein-neckar.de/~cetus/software.html

URLs of mirror sites:
   o   Australia, Melbourne
       http://www.csse.swin.edu.au/manfred/software.html

   o   Austria, Vienna  
       http://www.infosys.tuwien.ac.at/cetus/software.html

   o   Brazil, RS, Porto Alegre
       http://www.intuitive.com.br/cetus/software.html

   o   Japan, Osaka  
       http://aries.ise.eng.osaka-u.ac.jp/cetus/software.html

   o   USA, IL, Chicago
       http://www.objenv.com/cetus/software.html

   o   USA, UT, Provo
       http://mini.net/cetus/software.html

I hope you will find the Cetus Links useful. 

Please feel free to send suggestions, comments, new or changed URLs.

Manfred




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

Date: 01 Feb 1997 05:01:14 -0500
From: rocky@panix.com (R. Bernstein)
Subject: Re: AIX, perl5, dynamic loading probs
Message-Id: <wihohe4rgk5.fsf@panix.com>

Dave Stagner <david_stagner@ncs.com> writes:

> 
> Unfortunately, the information in that old post didn't seem to
> help. 

That's probably because you didn't heed the suggestions. Here they are
again...

1. Fix up dl_aix.xs. I guess there'd have to be a separate file for
   AIX 3 and one for AIX 4.
2. Don't build anything dynamically. This can be specified when you run
   "Configure." Build all extensions statically. 
3. Wait until someone gets around to #1.
4. Stay with AIX 3.2.5


> this point, I can get perl itself to compile, but the dynamic libs won't
> link.  Here's what I'm getting now (ignore Netscape-imposed formatting
> damage): 
> 
> I1:/sdev/dave_tmp/perl/perl5.003> make
>         AutoSplitting perl library
> 
>         Making DynaLoader (static)
>          cc    -o perl perlmain.o libperl.a
> lib/auto/DynaLoader/DynaLoader.a  `c
> at ext.libs` -ldbm -lld -lm -lc -lbsd -lPW 
>  
>         Making utilities
>  
>         Making x2p stuff
> Target all is up to date.
> 
>         Making Fcntl (dynamic)
                       ^^^^^^^^
>         LD_RUN_PATH="" ld -o ../../lib/auto/Fcntl/Fcntl.o -bM:SRE
> -e_nostart Fcntl.o     
> 0706-244 ERROR: No entry point or export symbols were found
>          following garbage collection.
> The error code from the last failed command is 8.
> 

So it appears you are trying to make a dynamically loaded Fctnl. So #2
wasn't done. I haven't heard anything about #3, nor did you say you've
done. So did you do #1 (fix up dl_aix.xs) or were you staying with AIX
3.2.5? If sticking with 3.2.5, why are you making DynaLoader static? 

Why not start from a fresh perl and start completely from scratch?


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

Date: Fri, 31 Jan 1997 15:47:06 GMT
From: JAMES STRANGIO <james.strangio@eq.gs.com>
Subject: Associative array efficiency
Message-Id: <32F213FA.4CB4@eq.gs.com>

Does anyone know how much less efficient (if at all) it is to use
associative arrays than regular scalar variables?  I have a bunch of
cgi-script that use about 100 pseudo-global variables.  It's easy for
debugging to say 'foreach (sort keys %ARR)' and then print out these
variables.

But I noticed when I switched from perl4 to perl5, my program became
*much* slower.  Does perl5 handle associative arrays in a much less
efficient manner?  If that's the case, maybe it's best to not use the
associative array, since the only advantage I see for me over scalars is
for debugging purposes.

Thanks in advance for your help.

---
Jim Strangio
james.strangio@gs.com


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

Date: Sat, 01 Feb 1997 11:52:44 -0800
From: Glenn Johnson <ng19@dial.pipex.com>
Subject: Can anyone help?
Message-Id: <32F39F0C.6075@dial.pipex.com>

I am new to the perl programming environment, so I have a few questions..

1.  How is perl script activated?  Is it a compiled, or an interpreted 
language?

2.  What method is used to send data from a web browser to a perl script? 
  I can't seem to understand the data importing process (i.e. there is 
obviously an input string.  Normally this would be filled by a file, 
opened from a disk and redirected to the input string, but how does this 
compare to opening a direct string created from a web browser.  Where is 
the interfacing?)

Thanks in advance for your time.  I'm sure these questions are relatively 
stupid, but your comments would be gratefully appreciated.

Glenn Johnson.



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

Date: Sat, 01 Feb 1997 15:18:02 GMT
From: baasch@tu-harburg.d400.de (Peter Baasch)
Subject: Control several programs
Message-Id: <32f35e96.82374406@news.uni-hamburg.de>

Hi!
I have several instances of the same program, running
at the same time and interacting with eachother via
sockets. The instances are controlled via std[in|out],
which means till now one xterm per instance. I'd like
to have on frontend for all instances, showing a table
with their states and buttons to control them. This
should run on UNIX as on Windows-NT.

Peter.


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

Date: 1 Feb 1997 03:24:01 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: dealing w/ junk e-mail OR how to mail from perl script?
Message-Id: <5cud0h$feq@fridge-nf0.shore.net>

Phil Ptkwt Kristin (ptkwt@teleport.com) wrote:

: The plan is to write a perl script that sends a reply mail to the
: offending junk e-mailer every 2 minutes or so.  Should be simple.

Yes.  And it will simply nip you in your butt sooner or later.  :-)
Just watch ... soon your mailbox will get filled with lovenotes
from MAILER-DAEMON@your.com.  :-)

Instead of writing a "spam-spammer," why not use a mail filter, which
automatically tags any messages that haven't been received from people
on your "good list?"  It will save you way more time and trouble in the
long-run.

--
Nate Patwardhan | nvp@shore.net
"Lane, this is pure snow!  Do you have any idea what
the street value of this mountain is?"
	--Charles Demar from _Better Off Dead_


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

Date: 01 Feb 1997 09:02:35 -0500
From: kent@darwin.darwin.eeb.uconn.edu (Kent E. Holsinger)
Subject: Extract links and text from HTML
Message-Id: <x7ohe4aakk.fsf@darwin.darwin.eeb.uconn.edu>

I'm sure there's a simple answer to this somewhere on CPAN, but I
haven't been able to find it. I have a lot of outside links listed on
my web pages. I'd like to be able to provide a way for visitors to
search those links based on the text associated with them, e.g., if I
have a link like:

  <LI><A HREF="http://www.its.nbs.gov/nbs/">Biological Resources
      Division, U.S. Geological Survey</a> (formerly the National
      Biological Service)
      <img src="/QBullets/updated.gif">
      <!--(Remove 15 February 1997)--></LI> 

I'd like to be able to have a search return this link if any of the
words:

   biological, resources, division, u.s. geological survey, formerly,
   national, service

So, what I'd like to do is to write a script that will extract links
like this from my pages, and write them in a file with a format
something like

   http://www.its.nbs.gov/nbs/  <the list of words above>

If I could get PERL just to extract the link as it appears above, I
think I can handle the rest (including indexing the resulting list and
implementing the search). I started to write something to extract the
links, but then it occurred to me that someone else must have already
done it. Any ideas?

Thanks.

-- Kent

   
-- 
Kent E. Holsinger                Kent@Darwin.EEB.UConn.Edu
                                 http://darwin.eeb.uconn.edu
-- Department of Ecology & Evolutionary Biology          
-- University of Connecticut, U-43                                       
-- Storrs, CT   06269-3043                                               


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

Date: 01 Feb 1997 10:30:24 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Extract links and text from HTML
Message-Id: <915835nz.fsf@jander.com>

kent@darwin.darwin.eeb.uconn.edu (Kent E. Holsinger) writes:


> I'm sure there's a simple answer to this somewhere on CPAN, but I
> haven't been able to find it. I have a lot of outside links listed
> on

I'm sure you're right :)

> my web pages. I'd like to be able to provide a way for visitors to
> search those links based on the text associated with them, e.g., if I
> have a link like:
> 
>   <LI><A HREF="http://www.its.nbs.gov/nbs/">Biological Resources
>       Division, U.S. Geological Survey</a> (formerly the National
>       Biological Service)
>       <img src="/QBullets/updated.gif">
>       <!--(Remove 15 February 1997)--></LI> 
> 
> I'd like to be able to have a search return this link if any of the
> words:
> 
>    biological, resources, division, u.s. geological survey, formerly,
>    national, service
> 
> So, what I'd like to do is to write a script that will extract links
> like this from my pages, and write them in a file with a format
> something like
> 
>    http://www.its.nbs.gov/nbs/  <the list of words above>
> 
> If I could get PERL just to extract the link as it appears above, I
> think I can handle the rest (including indexing the resulting list and
> implementing the search). I started to write something to extract the
> links, but then it occurred to me that someone else must have already
> done it. Any ideas?

Grab the libwww-perl package from CPAN.






























-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Sat, 01 Feb 1997 10:53:06 GMT
From: Gilles.Maire@imaginet.fr (Gilles Maire)
Subject: Re: Filehandle: open(FILE) while{} close(FILE)
Message-Id: <32f41d00.4870442@news.imaginet.fr>

On 31 Jan 1997 18:39:28 -0500, kenlee@congo.morgan.com (Kenneth W.
Lee) wrote:


>#!usr/bin/perl5 -w
>
>#
># main
>#
>
>{
>    my $line;
>    my $infile = "DATA.TXT";
>
>    open ( INFILE, "<$infile" ) or die "Cannot open $infile:$!\n";
>    open ( OUTFILE, ">>$infile" ) or die "Cannot create $outfile:$!\n";
>
>    $line = <INFILE>;

@line=<INFILE> ;
>    while ( $line )
foreach (@line)
>    {
>	s/FOO/BAR/;   # any kind of parser here
#this will work because your current line is $_ 
>	print $line;
print $_ ;
>	print OUTFILE $line;
print OUTLINE $_ ;
>    }
>    close( INFILE ) or die "Can't close $infile: $!";
>    close( OUTFILE )or die "Can't close $infile: $!";
>}

Cheers


Gilles Maire
UNGI : http://www.imaginet.fr/ime


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

Date: 01 Feb 1997 10:22:43 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Filehandle: open(FILE) while{} close(FILE)
Message-Id: <enf0360s.fsf@jander.com>

kenlee@congo.morgan.com (Kenneth W. Lee) writes:

> 
> Hi all,
> 
> My environment is as follows:
> 
>   perl version: perl5
>       platform: xterm unix, SunOS Release 4.1.3 (SUN4M-CLIENT)
> 
> Question:
> I'm having some difficulty with filehandles.  I've consulted
> the _Programming Perl_ (O'Reilly, 91) and _Perl5: How-To_
> (Waite Group, 96), but still have no idea what is wrong
> with the code below (I know I could do it in a line-command,
> but I'd like to learn how to code in the most verbose but
> elegant way):

[...]

> This problematically runs an endless loop when I'd like
> it terminated upon the last line of <INFILE>.  Is there 
> something I've missed?

#!usr/bin/perl5 -w

    my $infile = "DATA.TXT";

    open ( INFILE, $infile )     or die "Cannot open $infile:$!\n";
    open ( OUTFILE, ">$infile" ) or die "Cannot create $outfile:$!\n";

    while ( <INFILE> )
    {
	s/FOO/BAR/;   # any kind of parser here
	print;
	print OUTFILE;
    }
    close( INFILE ) or die "Can't close $infile: $!";
    close( OUTFILE )or die "Can't close $outfile: $!";

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 01 Feb 1997 10:26:38 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Finding weekends of a particular year?
Message-Id: <d8uk35u9.fsf@jander.com>

idoh@cais.com writes:

Checkout the various date packages on CPAN.

> Has anyone written code or knows of one that will give all weekends for a
> particular year?
> 
> Regards,
> Haisam
> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 1 Feb 1997 12:59:26 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: help with perl eof processing?
Message-Id: <5cvene$r79@lyra.csx.cam.ac.uk>

In article <5c6mbd$m0v@gw.PacBell.COM>,
 <j4xprel@pbsrv10.isp.pacbell.com> wrote:
>########################################
>sub get_rec_a
>########################################
>{
> $rec_a_in = <file_a_fh> ;                                # get next 
>record
> chomp ;                                                  # remove 
>newline char
> &unpack_rec_a ;
>
>}

That chomp probably isn't doing what you intend  -  chomp with no argument
acts on $_ instead of $rec_in_a.


Mike Guy


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

Date: Fri, 31 Jan 1997 11:56:57 -0700
From: Al Youngwerth <alberty@apexxtech.com>
Subject: Perl Compiler: undefined sysmbol Perl_cshlen, Perl_cshname
Message-Id: <32F24079.557@apexxtech.com>

I'm trying to compile the perl compiler version alpha 3 on a linux
2.0.27 system. My system started out with a perl 5.00307 binary from
debian but I installed the latest_tar source (5.003) so I could apply
the patch for the compiler. I applied the compiler patch to perl, and
then did a make realclean; sh Configure; make; make test; make install.
Everything compiled fine.

However, when I try to compile the perl compiler, I get:

cc -c  -Dbool=char -DHAS_BOOL -O2    -DVERSION=\"a2\"
-DXS_VERSION=\"a2\" -fpic
-I/usr/lib/perl5/i486-linux/5.003/CORE  byteperl.c
byteperl.c: In function `main':
byteperl.c:52: `Perl_cshlen' undeclared (first use this function)
byteperl.c:52: (Each undeclared identifier is reported only once
byteperl.c:52: for each function it appears in.)
byteperl.c:53: `Perl_cshname' undeclared (first use this function)
make: *** [byteperl.o] Error 1

Anyone out there know what my problem is?

TIA,

Al Youngwerth
alberty@apexxtech.com


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

Date: Sat, 1 Feb 1997 09:20:41 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: perl script ouput from html form
Message-Id: <90nvc5.cv.ln@localhost>

futurecard@netstorage.com wrote:
: foreach ( @setup_fields )
: {
:   print MAIL "$_ '$FORM{$_}'\n" ;
: }

: The above is a section from my perl script that prints field values from 
: an html form to a file.  This is within a call to MAIL.  When I receive 
: the mail, the format of the data is a column - all the field values go down 
: the left side of the page.

: I would like to have the fields print out in a long string - one line 
: across the page.  I don't care about the length - I need it in this format 
:  to feed into a dtat base program.

: Any solutions?  I can email anyone the entire perl file if needed.


One solution might be: if you don't want newlines in your output,
then don't _put_ newlines in your output  ;-)

Perl is just doing what you told it to do.

Try this instead:

print MAIL "$_ '$FORM{$_}'" ;
                          ^     no newline here

--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


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

Date: Sat, 01 Feb 1997 10:10:38 +0100
From: Nicolas Hubert <hub@club-internet.fr>
To: rebecc60@pobox.upenn.edu
Subject: Re: printing to a file
Message-Id: <32F3088E.63728425@club-internet.fr>

Becky Schonfeld wrote:
> 
> Can anybody help me figure out while the following subroutine creates a
> file Master.txt that seems to have no information in it?
> 
> {open(MASTERFILE, ">Master.txt");
>  print MASTERFILE "$input{first_name}\n";
>         print MASTERFILE "$input{last_name}\n";
>         close (MASTERFILE);}
> 
> The program runs without any errors, the file is created in the same
> directory the html form and perl script are, but when I enter data in
> the form and process it the text file appears empty.

Becky,

The way your program is written, your open call might have failed and
you'll never know it. If Master.txt already exists, is empty, and you
don't have the rights to write to it, then the results of your program
will match what you describe. To check if your file is opened correctly,
use :
open(MASTERFILE, ">Master.txt") or die "Unable to open file for
output\n";

My second guess is : $input{last_name} and $input{first_name} are both
either empty or undefined. Your file will then appear empty but really
contain 2 line feeds.
Supposing your file was opened correctly, you can see if your variables
are empty or not by just printing some text before them :
print MASTERFILE "First name : $input{first_name}\n";
print MASTERFILE "Last name : $input{last_name}\n";

That way you'll see if the problem has to do with wrting to the file, or
with your variables.

HTH

Nicolas


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

Date: 1 Feb 1997 10:26:56 GMT
From: neilb@zetnet.co.uk (Neil S. Briscoe)
Subject: Re: problems with exec() function
Message-Id: <memo.970201102531.7271D@zetnet.co.uk>

In article <01bc0f4d$76270b60$97978bce@alan.garden.com>, cliff@garden.com
(Garden Escape) wrote:

>
>
> ciappi@ix.netcom.com wrote in article
> <32f169c2.704849@nntp.ix.netcom.com>...
> <snip>
>
> As you know, exec() never returns, hence (most likely) your bug.
>
> Post the code for your system() call.  blat should work just fine.
> Assuming, of course, that blat does work fine and works normally.

Never could get blat.exe to work - couldn't get smtp.pm to work either
(on NT that is, Unix is fine natch), so I blatantly hacked together
smtp.pl instead - its ugly but it works.

I used to ask people to mail me at the office for it but I've had so many
requests that I've ftp'd it off the work servers and can offer it from
here - together with a demonstration script on how to use it.

So if you want a perl library that will let your CGI's - and other NT
based perl scripts - talk native SMTP - blat (err, sorry) me a mail and
I'll MIME encode a couple of attachments in return.

Regards
Neil
 


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

Date: 1 Feb 1997 15:14:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Q: converting relative filenames
Message-Id: <5cvml2$2ig@lyra.csx.cam.ac.uk>

David Cantrell <david@diablo.eimages.co.uk> wrote:
>
>I did it thusly:
>
>while($object=~s!(.*)/[^\./]*?/\.\.(/.*)!$1$2!) {
>    # Do nothing ;-)
>}

Be warned that this won't do the right thing if there are symbolic links
around.


Mike Guy


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

Date: 1 Feb 1997 10:26:59 GMT
From: neilb@zetnet.co.uk (Neil S. Briscoe)
Subject: Re: Question Regarding Pipes+Communication
Message-Id: <memo.970201102534.7271E@zetnet.co.uk>

In article <5ct5a4$60h@newton.uncg.edu>, agcowan@euler.uncg.edu (Icculus)
wrote:

> Hey all,
>
> 	Been trying to find a way for a forked process to
> communicate with its parent, etc...
>
> Here is what I have tried:
>
> pipe(PARENT, CHILD);
>
> if ($pid = fork){
>    # do some stuff
>    close(CHILD);
>    return;
> }else{
>    # error, canot fork stuff here
> }
>
> close(PARENT);
>
> At this point I have tried printing to the CHILD (write) end
> of the pipe and have the child read from the PARENT end, however
> this doesn't seem to be working.
>
> Anyone have any suggestions, or helpful tips for me to get this
> working? I would sure appreciate any help! If so please email me
> at gmd@netmcr.com.
>

Yup - the camel book is quite specific.

After your pipe, you have two file descriptors, Parent and Child.  The
parent process should fork() and then close the Child descriptor before
attempting to write to Parent.  The child process should close Parent
before attempting to read from Child.

Hope this helps.

Regards
Neil



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

Date: Sat, 1 Feb 1997 13:45:25 GMT
From: ceetm@cee.hw.ac.uk (Triantafyllos Marakis)
Subject: Question
Message-Id: <E4xFJq.42q@cee.hw.ac.uk>

Is it possible to query remotely a CGI script (A search engine CGI script) and  get the results automatically on a file? Please email me if you have an answer  for this problem, or you have any suggestions.

P.S. I have just starting programming with perl so please do not use extreme    perl terminology.

Thanks.

--
TRIANTAFYLLOS MARAKIS
BSc in Computer Science IV
HERIOT-WATT University
Edinburgh, Scotland

Email  : ceetm@cee.hw.ac.uk
http://www.cee.hw.ac.uk/~ceetm
Address: George Burnett Hall (2.54) |   ~~~~~~~~~~~~~~~~~~~~~
         Riccarton             	  --+-- ~~~~~~~~~~~~~~~~~~~~~
         Edinburgh 		    |   ~~~~~~~~~~~~~~~~~~~~~
         EH14 4AS  		  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
         Scotland UK   	   	  ~~~~~~~~~~~~~~~~~~~~~~~~~~~




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

Date: Sat, 1 Feb 1997 11:51:56 GMT
From: neilb@cre.canon.co.uk (Neil Bowers)
Subject: Re: Regexp for URL in text file
Message-Id: <E4xAAK.Iqx@canon.co.uk>

: Bruce W. Mohler (bruce.w.mohler@cpmx.saic.com) wrote:
: Does anyone have a rather complete regular expression for recognizing a
: URL in a text file?  [...]

See Abigail's page on this:

	http://www.ny.fnx.com/abigail/Perl/url.html

neilb
--
Mind you, not as bad as the night Archie Pettigrew ate some sheep's testicles
for a bet...  God, that bloody sheep kicked him...	-- Ripping Yarns


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

Date: Sat, 01 Feb 1997 10:22:08 +0100
From: Nicolas Hubert <hub@club-internet.fr>
To: Rick Trankle <rjt@dataviews.com>
Subject: Re: Report and sort on a delim file field?
Message-Id: <32F30B40.75554604@club-internet.fr>

Rick,

sort  ($f5) won't work, because $f5 is a scalar. Therefore, ($f5) is a
one-element list.

One way to do what you want to is : (added some error checking on the
file opens - can't hurt)

#!/usr/bin/perl
$input = $ARGV[0];
$output = $ARGV[1];
open (FILE, $input) or die "Unable to open $input\n";
open (OUTPUT, ">$output") or die "Unable to open $output\n";

@serials=();
while (<FILE>) {
    ($f1, $f2, $f3, $f4, $f5)=split(/,/);
    chop ($f5);
    push @serials, $f5; # add the serial number to the @serials array
}
close FILE;

# Now @serials contains all the serial numbers from you input file

foreach $x (sort @serials) { 
    print OUTPUT "$x\n";
}
close OUTPUT;

HTH

Nicolas


Rick Trankle wrote:
> 
> Need proper sort statement below:
> 
> Want to write out one field which a contains a serial number and note
> and find duplicates.
> 
> Is there a page that has clear examples of writing such a routine?
> Tried looking at perl.com/perl/everything_to_know/sort.html but no
> help.
> 
> Running Perl 5.003 on NT 4.0.
> 
> ############################
> $input = @ARGV[0];
> $output = @ARGV[1];
> open (FILE, $input);
> open (OUTPUT, ">output");
> 
> while (<FILE>) {
> 
> ($f1, $f2, $f3, $f4, $f5)=split(/,/);
> chop ($5);
> 
> ## @sorted{$f5} = 1  ## this works but I don't want to eliminate
>                                    ## duplicates yet.
> 
> @sorted = (sort  ($f5));  ## does not work, the output is nothing
> }
>     foreach $x (sort(keys %sorted)) {
>        print OUTPUT "$x\n";
> 
> }
> 
> close (FILE);
> close (OUTPUT);
> 
> ########################
> 
> Rick


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

Date: 01 Feb 1997 10:11:37 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Report and sort on a delim file field?
Message-Id: <k9os36ja.fsf@jander.com>

rjt@dataviews.com (Rick Trankle) writes:

> 
> Need proper sort statement below:
> 
> Want to write out one field which a contains a serial number and note
> and find duplicates.
> 
> Is there a page that has clear examples of writing such a routine?  
> Tried looking at perl.com/perl/everything_to_know/sort.html but no
> help.
> 
> Running Perl 5.003 on NT 4.0.
> 
> ############################
> $input = @ARGV[0];
> $output = @ARGV[1];
> open (FILE, $input);
> open (OUTPUT, ">output");
> 
> while (<FILE>) {
> 
> ($f1, $f2, $f3, $f4, $f5)=split(/,/);
> chop ($5);
> 
> ## @sorted{$f5} = 1  ## this works but I don't want to eliminate
>                                    ## duplicates yet.
> 
> @sorted = (sort  ($f5));  ## does not work, the output is nothing
> }
>     foreach $x (sort(keys %sorted)) {
>        print OUTPUT "$x\n";
> 
> }
> 
> close (FILE);
> close (OUTPUT);
> 
> ########################

=================================================================
#!/usr/bin/perl -w

my ($outfile) = @ARGV;
chomp(my @unsorted = <DATA>);

my (@a,@b);
my @sorted = sort {
  @a = split ',', $a;
  @b = split ',', $b;
  $a[-1] cmp $b[-1];
} @unsorted;

open OUT, ">$outfile" or die "open failed for $outfile\n";

my (%keys);
foreach (@sorted) {
  @a = split ',';
  $keys{$a[-1]}++;
  print OUT "$_\n";
}

close OUT;

foreach (sort keys %keys) {
  print "DUP: $_\n" if $keys{$_} > 1;
}

__DATA__
5,5,5,5,5
4,4,4,4,4
3,3,3,3,3
3,3,3,3,3
3,3,3,3,3
2,2,2,2,2
1,1,1,1,1
0,0,0,0,0
0,0,0,0,0
0,0,0,0,0
=================================================================

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Sat, 1 Feb 1997 07:36:44 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Dan Busarow <dan@beach.net>
Subject: Re: Shadow passwords
Message-Id: <Pine.GSO.3.95.970201072710.19573D-100000@linda.teleport.com>

On Thu, 30 Jan 1997, Dan Busarow wrote:

> Does perl have a function like getspnam() to read the shadow 
> password file?  getpwnam is just returning an "x" 

As I understand it, Perl is at the mercy of your system's getpwnam(3) 
library function, which should be clever enough to find your password
file, wherever it is. If it's not that smart, see whether your vendor can
help, or you might need to code up a module to call getspnam directly. 
Good luck! 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 01 Feb 1997 10:18:49 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: uuencoding
Message-Id: <hgjw367a.fsf@jander.com>

Matteo Pelati <pelatimtt@poboxes.com> writes:

> 
> Does anyone know how to uuencode/decode to read and write the .htpasswd 
> file on a server?

Read up on the pack function in the Blue Camel.

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: 01 Feb 1997 10:13:29 -0500
From: Jim Anderson <jander@jander.com>
Subject: Re: Variable Interpolation In Associative Array?
Message-Id: <iv4c36g6.fsf@jander.com>

"Robert A. Goff" <ragoff@sandia.gov> writes:

> 
> > Is this permissible, where %FULLNAME has been defined/assigned:
> > $FULLNAME{'$store'}?  
> 
> Use double-quotes instead of single quotes.

Do NOT use quotes at all.

-- 
Jim Anderson			jander@jander.com
PGP Public Key Fingerprint:	0A 1C BB 0A 65 E4 0F CD
				4C 40 B1 0A 9A 32 68 44


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

Date: Sat, 1 Feb 1997 10:48:24 +0000 (GMT)
From: henry@no.spam.leeds.ac.uk
Subject: Re: What about two Perl misc groups?
Message-Id: <32F38F91.3793@no.spam>

> The disease is the swarm of new people who don't want to learn
> to program, they just want a spiffy web page. 

I agree with the comments that I have read on this thread.

Although I can think of reasons why perl could be split into

comp.lang.perl.misc
comp.lang.perl.ports

so that those mainly interested in unix perl do not have to 
see questions on Mac Perl, DOS Perl, Win Perl et cetera, et
cetera, I am not sure that this is the best route to take.

Few language goups have taken this route. There are comp.lang.c 
and comp.lang.java.tech, for example, but when we get to platforms
there are comp.sys.mac.programmer.help et cetera, with no mention
of a langauge. I doubt that it would be a step forward to have one
group per langauge per platform.

Just as many groups have spun off a .advocacy, not because they 
want to read the posts that go there, but so that they do not have 
them in the .misc or .system groups; I would support the formation
of one or more of

comp.lang.perl.www
comp.lang.perl.cgi

However, if there were a strong support for a .unix and a .ports
split then, reluctantly,I would support that.

The only solution that I know of to the underlying problem is to
moderate c.l.p.m, and this step does not seem to have enough
support to generate a moderator! Until this point is reached,
I suggest tinkering, or perhaps re-arranging the deckchairs.
After all, TIMTOWODI.

Ben.

ObPerl, obFaq. I am looking for Mac_Perl_510r2_src.sit.bin, what
should I be doing>


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

Date: Sat, 01 Feb 1997 15:05:48 -0800
From: Glenn Johnson <ng19@dial.pipex.com>
Subject: wher can I get perl?
Message-Id: <32F3CC4C.E70@dial.pipex.com>

Can someone tell me where I can get a copy of perl for use on my home 
computer.  I am currently learning perl, for programming scripts on my 
webserver and would like to develop them at home.  I am running a version 
of perl on my novell webserver, so I need a compatible copy.

Thanks in advance,

Glenn Johnson



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

Date: 1 Feb 1997 10:55:58 GMT
From: duncan@sapio.co.uk (Duncan Harris)
Subject: Re: Win32 Buile 302 problems
Message-Id: <memo.970201105507.80B@sapio.compulink.co.uk>

In article <32F23127.6ECB@hpl.hp.com>, karp@hpl.hp.com (Alan Karp) wrote:

> I have been using build 105 for Win32 on my NT system to build a
> client/server application.  Since select wasn't implemented in that
> version, I cludged up a work around involving ChangeNotification and
> WaitForMultipleObjects.  (The latter didn't work, but a posting here
> connected me with Cecil Hornbaker who provided a fix.)
> 
> I was quite pleased to see select supported in build 302. 
> Unfortunately, the following script gives a runtime error on the select
> under NT 3.51 but not on my HP-UX machine.
> 
>    $bits = pack("b4",join('',(1,0,0,0)));
>    print "Waiting: ";
>    $n = select($bits,undef,undef,5);
>    print "Timed out\n" unless $n;
>    chomp($r = <STDIN>) if $n;
>    print "N = ($n), read ($r)\n";


Use "" instead of undef in the select. This is a bug in the Win32 Perl 
that hopefully they will fix eventually.

Also, as of a few days ago there is now a 303 build, although I haven't 
tried it yet.

--
Duncan Harris, Sapio Design Ltd, Manchester, U.K.
~~~~~~~~~~~ mailto:duncan@sapio.co.uk ~~~~~~~~~~~
Web on CD-ROM?  Check out http://www.sapio.co.uk/


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

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 878
*************************************

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