[12044] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5643 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 13 03:07:21 1999

Date: Thu, 13 May 99 00:00:55 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 13 May 1999     Volume: 8 Number: 5643

Today's topics:
    Re: "Text file busy" error <arranp@datamail.co.nz>
    Re: [Fwd: my hands are tied] (Andrew Allen)
    Re: Better solution ? (Greg Bacon)
    Re: Better solution ? (Tad McClellan)
    Re: Can't call method "isaCGI" on unblessed reference a <jdporter@min.net>
    Re: cgi submitting a form to another server michael_555@my-dejanews.com
    Re: cgi submitting a form to another server (Charles R. Thompson)
    Re: CGI timeout in web-based listserv <nospam@atanytimeonthe.net>
    Re: change system time to mm/dd/yy format (Larry Rosler)
    Re: change system time to mm/dd/yy format (Charles R. Thompson)
    Re: change system time to mm/dd/yy format (Larry Rosler)
        comparing floating point numbers sheenk@fyi.net
    Re: comparing floating point numbers (Larry Rosler)
    Re: Conditional Search and replace solution (Larry Rosler)
    Re: Conditional Search and replace solution (Larry Rosler)
    Re: CPAN-POD & pulling my hair OUT! HELP! do the doc's  (I R A Aggie)
        Differentiating Pipe Signal sonigopi@hotmail.com
    Re: dos ^M to unix \n <jbc@shell2.la.best.com>
    Re: dos ^M to unix \n <gellyfish@gellyfish.com>
    Re: FAQ 9.10: How do I redirect to another page? <cassell@mail.cor.epa.gov>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 13 May 1999 09:40:21 +1200
From: Arran Price <arranp@datamail.co.nz>
Subject: Re: "Text file busy" error
Message-Id: <3739F545.10B5@datamail.co.nz>

<snip everything cos I couldnt find the original post>

I got this error alot, I found it was due to samba and sym links.
ie if I made symlinks to the files I wanted to edit and editted them
from win95 onto my unix platform.

When I editted the file directly I never had the text file busy errors.

Hope that helps

Arran
My opinions are my own and do not reflect those of my employer.


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

Date: 12 May 1999 19:11:21 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: [Fwd: my hands are tied]
Message-Id: <7hcjop$7ok$1@fcnews.fc.hp.com>

Greg Bartels (gbartels@xli.com) wrote:
: I wrote: 
: > sub my_tie
: > {
: >   tie $_[0],'stoplight',\$_[0],@_[1..$#_];
: > }
: > 
: > and then
: > 
: > my_tie($first,7);

: wow, thanks. I never would have figured that one out.

: theres something about the @_ variable that I'm not understanding.
: I thought it was like a stack that contained a copy of hte
: variables for subroutine call,

It's pretty simple magic :) Read all about it in perlsub:

  The array @_ is a local array, but its elements are
  aliases for the actual scalar parameters.  In particular, if an
  element $_[0] is updated, the corresponding argument is updated (or an
  error occurs if it is not updatable).  If an argument is an array or
  hash element which did not exist when the function was called, that
  element is created only when (and if) it is modified or if a reference
  to it is taken.  (Some earlier versions of Perl created the element
  whether or not it was assigned to.)  Note that assigning to the whole
  array @_ removes the aliasing, and does not update any arguments.

Andrew


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

Date: 12 May 1999 20:02:54 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Better solution ?
Message-Id: <7hcmpe$o7u$2@info2.uah.edu>

In article <7hch1l$hhs$1@nnrp1.deja.com>,
	tvn007@my-dejanews.com writes:
: Here is the problem:
: 
: To pad 2000 "X" to thousand of lines
: 
: Here is my solution
: 
: for ($number =0; $number < 2000; $number++) {
: 
:     $first_line = X.$first_line;
:     $second_line = X.$second_line;
: 
:      ...
: 
:     $thousand_line = X.$thousand_line;
: }

Hmm.. do you want a scalar with two thousand Xs?

    $val = "X" x 2000;

Do you want two thousand of such scalars?

    @a = ("X" x 2000) x 2000;

Did you have something else in mind?

: Does anyone has better solution without goes through
: the for loop.

By `better', I assume you mean more elegant.  The examples above are
more elegant, but there's still a for loop involved.  We have loops
because they offer elegant ways to express concepts.  Without the
loop (Perl's x operator is an implicit loop), we'd have no choice
but to unroll the loop and lose all our elegance in the process.

Greg
-- 
Just because I don't care doesn't meant I don't understand. 
    -- H.J.S.


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

Date: Wed, 12 May 1999 12:32:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Better solution ?
Message-Id: <qfach7.dog.ln@magna.metronet.com>

tvn007@my-dejanews.com wrote:

: Here is the problem:

: To pad 2000 "X" to thousand of lines


while (<>) {
   print 'X' if $. <= 2000;
   print;
}


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Wed, 12 May 1999 21:36:31 GMT
From: John Porter <jdporter@min.net>
Subject: Re: Can't call method "isaCGI" on unblessed reference at (eval 11) line 1.
Message-Id: <7hcs8t$rcg$1@nnrp1.deja.com>

In article <3739C009.F9D23963@genome.wi.mit.edu>,
  "Bradley W. Langhorst" <bwlang@genome.wi.mit.edu> wrote:
>
> I get a query object in the main function buy
>   $q = new CGI
>   $q->header();

You seem to be missing a semicolon at the end of the
first line.  Did you actually cut-and-paste this from your
actual code?  If this is what your code really looks like,
then try adding that missing semicolon.

Also, $q->header() returns a string.  If you want it to go
to the browser, you should print it.  I.e. you seem to be missing
a 'print'.

    $q = new CGI;
    print $q->header();  # ahhh.


Are you using perl -w?  Why not?  How about use strict?
You'll be a much better programmer for it, I assure you.


> I am passing the function ($q, $cgi_name)

You are?  To what function?



> does the $q variable get unblessed when i call funcitions in a
> perlmodule?

Not unless your computer is next to a heavy neutron source.

--
John Porter
Put it on a plate, son.  You'll enjoy it more.


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 12 May 1999 20:28:26 GMT
From: michael_555@my-dejanews.com
Subject: Re: cgi submitting a form to another server
Message-Id: <7hco91$o5i$1@nnrp1.deja.com>

In article <MPG.11a392caa4fbbfe99896a6@news>,
  design@raincloud-studios.com (Charles R. Thompson) wrote:
> [This followup was posted to comp.lang.perl.misc and a copy was sent
to
> the cited author.]
>
> In article <7hce4a$f8u$1@nnrp1.deja.com>, michael_555@my-dejanews.com
> says...
>
> > My concern is that anyone can read my LOGIN value by
> > doing a 'view source' on my page.
>
> So don't put it in the page. Make them type it... and remove it from
the
> input tags after processing.
>
> > I don't want anyone to get my LOGIN
> > id.
>
> So don't put it in the page. Make them type it... and remove it from
the
> input tags after processing.
>
> > (or this was all pointless...)?
>
> If it goes over the wire, it's accessible.
>
> maybe I just missed the point here, then again it doesn't really have
> anything to do with the NG
> --
> Charles R. Thompson
> RainCloud Studios
> "Perl. There, I said it."
>

Make them type it in? It's not their USERID, it's mine,
and it never changes. Why would I want to tell them my
USERID, and have them type it in?

I know if it goes over the wire, it can be read. I'm
just trying to keep the average Joe Surfer from doing a
'view source' and then trying to break into my account.

You think my post has nothing to do with this NG? The
last time I checked, Perl can be used to write .cgi
scripts...



--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 12 May 1999 21:04:12 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: cgi submitting a form to another server
Message-Id: <MPG.11a3b627616abc8f9896ae@news>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <7hco91$o5i$1@nnrp1.deja.com>, michael_555@my-dejanews.com 
says...

> > I don't want anyone to get my LOGIN id.
> So don't put it in the page. Make them type it... and remove it from
> the input tags after processing.
> > (or this was all pointless...)?
> Make them type it in? It's not their USERID, it's mine,
> and it never changes. Why would I want to tell them my
> USERID, and have them type it in?

ok.. semantics. Make YOU type it in. If it never changes, then you should 
have no problem remembering it. Didn't anyone ever tell you that not 
leaving userID's or passwords laying around is like the *first* step in 
security measures?

> I know if it goes over the wire, it can be read. I'm
> just trying to keep the average Joe Surfer from doing a
> 'view source' and then trying to break into my account.
 
revamp: So don't put it in the page. Type it in a textbox... and remove 
it from the input tags after processing (added to relate to Perl in some 
context) so it doesn't show up on subsequent pages.

> You think my post has nothing to do with this NG? The
> last time I checked, Perl can be used to write .cgi
> scripts...

s/think/know

Yeah... and the source of your problem is still there if you wrote it in 
Perl, C, VB, JS, Python, Pascal, Assembly, C++, Java, J++, Chinese, 
German, French, Italian, Russian, or Periwinkle from the Crayola box. 
Therefore, it's not a Perl language issue.

-- 
CT
"Perl. There, I said it."


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

Date: Wed, 12 May 1999 12:07:29 -0700
From: N <nospam@atanytimeonthe.net>
Subject: Re: CGI timeout in web-based listserv
Message-Id: <3739D171.7B4A@atanytimeonthe.net>

I can't beleive how many people don't understand this problem. I am
having the same problem.

Make a script something like this:

#!/usr/local/bin/perl

print "Content-Type: text/plain\n\n";

## how many times to loop, in this case 5 minutes

$howmanytodo = 10;

while (1) {
	print "haha this is a print\n";
	sleep 30; ## 30 seconds
	open(LOG,">>test-log-sleep.txt");
	print LOG "Loop Count= $howmanytodo\n";
	close(LOG);
	if ($howmanytodo-- < 1) {exit;}
	}

You can start it by accessing it from your browser, then you can even
press "stop" on the browser, and check with your FTP access if the log
file is still being updated. On my server sometimes it keeps going for 3
or 4 more times then quits, I assume there's some kind of time out
somewhere on the server side or some socket timeout.

You can also try accessing it from your browser, then LOG OUT completely
from your ISP connection (thus closing socket NOW), and then log back in
in a few minutes and see what happened.

Some times it keeps running sometimes it doesn't, and I noticed that if
it is running near the top of the hour 2:58 let's say, and hour rolls
over, it stops. I think they have a hourly check for running processes
that don't have a IP attached or something.

Interesting problem, and it seems like "fork" won't help (where you make
a "child" process) because it seems to need the "parent" to be running,
but SUGGESTINGS on this problem are WELCOME!! HELP!

oh, it's fun to run that script several times at once, it will do it
nicely (now you know why lock is so important).

So printing 4K at less than 120 seconds intervals at a time is a good
idea, I bet it would work, but it sucks.

I am NOT doing e-mails, so the async thing sucks. in your case you could
send the browser a refresh every 60 seconds thing, then it would call
cgi script again and again till all mails are gone. In my case this
would suck too.

I want to simply put a script "out there somewhere" (sort of like a
"fork" call) on the server, and have it run till it's done, write to a
log file or something. I come back in two days and see how it's doing.
(all done from a browser, remote web server, standard ftp - to web
server set up) ANY CLUES?

> 
> When a message is sent to a list of 800 subscribers, it takes so long to write
> out all the messages into the spool directory that there is a timeout before
> the "done" page can be written to the sender's waiting browser.


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

Date: Wed, 12 May 1999 12:19:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: change system time to mm/dd/yy format
Message-Id: <MPG.11a3741be162d769989a42@nntp.hpl.hp.com>

In article <MPG.11a38c0c622664ee9896a3@news> on Wed, 12 May 1999 
17:55:59 GMT, Charles R. Thompson <design@raincloud-studios.com> says...
 ...
>   my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)= 
> localtime(time());
> 
> print "$mon\/$mday\/$year $hour\:$min";

The default for localtime() is time().

Drop the unused trailing arguments in the call.

In modern perls, you can use 'undef' for unused arguments in the list.

MONTH off-by-one BUG (as you point out below).

Y2K BUG (as you don't point out!).

Single digits instead of zero-padding to two digits as requested.

Three superfluous backslashes.

> or...
> 
> print "the month is.. (localtime)[4])"; # 0 based though! :)

Not terribly useful to know that this month is.. 4, is it?  Here, or in 
the first print().

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 12 May 1999 20:14:58 GMT
From: design@raincloud-studios.com (Charles R. Thompson)
Subject: Re: change system time to mm/dd/yy format
Message-Id: <MPG.11a3aca1ae1c2aa9896aa@news>

In article <MPG.11a3741be162d769989a42@nntp.hpl.hp.com>, Larry Rosler 
says...
> Drop the unused trailing arguments in the call.
> In modern perls, you can use 'undef' for unused arguments in the list.

hmm.. okers.

> Y2K BUG (as you don't point out!).

I was totally oblivious until just then. Obviously I have some scripts to 
go update. :)
 
-- 
CT


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

Date: Wed, 12 May 1999 14:04:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: change system time to mm/dd/yy format
Message-Id: <MPG.11a38cbf44b67ef7989a4d@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <MPG.11a3aca1ae1c2aa9896aa@news> on Wed, 12 May 1999 20:14:58 
GMT, Charles R. Thompson <design@raincloud-studios.com> says...
> In article <MPG.11a3741be162d769989a42@nntp.hpl.hp.com>, Larry Rosler 
> says...
 ...
> > Y2K BUG (as you don't point out!).
> 
> I was totally oblivious until just then. Obviously I have some scripts to 
> go update. :)

Perl is Y2K compliant.  Some Perlers aren't.

I predict that in only a few months, the world will see many more year 
'100's than year '1900's.  We shall see...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 12 May 1999 20:05:35 GMT
From: sheenk@fyi.net
Subject: comparing floating point numbers
Message-Id: <7hcmuc$mki$1@nnrp1.deja.com>

Hi all,

I have a problem (snippet below) comparing and subsequently sorting a
hash that has floating point values.

foreach $sym (sort {sprintf("%2.5g", $hash {$a}) cmp
                    sprintf("%2.5g", $hash {$b}) } keys %hash )
     {
      print "$sym is $hash{$sym}.\n";
}

This yields the following:

SYM4 is 0.75.
SYM5 is 10.
SYM2 is 2.25.
SYM1 is 5.5.
SYM3 is 7.75.

I've tried various format statements for sprintf and can't come up with
what I think is the correct result set.  Any help is appreciated...

thanks,

kev


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: Wed, 12 May 1999 15:14:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: comparing floating point numbers
Message-Id: <MPG.11a39d138e053d55989a50@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7hcmuc$mki$1@nnrp1.deja.com> on Wed, 12 May 1999 20:05:35 
GMT, sheenk@fyi.net <sheenk@fyi.net> says...
> I have a problem (snippet below) comparing and subsequently sorting a
> hash that has floating point values.
> 
> foreach $sym (sort {sprintf("%2.5g", $hash {$a}) cmp
>                     sprintf("%2.5g", $hash {$b}) } keys %hash )
>      {
>       print "$sym is $hash{$sym}.\n";
> }
> 
> This yields the following:
> 
> SYM4 is 0.75.
> SYM5 is 10.
> SYM2 is 2.25.
> SYM1 is 5.5.
> SYM3 is 7.75.
> 
> I've tried various format statements for sprintf and can't come up with
> what I think is the correct result set.  Any help is appreciated...

Why not just compare numbers as numbers?

  foreach $sym (sort { $hash{$a} <=> $hash{$b} } keys %hash) {
        print "$sym is $hash{$sym}.\n";
  }

If you insist on doing the comparison as strings (which won't work for 
negative numbers at all), use a format that gives a fixed number of 
decimal places and equal padding, such as '%20.10f'.  The 'g' trims 
trailing zeroes, as you discovered.  But why do that at all?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 12 May 1999 13:08:07 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Conditional Search and replace solution
Message-Id: <MPG.11a37f86b50c8224989a46@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <3739c13d.178501872@news.internext.fr> on Wed, 12 May 1999 
17:58:23 GMT, Hawkwynd <hawkwynd@adelphia.net> says...
> A word of thanks to all who replied to my request for assistance with
> the following script. This segment does *exactly* what I need it to
> do, and without the assistance of the great replies I've received on
> this ng, I wouldnt have found the solution as quickly as I did.
> 
> Script psuedo:
> 
> Open each file in a directory
>  rename the file for output to a new directory
>  within each text file
>     find and remove octals 14 and 15
>     find NOTES: and delete that line if no other text on that line
>     find ASSMD MTG: L:         P:  and remove if matched exactly.
> 
>  write the new file
> 
> 
> -- My gratitue goes to those who assisted me.
> 
> script:
> 	
> foreach(@myarray) {		
> 
>   next unless /^\d{2}_(\d{4})\.txt$/i;
>       open(INF,"$file_dir/$_"); 	
>       open(OUTF,">$outdir/$1");

Did we forget to tell you ALWAYS to check your open() calls?

> 	while(<INF>) {
> 		
> 		tr/\014\015/ /d; 			

This replaces "\014" by ' ' and deletes "\015".  That's not what your 
pseudo-code says to do.

> 		if ($_ =~m/NOTES:  /s){
> 		   $_ =~s/NOTES:/ /s; 	
> 		}

This is twice as much work as necessary.  I'm sure we told you just to 
do this, which is identical:

            s/NOTES:  /   /; 	

But that replacement is not what your pseudo-code says.  I think you 
want this:

            next if /^NOTES:\s*$/;

> 		if ($_=~m/ASSMD MTG: L:         P:  /s){
> 		 
> 		   $_ =~s/ASSMD MTG: L:         P:  / /s;
> 		}

This is twice as much work as necessary.  I'm sure we told you just to 
do this, which is identical:

  		   s/ASSMD MTG: L:         P:  / /;

> 	print OUTF;
> }

But it's great that it works!

You're welcome.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Wed, 12 May 1999 22:48:35 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Conditional Search and replace solution
Message-Id: <MPG.11a4078c2aa8632989a59@nntp.hpl.hp.com>

[Posted and a courtesy copy sent.]

In article <JGs_2.242$qp.830@server1.news.adelphia.net> on Thu, 13 May 
1999 04:38:01 GMT, Hawkwynd <hawkwynd@adelphia.net> says...
> Larry Rosler wrote in message ...
> >>   next unless /^\d{2}_(\d{4})\.txt$/i;
> >>       open(INF,"$file_dir/$_");
> >>       open(OUTF,">$outdir/$1");
> >
> >Did we forget to tell you ALWAYS to check your open() calls?
> 
>     Should it then be written then as:
> 
>     open(INF,"$file_dir/$_") || die "Unable to open $file_dir/$_";
>     open(OUTF,">$outdir/$1") || die "Unable to open $outdir/$1";

Almost.  Include $! in the message:

      open(INF, "$file_dir/$_") ||
          die "Unable to open '$file_dir/$_'. $!\n";
      open(OUTF, ">$outdir/$1") ||
          die "Unable to open '$outdir/$1'. $!\n";

> >> tr/\014\015/ /d;
> >
> >This replaces "\014" by ' ' and deletes "\015".  That's not what your
> >pseudo-code says to do.
> 
>     Ok, even though it DOES do that, what should I've coded it as? I thought
> the d at the end deletes the pattern found between the / /'s ... Ok, time to
> re-read the book..

     tr/\014\015//d;

 ...
 
> Thanks again, and I'll let you know how it works out..

Good luck!

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 12 May 1999 18:53:33 GMT
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: CPAN-POD & pulling my hair OUT! HELP! do the doc's really suck this bad?
Message-Id: <slrn7jjjmc.nou.fl_aggie@stat.fsu.edu>

On Wed, 12 May 1999 11:10:39 -0700, N <nospam@atanytimeonthe.net>, in
<3739C41F.3E7C@atanytimeonthe.net> wrote:

+ I really don't want to go to each module's ".tar.gz" file and extract
+ the docs, that's a real big waste of time and doesn't allow for
+ searching within docs very well.

Try: 'perldoc perldoc'. Once you know where the .pod files are, you
can 'grep' them, as they're text files. You might even looking downloading
and installing 'perlindex'...

+ Go to the pages above and pretend like you want to know the variable
+ names and calls you can make to a module, then tell me that a idiot like
+ myself can make heads or tails of what you find.

% perldoc Net::FTP

     Net::FTP - FTP Client class

SYNOPSIS
         use Net::FTP;

         $ftp = Net::FTP->new("some.host.name");
         $ftp->login("anonymous","me@here.there");
         $ftp->cwd("/pub");
         $ftp->get("that.file");
         $ftp->quit;
[deletia]
 
+ The "Struct" I mentioned was from "C", meaning something like a "C"
+ struct, but documented so I know what the module expects.

% perldoc perlxs

NAME
     perlxs - XS language reference manual

DESCRIPTION
     Introduction

     XS is a language used to create an extension interface
     between Perl and some C library which one wishes to use with
     Perl.  The XS interface is combined with the library to
     create a new library which can be linked to Perl.  An XSUB
     is a function in the XS language and is the core component
     of the Perl application interface.

James - never had need of using the information in perlxs, but I know what
        it is...


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

Date: Wed, 12 May 1999 20:32:16 GMT
From: sonigopi@hotmail.com
Subject: Differentiating Pipe Signal
Message-Id: <7hcogg$o8u$1@nnrp1.deja.com>

I have client that connects to server that is using unix domain socket.
The client sends a request and waits for response from the server. The
problem is if server goes down while client is waiting for response,
Client should receive PIPE signal, and it does, but it also receives
PIPE  signal when it first connects to server as well. Is there any way
to differentiate between Connect PIPE signal, Broken PIPE signal , and
Pipe Error signal? Are there different Flavors of PIPE signal?

Client has the following code to handle PIPE signal:

      $SIG{PIPE} = '\&cleanUpAndExit' ;


      sub cleanUpAndExit {
           $RC =  $E_BROKEN ;  # integer code
           close (CLIENT) ;
           exit($RC) ;
      }


So when client first connects , it receives an PIPE Signal and exits.

I running this code on AIX version 4.2.1. The perl version 5.004.

Any help would be appreciated


--== Sent via Deja.com http://www.deja.com/ ==--
---Share what you know. Learn what you don't.---


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

Date: 12 May 1999 20:23:38 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: dos ^M to unix \n
Message-Id: <3739e34a$0$225@nntp1.ba.best.com>

Peter Bowen <bowen@imall.com> wrote:
> The ^M that you are seeing is /r under unix.  I'm assuming that you are
> under unix to have this problem ;) Try something like:

> 	$line =~ s/\r//;

> This will remove the carriage return and leave your newline alone.  

Won't this cause problems if the person filling out the Web form is
using a Mac? I thought I saw somewhere that the default line-ending in
the MacOS was a solo carriage return. Thus, wouldn't this work better?

$line =~ s/\r\n/\n/;  # to fix DOS line-endings
$line =~ s/\r/\n/g;   # to fix Mac line-endings

Come to think of it, couldn't the two be combined into:

$line =~ /(\r\n|\r)/\n/g;

-- 
John Callender
jbc@west.net
http://www.west.net/~jbc/


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

Date: 12 May 1999 19:36:38 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: dos ^M to unix \n
Message-Id: <7hcl86$gt$1@gellyfish.btinternet.com>

On Wed, 12 May 1999 21:50:03 +0300 Jukka Juslin wrote:
> Chris Costello wrote:
>> 
>> In article <3739969F.102C9281@ireland.sun.com>, Peter Doyle wrote:
>> > Hi,
>> >  I'm trying to substitute the ^M added to each line from a text box in a
>> > CGI form.
>> >
>> > What I have (which isn't working...)
>> >
>> > sub dos2unix
>> > { }
> 
> Well, if you are on SunOS 2.x dos2unix is implemented in the system.
> 

And of course xtod on SCO, duconv on some versions of Linux, and Tom
Christiansen's nlcvt (aka cpm2unix) everywhere ! You can probably  find
the latter via DejaNews <http://www.deja.com>.

/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>


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

Date: Wed, 12 May 1999 16:41:49 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: FAQ 9.10: How do I redirect to another page?
Message-Id: <373A11BD.5C34F354@mail.cor.epa.gov>

S Starre wrote:
> 
> I've derived an algorithm to determine if a post is off-topic:
> 
> (($author ne 'TC')||($author ne 'LW'))&&($topic ~=/^perlish$/))&&
> (print 'Hey thatz not perl!';) #note lim lw (as t->Y2K) = 0
> 
> Personally, since I spend 90% of my newstime in this group, I welcome
> the diverse postings- I think they add variety, and generally I'll read
> any snippets from tc or lw... but I realize that opinions may vary.
> 
> -S
> 
> [snip of Alan Flavell's reply to Bart Lateur's comment]

Well, I'll go out on a limb [since I'm back from vacation and feeling
refreshed] and say that many CGI programming questions are on-topic
for this ng.  When someone has Perl code with which they need help,
it shouldn't matter whether the code is for a website or RPC or
matrix singular-value decompositions.  My only personal exception
is when the code is to do something I find offensive.  ["Hi, I want
some programming help for my new porn site."  "Howdy, I want to
extract thousands of email addresses from postings of unsuspecting
people."  "HoW d0 U wRitE a pErL pRoGgiE to kRaCk a wEbsiTe?"]
Note that we've seen 2 out of 3 of these here in the last 3 weeks.

But the gray area between Perl code for webwork and web programming
which has nothing to do with Perl is sometimes remarkably hard for 
the newbie to see.  Granted, the posters here have been just as hard
on people asking off-topic questions about other issues - which is
only fair.  Still, I like that we now have kindly people like
Charles Thompson [to name but one of several now with us], who are 
willing to give out the help web wannabe's so desperately need.

This ng answers a *lot* of web-related questions.  While some of the
answers are quite abrupt, many are not.  And many of those questions
really should not be answered here, since the questioner ought to
be reading available documents.  This leads to a new suggestion:

Since many posters are totally clueless about the documentation
that comes with their installation (or their ISP's installation),
we ought to consider pointing people to
   http://www.perlmonth.com/articles//rtfm.html
{Yes, there are two double-slashes - I cut&pasted it.}
where Dave Cross has an excellent exposition on using perldoc
_et_al_. to find things in said docs.  That ought to be just as
easy as saying:

perldoc perldoc

which is much more entertaining, but considerably less helpful
for those frantically searcxhing for their first clue.

[insert Useful Work Phrase #11 here]

David 
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed 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 V8 Issue 5643
**************************************

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