[6259] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 881 Volume: 7

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

Date: Sat, 1 Feb 97 19:00:21 -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: 881

Today's topics:
     *** The Perl Journal *** (Jon Orwant)
     Re: 5.002 dies silently on failed socket write (Mark-Jason Dominus)
     Re: Bug ? in Perl 5.003 for linux - or just me ?? (Christopher Burke)
     Re: Control several programs <rootbeer@teleport.com>
     Re: DOS: Must I stay on clunky old Perl v3.2? <dean@tbone.biol.sc.edu>
     Re: hard problem <rootbeer@teleport.com>
     Re: How do I strip out all characters including newline <rootbeer@teleport.com>
     Re: How to use perl (Nathan V. Patwardhan)
     Re: I need a message board... (Icculus)
     Javascript => perl <tjinks@wwa.com>
     Re: Javascript => perl <tjinks@wwa.com>
     Re: Malformed Header (Icculus)
     NT Semaphores w/ PERL 5.003 (Stephen R. Morley)
     Perl FORMAT question <chris@ixlabs.com>
     Re: Question Regarding Pipes+Communication (Icculus)
     Re: Question (Nathan V. Patwardhan)
     Re: Question (Nathan V. Patwardhan)
     Reading numbers from file.. (Juha Hartikainen ia201)
     Really, really BIG files with MacPerl <megason@fas.harvard.edu>
     saving problem <max@amagicstore.com>
     Re: saving problem <rootbeer@teleport.com>
     Re: saving problem (Nathan V. Patwardhan)
     Statistics for comp.lang.perl.misc (Greg Bacon)
     Re: uuencoding <rootbeer@teleport.com>
     Win32::ODBC in Win95 <sanjays@earthlink.net>
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)

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

Date: 01 Feb 1997 19:59:34 GMT
From: orwant@fahrenheit-451.media.mit.edu (Jon Orwant)
Subject: *** The Perl Journal ***
Message-Id: <ORWANT.97Feb1145934@fahrenheit-451.media.mit.edu>


	  The Perl Journal is a quarterly, printed magazine
		     devoted to All Things Perl.

			    http://tpj.com

       Issue #5 is speeding toward press, and will be mailed in
	mid-late March.  Now would be a good time to subscribe
	    if you don't want to order it as a back issue.

Some heartfelt testimonials:

    "Do yourself a favor and subscribe."
                                                     -SunExpert magazine

    "My first issue of The Perl Journal (vol 1 issue 2) is the best
    single issue of a technical journal I have read. Congratulations to
    all contributors and editors on the great work." 

                                                          -Andrew Duncan

    "...a really hot magazine..."
						    -HotWired, in Packet

    "The Perl Journal outsells WiReD here. It is certainly one of our
    top 5 selling periodicals, and probably one of our top 2...Issue #2
    was the best selling magazine in our four-and-a-half year
    history of selling magazines."

                                -Ray from Quantum Books of Cambridge, MA 

    "By the way I have read from cover to cover both of your
    publications. They have helped me unbelievably at work. Now
    people believe I can do most anything with Perl.  Keep up the
    good work."

                                                             -Doug Spore 


			  Table of Contents

Issue #5 (titles tentative):
     Programming like you mean it: Pattern Languages
     In Sync With Your Data (Understanding Regular Expressions)
     DBI - The Database Interface for Perl 5
     Perl/Tk: Signals, Sockets, and Pipes
     Creating Surreal HTML Pages With The Mangler
     Perl News / New Modules
     $question = $to_be or not $to_be; Perl in a Shakespeare Ensemble
     Perl and the X protocol
     PDL: The Perl Data Language
     Perl And Nuclear Weapons Don't Mix

Issue #4:		
     A Subjective Look at Object Oriented Programming
     Best of Both Worlds: Embedding Perl in C
     The LWP Library: CGI Programming
     use Lovecraft qw(cthulhu necronomicon)
     New Modules
     Randomness
     Understanding Regular Expressions
     The Grid Geometry Manager: Perl/Tk Programming
     The Perl Purity Test
     Using Usenet from Perl

Issue #3:
     Data Hiding
     Perl, Politics, and Pairwise Voting
     CGI Scripts and Cookies
     Penguin: The First Tentative Waddle
     New Modules
     Perl/Tk: Events and Other Things
     FTP: File Transfer Using Perl
     Understanding Regular Expressions
     The Perl Institute
     Obfuscated Perl Contest Results

Issue #2:
     How Perl Saved The Human Genome Project
     The Perl Compiler
     Penguin: Java Done Right
     MacPerl
     Perl And The Tk Toolkit: The Mouse Odometer
     Saving State with CGI.pm
     Understanding Regular Expressions
     Results of the Prisoner's Dilemma
     Obfuscated Perl Contest

Issue #1:
     Wherefore Art, Thou?
     Perl And The Tk Toolkit
     Creating, Processing, And Sending Mail From Perl
     HTML Hacking with Regular Expressions
     Programming For The Web: CGI.pm
     The Prisoner's Dilemma

Prices: $18 U.S., $25 international.  Back issues are $7 ($9 non-U.S.)
and are mailed within a week via first-class/air-mail.  All back
issues are available.  For now.  

TPJ accepts checks, money orders, VISA, and MasterCard, but
operates on *prepayment only* -- we have neither the time nor
the money to send out individual invoices.  There's an order form at 
http://tpj.com/tpj/subscription_form for postal orders.  Our address:

			   The Perl Journal
			     P.O. Box 54
			   Boston MA 02101
				 USA

You can order via e-mail by sending your name, address,
VISA/MasterCard number (preferably encrypted with the PGP key on our
web page) and expiration date to subscriptions@tpj.com.

Enjoy the magazine, and a big thank you to all subscribers and 
authors for their support!

And an apology to all subscribers named Bill.  Their first names were
s///'ed to "Billed" by some overeager subscription management software.
Moral: don't forget the \b.

-Jon

-------------------
Jon Orwant
The Perl Journal
http://tpj.com/tpj/



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

Date: 1 Feb 1997 23:19:20 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: 5.002 dies silently on failed socket write
Message-Id: <5d0j1o$d0k@picasso.op.net>
Keywords: astronomy geodesic graywacke runty

In article <5cig8v$nsa@cocoa.brown.edu>,
Keith Dreibelbis <dribbs@netspace.org> wrote:
>Last week I discovered something interesting while working on my daemon
>here at isinet.com.  If the client connected to the daemon closes the
>connection early, the daemon dies silently if it tries to write too many
>times to the closed socket...

I believe that this is because in Unix, when you write to a closed
pipe or socket, the system sends your program the PIPE signal, which
typically terminates your program.


1.  To avoid this, have your program ignore SIGPIPE:

	$SIG{PIPE} = IGNORE:

If you do this, then your program will not be terminated by the PIPE
signal; instead, the write will fail and set $! to `Broken pipe' or
some such.

2. Your other option is to use `select' on the filehandle to make sure
it is writable before you try to write to it.

3. The `-w' thing you mentioned is bizarre, and I suspect it's not doing
what you think it is doing.

4. 
>Ok, so the camel book says that "eval is the way to do all exception
>handling in Perl", so I decided to try that, but that didn't work either,

Eval can't stop the operating system if the OS decides to terminate
your program, which is probably what is happening here.  For example,

	eval { exit 0; }

still terminates the program.  When the man page says that "eval is
the way to do all exception handling in Perl", what it really means is
``eval is the best way to do application-level exception-handling in
Perl.''  But for interfereing with the OS-level exceptions, it's
useless.  The only `exceptions' it can handle are the ones generated
by Perl itself, such as those caused by `die'.

5. If the program thyat was *calling* your program were written
better, it might have said something like:

	Keith's program aborted abnormally:  Terminated by signal 13.

If you control what that perogram does, you might want to fix it to be
a little more friendly in cases like this.  Then you can find out for
sure whether my diagnosis is correct before worrying about how to
address it.  Ha ha ha.  Since when did a programmer bother to find out
the cause of a problem before trying to code up a solution to the
problem?  In my dreams.

6. 
>But signal(3) doesn't seem to indicate that a SIGPIPE causes an
>application to exit, 

That's probably because the default behavior for any application for
any signal is to exit.  There are some exceptional signals for which
this is not the case, and those may be dealt with separately.

7. Hope this is helpful.
-- 

mjd@pobox.com                                             Mark-Jason Dominus
mjd@plover.com                              Plover Systems, Philadelphia, PA



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

Date: Sat, 01 Feb 1997 23:44:17 GMT
From: C.Burke@mailbox.uq.edu.au (Christopher Burke)
Subject: Re: Bug ? in Perl 5.003 for linux - or just me ??
Message-Id: <32f3d4d2.488420938@news.uq.edu.au>

On 1 Feb 1997 03:06:51 GMT, nvp@shore.net (Nathan V. Patwardhan)
wrote:

>Christopher Burke (C.Burke@mailbox.uq.edu.au) wrote:
>
>: if I call it like
>: process_file();
>
>Are you flushing buffers properly?  $|=1; should be at the top of your
>program.

What reason would adding a loop around the main call (which gets
executed once either way) require the flush buffers, when without the
loop it does not ?

C.L.Burke


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

Date: Sat, 1 Feb 1997 18:26:00 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Peter Baasch <baasch@tu-harburg.d400.de>
Subject: Re: Control several programs
Message-Id: <Pine.GSO.3.95.970201182513.15214I-100000@linda.teleport.com>

On Sat, 1 Feb 1997, Peter Baasch wrote:

> 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.

Sounds like a good idea. Maybe you should write it in Perl. 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 17:03:13 -0500
From: Dean Pentcheff <dean@tbone.biol.sc.edu>
Subject: Re: DOS: Must I stay on clunky old Perl v3.2?
Message-Id: <x0enf0xjz2.fsf@tbone.biol.sc.edu>

jgd@cix.compulink.co.uk ("John Dallman") writes:
> Steve@starbug1.demon.co.uk (Steve Kay) wrote:
> > I've downloaded the Win32 version of Perl v5, but when I try running it
> > on my Win3.11 machine I get an error about cannot run in DOS mode.  And
> > when I run it from Windows, I get a briefly black screen, then back to
> > Windows.
> 
> It won't run on win3.11, even with the Win32S add-on. There's a good port 
> of Perl 4.036, BigPerl, in CPAN under .../CPAN/ports/msdos/perl4; the 
> alpha-test version of Perl 5.000 in the perl5 directory there seems to be 
> much better than the readme with it would lead one to believe.

Another alternative is the OS/2 port of Perl which is very
aggressively maintained by its porter.  Following is a repost of a
"recipe" I posted a little while back for getting it to work under
DOS/Win.  Hope this helps.

-Dean
 - - 
N. Dean Pentcheff   <pentcheff@acm.org>   WWW: http://tbone.biol.sc.edu/~dean/
Biological Sciences, Univ. of South Carolina, Columbia SC 29208 (803-777-3936)
PGP ID=768/22A1A015 Keyprint=2D 53 87 53 72 4A F2 83  A0 BF CB C0 D1 0E 76 C0 
Get PGP keys and information with the command: "finger dean@tbone.biol.sc.edu"

============================================================================

I recently went through the exercise of hunting for a DOS/Win Perl,
needing to write a Perl program that would run on Unix, DOS 5, and
Windows 95/NT, and be distributable (along with Perl) with a minimum
of fuss.  

I settled on Ilya Zakharevich's OS/2 port of Perl.  Yup.  It will run
on DOS and Windows systems.  It's a very full Perl port that is
aggressively maintained and kept up to date.

You'll need to tinker slightly.  Following is an outline of a recipe
that worked for me.

Grab the port from CPAN.  Start at <URL:http://www.perl.com/perl> and
look for "Software", then "Alien Ports", then "CPAN/ports", and follow
links until you get to OS/2 ports, and then the "ilyaz" directory.
Once there, look for the most recent version in a directory that looks
something like "5.003.05" (of course, that number will change as
versions get updated).  Within that is a set of zip files.  Get these
files:

                perl_aou.zip
                perl_mlb.zip
                perl_pod.zip
                perl_ste.zip
                perl_utl.zip
                plREADME.zip

Make sure you have a decent unzip utility on DOS/Win.  One that works
is Info-Zip's, which you can grab from the "arcers" directory of the
MSDOS section of the Simtel archives at oak.oakland.edu
(<URL:http://oak.oakland.edu/pub/simtelnet/msdos/arcers/unz520x.exe>).
That file will unzip into multiple files, including a good DOS unzip
program.  The reason you need a good one is that you need to unzip
into a tree, and you need to properly truncate long filenames -- that
unzipper seems to do the job properly.

OK, now that you've got the code and an unzipper, do the following to
create a Perl hierarchy (the following manipulation gets done from a
DOS window, if you're under Windows):

        cd \
        mkdir perl
        mkdir perl\bin
        mkdir perl\lib
        mkdir perl\lib\pod

Now unpack the zip files into appropriate directories.  To do that,
change directories to the target directory first, then from there,
unzip the archive files as follows:

        perl
                plREADME.zip
        perl\bin
                perl_aou.zip
                perl_utl.zip
        perl\lib
                perl_mlb.zip
                perl_ste.zip
        perl\lib\pod
                perl_pod.zip

Put the following in your autoexec.bat (carefully noting the slash
directions in the text that follows):

        set path=...your...existing...path...;c:\perl\bin
        set perllib_prefix=f:/perllib c:/perl

(I assume your perl destination is drive "c:", otherwise modify the
"c:"s above appropriately, but don't change the "f:").

Now, based on addresses in Ilya's documentation, go out and grab the
latest versions of the "emxrt" package and the "rsx" package.  Unpack
them under a temporary directory.  Copy the following files to
c:\perl\bin:

        from the emx package:
                emx.exe      [VCPI DOS extender for DOS]
                emxfpemu     [coprocessor emulator for 386sx machines]
                emxbind.exe  [emx executable load-format twiddling program]
                emxl.exe     [emx stub loader module]
        from the rsx package:
                rsx.exe      [DPMI DOS extender for Windows]

Now drop out into DOS if you're running under Windows (not a DOS
shell: if you're in Windows, kill Windows and drop to plain DOS).

Go to the c:\perl\bin directory and use emxbind to extract the a.out
module from perl_.exe, something like:

        emx emxbind.exe -x perl_.exe perl.out

Use emxbind to bind the a.out module with the emxl.exe stub:

        emx emxbind.exe emxl.exe perl.out perl.exe

Assuming that worked, you can now delete the following files:

        emxbind.exe
        emxl.exe
        perl.out
        perl_.exe
        perl5_00.exe

If you're really twitchy about a startup warning message under
Windows, you can use a hex editor or other binary editor to edit the
file "rsx.exe" so that it will not complain about the emx version
you're using.  In the file "rsx.exe", search for the string
"emx_version".  You'll find the emx version number in reverse,
something like: "emx_version=b9.0" (which really refers to emx version
number 0.9b).  Change the version number/letter to fit the emxrt
version you downloaded (in my case, recently, I changed "b9.0" to
"c9.0", which defines me as really twitchy I suppose).  Save the new
rsx.exe (must be in the filename "rsx.exe").  Then the loadtime
warning about emx versions will shut up.

Reboot your machine to let the c:\autoexec.bat changes take effect.


What have you achieved by this?  The OS/2 version will run using
either the emx.exe DOS extender (using the VCPI protocol, suitable for
"naked" DOS) or the rsx.exe extender (using the DPMI protocol,
compatible with Windows 3.x, 95 (and NT?)).  The rigamarole with
emxbind pulled out the core executable and rebound it with a stub
loader that will automatically and transparently find and use the
emx.exe extender in plain DOS, and the rsx.exe extender under Windows
(as long as they're in a directory on the PATH).  Setting the
emxlib_prefix variable properly sets Perl's @INC list of where to
search for Perl libraries.

The "utility" programs in \perl\bin are set up as OS/2 "cmd" files.
You'll need to trim off the top few lines that get them to execute
under the OS/2 command interpreter.  There are magical incantations
you can do to turn them into automatically executing DOS batch files
(which I don't know), or you can create a batch file for each of them
(in the same directory) that looks something like the following (for
an example "utility.cmd" file):

@perl -S utility.cmd %1 %2 %3 %4 %5 %6 %7 %8 %9

in the file "\perl\bin\utility.bat".


And that's that!


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

Date: Sat, 1 Feb 1997 17:56:55 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: "Manolis A." <manolis@cytanet.com.cy>
Subject: Re: hard problem
Message-Id: <Pine.GSO.3.95.970201175629.15214E-100000@linda.teleport.com>

On Sat, 1 Feb 1997, Manolis A. wrote:

> any suggestions?
> i use perl 4 on AIX

Install version 5. 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: Sat, 1 Feb 1997 18:20:48 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Charles Herold <cherold@pathfinder.com>
Subject: Re: How do I strip out all characters including newlines?
Message-Id: <Pine.GSO.3.95.970201180340.15214H-100000@linda.teleport.com>

On Fri, 31 Jan 1997, Charles Herold wrote:

> I want to strip out everything in a string from </a> to <a>, but I
> can't, a problem I assume with newlines (i.e. s#</a>.*#<a># won't
> work).  

Well, that substitution says to start at </a> and remove everything
following, up to but not including a newline. Then replace all that with
<a>. Did it at least do that?

>From what you say you want, I think this is the operator for you.

   s#</a>.*?<a>##gs

But you're probably trying to do this to a file instead of a string, so
maybe this is what you're looking for. Do you see what it does?

   perl -pi.bak -e 'BEGIN {undef $/} s#</a>.*?<a>##gs' myfile

> I tried checking out the Perl FAQ mentioned in the Welcome to
> comp.lang.perl message I got, and got a "can't set guest permission" 
> message! 

For the FAQ, try this, or your favorite CPAN site.

   http://www.perl.org/CPAN/doc/FAQs/FAQ/html/

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 18:16:56 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: How to use perl
Message-Id: <5d01ao$18g@fridge-nf0.shore.net>

ehsan zarrabi (ezarrabi@direct.ca) wrote:
: How do I use a perl script? I have downloaded a perl script but I don't
: know how to use it, I mean how to call it. Do I have to add a line in my
: web page so it goes and runs the perl script or what?

(1) What platform are you using (A Unix, Mac, PC)?
(2) What's the script supposed to do?
(3) What are you trying to do / what have you done?
(4) Talk to your sysadmin about executing CGI scripts.

With the vagueness of your posting, it's really difficult to give you
any advice.

--
N 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: 2 Feb 1997 02:00:23 GMT
From: agcowan@euler.uncg.edu (Icculus)
Subject: Re: I need a message board...
Message-Id: <5d0sfn$gq9@newton.uncg.edu>

Luc Rivet (luc_r@mtl.net) wrote:
: He...

: I'm a WebMaster of a web site called NetStorm and I want to offer the
: user of the Internet a message board.  

: Can one of you tell me where or how can I find a CGI or a Perl script
: that can do that.

: Thanks for responding...

You can download the lite version of the Radiation Hyperthread at
http://www.radiation.com/hyperthread/

Hyperthread (lite) is a simplified version of the commercial
threaded discussion system, but it should serve the purpose
nicely!

You can see it in use at: 
http://www.mudconnect.com/mud-bin/discuss/discuss.cgi

-Andy Cowan
icculus@radzone.org



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

Date: Sat, 01 Feb 1997 15:54:17 -0600
From: Tommy W Jinks <tjinks@wwa.com>
Subject: Javascript => perl
Message-Id: <32F3BB88.1BAE@wwa.com>

Hello,

I have a JavaScript that must be converted to perl.  Is there a program
or script that will allow this?  If not please take a look at the
page at http://www.wwa.com/~tjinks and let me know if you know of a
similiar program written in perl.

Thanks,
Tommy

tjinks@wwa.com


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

Date: Sat, 01 Feb 1997 16:57:36 -0600
From: Tommy W Jinks <tjinks@wwa.com>
Subject: Re: Javascript => perl
Message-Id: <32F3CA60.9A8@wwa.com>

Tommy W Jinks wrote:
> 
> Hello,
> 
> I have a JavaScript that must be converted to perl.  Is there a program
> or script that will allow this?  If not please take a look at the
> page at http://www.wwa.com/~tjinks and let me know if you know of a
> similiar program written in perl.


The correct URL is http://www.wwa.com/~tjinks/jscript.html

> 
> Thanks,
> Tommy
> 
> tjinks@wwa.com


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

Date: 2 Feb 1997 01:52:06 GMT
From: agcowan@euler.uncg.edu (Icculus)
Subject: Re: Malformed Header
Message-Id: <5d0s06$gq9@newton.uncg.edu>

KeFKa (kefka@sound.net) wrote:
: What is the malformed header mean, and what part of the script is the header?
: please e-mail response


Web servers expect a certain content header when executing a CGI script.
At the least the server either needs to know the content-type to send,
a location to redirect to or a status code to use.

When a perl script contains non-fatal errors these are sent to
STDERR. The webserver is returned these Perl error messages before
the header it is expecting and so displays the malformed header error
message. Really means there is an error in the script and perl is
sending something before sending the content header. Running the
script manually in the shell should show you whats going on.

-Andy Cowan
icculus@radzone.org



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

Date: Sun, 02 Feb 1997 00:57:48 GMT
From: morleys@ix.netcom.com (Stephen R. Morley)
Subject: NT Semaphores w/ PERL 5.003
Message-Id: <5d0p5c$9t7@dfw-ixnews9.ix.netcom.com>

I have been trying to use the PERL for Win32 and using the sample
semaphore code from the docs but neither the standard semaphore nor
the mutex semaphore work. 

Standard:
   create works but the attempt to use the semaphore (Request) gets a
zero rc, implied can't access semaphore. The semaphore is created but
no access.

Mutex:
  semaphore is created but wait to wait on it returns error msg "no
such file" from $!.

Any ideas, sample code, etc would be greatly appreciated.

Stephen



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

Date: Sat, 01 Feb 1997 14:57:23 -0800
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: Perl FORMAT question
Message-Id: <32F3CA53.45EE4A5A@ixlabs.com>

I am creating a datafile for mainframe processing.
Each line must be exactly 256 characters in length.
How do I pad a FORMAT written line with spaces?

For example, If the data ends at line position 230, how do I print
the 26 spaces that must be on the end?


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

Date: 1 Feb 1997 18:57:52 GMT
From: agcowan@euler.uncg.edu (Icculus)
Subject: Re: Question Regarding Pipes+Communication
Message-Id: <5d03ng$ers@newton.uncg.edu>

Neil S. Briscoe (neilb@zetnet.co.uk) wrote:
: 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

Neil,

	I tried everything described in the camel book, but it didn't
seem to work right for what I was doing. Here is a bit more info as to
what I am trying..

I am writing a MU* server. Everything works great with exception to
data sharing (logged users, objects existing in the world, etc...).
I was hoping to create a pipe before the user process forked and
use that pipe to send back a standard set of data so that everyone
has the same variables defined. 

I played around a bit more and got a little further with the pipe
code, but now the child processes lock up when attempting to read
the piped filehandle. Is there a way to check if a filehandle has
info to read before trying to read it? That might help me, not sure.

Also, someone recommended I try Comm.pl to do what I want. I looked
all over CPAN but didn't see it. Anyone know where I can find it?

Appreciate the help Neil!
andy


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

Date: 1 Feb 1997 18:17:50 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Question
Message-Id: <5d01ce$18g@fridge-nf0.shore.net>

Triantafyllos Marakis (ceetm@cee.hw.ac.uk) wrote:
: 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.

Yes it is possible.  Why not try the LWP modules available from 
http://www.perl.com/CPAN/ ?

--
N 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: 1 Feb 1997 18:20:26 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Question
Message-Id: <5d01ha$18g@fridge-nf0.shore.net>

Nathan V. Patwardhan (nvp@shore.net) wrote:

: Yes it is possible.  Why not try the LWP modules available from 
: http://www.perl.com/CPAN/ ?

Correction.  http://www.perl.com/perl/CPAN/

--
N 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: 1 Feb 1997 21:18:47 GMT
From: jhartika@orion.pspt.fi (Juha Hartikainen ia201)
Subject: Reading numbers from file..
Message-Id: <5d0bvn$mbb@Camel.pspt.fi>

I have a huge database which is on my own format. It haves strings, which 
are easy to read with Perl. It haves also MANY floating point numbers. 
How can I read these Intel double numbers and convert 'em to string??
double is 8 bytes long floating point number.

Juha


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

Date: Sat, 01 Feb 1997 15:04:43 -0500
From: Sean Megason <megason@fas.harvard.edu>
Subject: Really, really BIG files with MacPerl
Message-Id: <32F3A155.886@fas.harvard.edu>

Hello all! I'm working on a project for which I'll need to be able
process a really big file (3 GB). I've convinced my boss to buy a big
hard drive, but I wanted to make sure that MacPerl and MacOS can handle
a file that big so I don't look like a fool if it can't. 

Does anyone know if file pointers or anything else in MacPerl or MacOS
max out at some point so that they can't handle a 3 GB file??

Thanks
Sean Megason


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

Date: Sat, 01 Feb 1997 17:30:17 -0800
From: A MAGIC STORE <max@amagicstore.com>
Subject: saving problem
Message-Id: <32F3EE29.7019@amagicstore.com>

Hi everyone !
My question is this: I programed a script in Perl using Notepad(win95)
and saved it as text document with .pl extension, but when I uploaded it
to my unix server and  execute it, it didn't work.
My server checked out the perl program and said that there are ^M s at
the end of each line of program, like I had saved it as a WP document.
How can it be possible ?? isn't Notepad suppose to save any file as text
only? I even tried to type other script, but once I upload them, they
won't work.
Any help is greatly appreciated.

Thank you.

Max


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

Date: Sat, 1 Feb 1997 18:36:51 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: A MAGIC STORE <max@amagicstore.com>
Subject: Re: saving problem
Message-Id: <Pine.GSO.3.95.970201182630.15214J-100000@linda.teleport.com>

On Sat, 1 Feb 1997, A MAGIC STORE wrote:

> I programed a script in Perl using Notepad(win95)
> and saved it as text document with .pl extension, but when I uploaded it
> to my unix server and  execute it, it didn't work.

> My server checked out the perl program and said that there are ^M s at
> the end of each line of program, like I had saved it as a WP document.

That's what Windows (DOS) does with plain text files. It saves them with
two characters at the end of every line, ^M and ^J. 

Your FTP client should have a mode for uploading text files. When it knows
it's a text file you're sending or receiving, it'll fix the line endings
for you.

Or, if you can log onto the server to use a command line, use this command
to fix your files directly. (I haven't tested this, but it makes a backup
copy.) 

    perl -pi.bak -e 's/\015\n?/\n/g' myfiles

As the last word indicates, you may use that command on a number of files
at once. As an added bonus, that should also work to fix any Macintosh
text files your friends have uploaded to the Unix machine. 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: 2 Feb 1997 02:38:47 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: saving problem
Message-Id: <5d0unn$2nq@fridge-nf0.shore.net>

A MAGIC STORE (max@amagicstore.com) wrote:
: My question is this: I programed a script in Perl using Notepad(win95)
: and saved it as text document with .pl extension, but when I uploaded it
: to my unix server and  execute it, it didn't work.

Did you do: perl <scriptname>?  Did you make the script executable?
Do you put a shebang path at the top?

: My server checked out the perl program and said that there are ^M s at
: the end of each line of program, like I had saved it as a WP document.

The ^M's shouldn't make a difference to my knowledge.  When I've tested
scripts using NTPerl (and even revised them), then transferred them to
my Unix box, the only changes necessary were those listed above.

I believe that *most* MS-DOS applications save test with line breaks
CR-LF, where Unix saves them as CR only.  I believe MS Word and others
let you save as text without line breaks.

OR, you could write a little script, called to_dos.pl that adds ^M characters
to each line, and another script called to_unix.pl that removes the ^M
characters from each line.

HTH!

--
N 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: 1 Feb 1997 19:12:30 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Statistics for comp.lang.perl.misc
Message-Id: <5d04iu$4f1@info.uah.edu>

[many changes forthcoming]

Statistics for the seven day period ending 1997/2/1:

Total number of articles: 1004
Total volume: 1686.3 kbytes

Top ten posters by number of articles:
44	4.4%	nvp@shore.net
36	3.6%	tadmc@flash.net
26	2.6%	jander@jander.com
19	1.9%	tchrist@mox.perl.com
16	1.6%	silmaril@best.com
16	1.6%	dave@fast.thomases.com
14	1.4%	rootbeer@teleport.com
14	1.4%	blm@chinook.halcyon.com
13	1.3%	mike@zeus.token.net
12	1.2%	tnocella@outland.cyberwar.com

Top ten posters by volume
154.6	9.2%	viper@buri.kuentos.guam.net
66.4	3.9%	tadmc@flash.net
58.6	3.5%	tchrist@mox.perl.com
53.7	3.2%	nvp@shore.net
36.8	2.2%	jander@jander.com
27.8	1.6%	silmaril@best.com
25.2	1.5%	mike@zeus.token.net
25.2	1.5%	dave@fast.thomases.com
20.5	1.2%	rootbeer@teleport.com
19.6	1.2%	tina@spirou.uab.ericsson.se

Top ten threads by number
14	1.4%	What about two Perl misc groups?
11	1.1%	"-i" switch is unsafe!
10	1.0%	New Group ideas: Splitting clpm
9	0.9%	Need a way to calculate a random number between 1 and 20
9	0.9%	String Length
8	0.8%	Perl problem HELP!
8	0.8%	Well, this sucks (Randal in the news again)
8	0.8%	greedy regular expressions
7	0.7%	password check
7	0.7%	Perl Enhancement to here documents

Top ten threads by volume
151.7	9.0%	ANNOUNCE: Zfilter 2.1
30.7	1.8%	perl5.004 beta
27.9	1.7%	What about two Perl misc groups?
17.4	1.0%	"-i" switch is unsafe!
16.5	1.0%	New Group ideas: Splitting clpm
15.9	0.9%	Need a way to calculate a random number between 1 and 20
14.3	0.9%	Perl problem HELP!
13.4	0.8%	Need Help in setting up a Perl script
13.3	0.8%	Well, this sucks (Randal in the news again)
11.6	0.7%	String Length

Most popular newsgroups for crossposts (by number)
21	2.1%	comp.lang.perl.modules
9	0.9%	comp.lang.perl
7	0.7%	comp.lang.perl.tk
5	0.5%	comp.unix.aix
4	0.4%	comp.lang.tcl
4	0.4%	microsoft.public.win32.programmer.kernel
4	0.4%	comp.os.ms-windows.nt.setup.misc
4	0.4%	comp.os.ms-windows.nt.misc
3	0.3%	comp.lang.perl.announce
3	0.3%	alt.computer.consultants

Articles posted to one group only:	939	93.5%
Articles crossposted to two groups:	45	4.5%
Articles crossposted to three groups:	10	1.0%
Articles crossposted to four groups:	5	0.5%
Crossposted to more than four groups:	5	0.5%


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

Date: Sat, 1 Feb 1997 09:51:14 -0800
From: Tom Phoenix <rootbeer@teleport.com>
To: Matteo Pelati <pelatimtt@poboxes.com>
Subject: Re: uuencoding
Message-Id: <Pine.GSO.3.95.970201094246.19573T-100000@linda.teleport.com>

On Sat, 1 Feb 1997, Matteo Pelati wrote:

> Newsgroups: comp.lang.perl.misc
> Subject: uuencoding
> 
> Does anyone know how to uuencode/decode to read and write the .htpasswd
> file on a server? 

Yes, and it's a lot like using a violin to pound nails, discussion of
which would also be off topic here.

If you're wanting to find out about uuencode, maybe a Unix newsgroup would
be appropriate. If you want to learn about .htpasswd files and servers,
perhaps a server newsgroup would be appropriate. 

If by chance you are wondering whether Perl can read and write .htpasswd
files, it can. Perl can read and write all kinds of files. And in fact
Perl code for parsing and producing many kinds of files can be found on
CPAN. If you don't find code to suit your needs there, you're welcome to
contribute some.

    http://www.perl.com/CPAN/

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: Sat, 01 Feb 1997 17:57:09 -0500
From: SANJAY SINGH <sanjays@earthlink.net>
Subject: Win32::ODBC in Win95
Message-Id: <32F3CA45.104@earthlink.net>

I am trying to use Win32::ODBC with Perl5 in Windows 95. As soon as I
include a statement like 'use Win32::ODBC', I get an error saying
'Cannot locate DynaLoader.pm in @INC ...'. 

I would really appreciate if someone can help me.

Thanks. 
Sanjay Singh
e-mail: sanjays@earthlink.net


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

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

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