[17086] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4498 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 2 21:05:41 2000

Date: Mon, 2 Oct 2000 18:05:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970535117-v9-i4498@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Mon, 2 Oct 2000     Volume: 9 Number: 4498

Today's topics:
    Re: 5.6.0 lib.pm changes. (Joe Smith)
        [Q]  Greedy matching across multiples lines. <apandey@u.washington.edu>
    Re: benefits of arrays over hashes(associative arrays)  (Logan Shaw)
    Re: benefits of arrays over hashes(associative arrays)  <godzilla@stomp.stomp.tokyo>
    Re: benefits of arrays over hashes(associative arrays)  (Martien Verbruggen)
    Re: benefits of arrays over hashes(associative arrays)  <godzilla@stomp.stomp.tokyo>
    Re: benefits of arrays over hashes(associative arrays)  (Logan Shaw)
        Blank line appending data to file <nige@npay.freeserve.co.uk>
        Comparing Timestamps rathmore@tierceron.com
    Re: Comparing Timestamps (Martien Verbruggen)
        Database to html script help kennethhansen@my-deja.com
    Re: die() ignores tied STDERR? (Martien Verbruggen)
    Re: die() ignores tied STDERR? (Daniel Chetlin)
    Re: die() ignores tied STDERR? (Martien Verbruggen)
    Re: Help With Script!! (Charles DeRykus)
    Re: How to access form data in CGI.pm? coughlan@gothaminteractive.com
    Re: Inserting HTML into CGI script as if it was beingin (Steve A.)
    Re: Inserting HTML into CGI script as if it was beingin (Steve A.)
    Re: Inserting HTML into CGI script as if it was beingin <bart.lateur@skynet.be>
    Re: Inserting HTML into CGI script as if it was beingin <flavell@mail.cern.ch>
    Re: Is this is Regexp bug? (Gwyn Judd)
    Re: Just Another Perl Hacker <yanick@babyl.sympatico.ca>
    Re: Module Install on Solaris 8? <elaine@chaos.wustl.edu>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 3 Oct 2000 00:37:30 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: 5.6.0 lib.pm changes.
Message-Id: <8rb9oa$12l$1@nntp1.ba.best.com>

In article <QmrB5.23$b7.2738@eagle.america.net>,
Garry Williams <garry@america.net> wrote:
>I conclude that the documentation is in error for 5.6.0.  I think that
>the behavior was deliberate in the 5.6.0 release, but I cannot find
>anything to support that opinion.  

The behaviour was not deliberate; it is a bug in lib.pm.

http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2000-08/msg00232.html

*** lib.pm      Tue Mar  7 15:33:25 2000
--- lib_new.pm  Thu Aug  3 14:17:47 2000
***************
*** 32,37 ****
--- 32,38 ----
          }
        # Put a corresponding archlib directory infront of $_ if it
        # looks like $_ has an archlib directory below it.
+       unshift(@INC, "$_/$archname") if -d "$_/$archname/auto";
        unshift(@INC, "$_/$ver") if -d "$_/$ver";
        unshift(@INC, "$_/$ver/$archname") if -d "$_/$ver/$archname";
      }
***************
*** 49,54 ****
--- 50,57 ----
      foreach (@_) {
        ++$names{$_};
        ++$names{"$_/$archname"} if -d "$_/$archname/auto";
+       ++$names{"$_/$ver"} if -d "$_/$ver";
+       ++$names{"$_/$ver/$archname"} if -d "$_/$ver/$archname";
      }
  
      # Remove ALL instances of each named directory.
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


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

Date: Mon, 2 Oct 2000 17:09:39 -0700
From: Anshuman Pandey <apandey@u.washington.edu>
Subject: [Q]  Greedy matching across multiples lines.
Message-Id: <Pine.A41.4.21.0010021657250.125038-100000@goodall2.u.washington.edu>


Hello,

I would like to match text between two delimiters and process the match to
my liking. The test program I have works, except for when the delimiter
character occurs within the delimited text as a non-delimiter.

Here is some sample text. The text delimiters are "{\mac" and "}",
respectively:


   {\mac apple banana orange pear guava kiwi grape{a} mango pear}

   {\mac apple banana orange pear guava kiwi grape{a} mango 
   pear}


The program below is supposed to grab everying between "{\mac" and the
right-most "}" and pass it to the subroutine xyz() for processing:


  while (<>) {
    s/{\\mac (.*)}/xyz()/gse;
    print;
  }

  sub xyz {
    $temp = $1;
    $temp =~ tr/aeiou/X/;
    "{\\mac $temp}";
  }


However, given the sample text, the program produces the following 
output:

   {\mac XpplX bXnXnX XrXngX pXXr gXXvX kXwX grXpX{X} mXngX pXXr}

   {\mac XpplX bXnXnX XrXngX pXXr gXXvX kXwX grXpX{X} mango 
   pear}


The first piece of text is processed properly: it accepts the right-most
brace because it finds it on the same single line.

Processing of the second piece of text ends when the program finds
"grape{a}", assuming that the right-brace is the end-delimiter. The
program refuses to match across to the next line even though I have
specified the /s option on the s/// function.

Would someone please advise me as to how I may convince my program to be
greedy? To scan across all lines until it finds the last, right-brace?

Thank you.

Regards,
Anshuman Pandey




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

Date: 2 Oct 2000 17:52:54 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <8rb3k6$3n1$1@jarlsberg.cs.utexas.edu>

In article <t4jhtscdbipjr66h290dvd8cdvohecf1ot@4ax.com>,
Bart Lateur  <bart.lateur@skynet.be> wrote:
>For example, this
>implements a quick HTML encoder:
>
>	%encode = ( '&' => '&amp;', '<' => '&lt;', '>' => '&gt;');
>	foreach (@lines) {
>	    s/([&<>])/$encode{$1}/g;
>	}
>
>Now, tell me how your creative solution with arrays can:
>
> * be so concise in the code it needs
> * work remotely as fast

Oh boy, an opportunity to play devil's advocate.  Here goes:

	@encode[map(ord, qw{ & < > })] = qw{ &amp; &lt; &gt; };
	foreach (@lines)
		{ s/([&<>])/$encode[ord($1)]/g; }

It's about as concise and probably just about as fast.

However, it takes more memory, more gymnastics, and more cheating.
(Cheating because if the indices to the array weren't guaranteed to be
between 0 and 255, I could end up using *lots* of memory, or I might
end up trying to create some kind of function to map them to smaller
values, and then I'd have to worry about whether the function might not
be one-to-one, and in the process I'd have ended up creating a hash.)

  - Logan


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

Date: Mon, 02 Oct 2000 16:02:12 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <39D913F4.EDAFC5CA@stomp.stomp.tokyo>

Henry Hartley wrote:
 
> "Godzilla!" wrote:
> > Incidently Randal, only hyphenate number
> > combinations, not number and word
> > combinations.

> > "seven syllable"
> > "one syllable"

> > This is more stylish and easier on the eyes.
 
> From Merriam-Webster:
> Main Entry: four-letter
> Function: adjective
> Date: 1897


 "Date: 1897"

 "This is more stylish and easier on the eyes."


Typical functional illiterate.


Godzilla!


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

Date: Tue, 3 Oct 2000 11:29:36 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: benefits of arrays over hashes(associative arrays) and vice versa
Message-Id: <slrn8tia3g.jr6.mgjv@martien.heliotrope.home>

On 2 Oct 2000 17:52:54 -0500,
	Logan Shaw <logan@cs.utexas.edu> wrote:
> 
> However, it takes more memory, more gymnastics, and more cheating.
> (Cheating because if the indices to the array weren't guaranteed to be
> between 0 and 255, I could end up using *lots* of memory, or I might

$ perldoc perlunicode

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Mon, 02 Oct 2000 16:04:45 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: benefits of arrays over hashes(associative arrays) and viceversa
Message-Id: <39D9148D.D69612B5@stomp.stomp.tokyo>

Jeff Pinyan wrote:
 
> On Oct 2, Henry Hartley said:
 
> >"Godzilla!" wrote:
> >> You didn't 'got tired', you 'became tired'.

> >You just don't get ^H^H^H become it do you?
 
> (Henry Hartley)++

 
You don't "understand" it do you?

Typical functional illiterates.

Godzilla!


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

Date: 2 Oct 2000 18:10:20 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: benefits of arrays over hashes(associative arrays) and viceversa
Message-Id: <8rb4ks$3qg$1@jarlsberg.cs.utexas.edu>

In article <39D9148D.D69612B5@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Jeff Pinyan wrote:
>> On Oct 2, Henry Hartley said:
>> >"Godzilla!" wrote:
>> >> You didn't 'got tired', you 'became tired'.
>
>> >You just don't get ^H^H^H become it do you?
> 
>You don't "understand" it do you?

No, we're programmers.  We don't understand things, we grok them.

Also, is

	I would like to obtain a new car.

really better than

	I would like to get a new car.

?  One may be correct, but the other isn't stilted.

  - Logan


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

Date: Mon, 2 Oct 2000 23:30:47 +0100
From: "Nige P" <nige@npay.freeserve.co.uk>
Subject: Blank line appending data to file
Message-Id: <8rb2av$iub$1@newsg1.svr.pol.co.uk>

This is a multi-part message in MIME format.

------=_NextPart_000_0053_01C02CC8.CB2ED7E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Can anyone enlighten me please....?
I am returning the contents of a file xxxx until a $ is detected.
This data is then appended into another file yyyy.

However each time this occurs I get a blank line between
the data, but I cannot see why.....

Many thanks for any input.

$login->print("type xxxx");
                    ($alertfile) =3D $login->waitfor('/\$ *$/');

                        open (LIVEFILE,">>yyyy") ||
die "Could not open file\n";
                        print LIVEFILE "$alertfile";



------=_NextPart_000_0053_01C02CC8.CB2ED7E0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV>Can anyone enlighten me please....?</DIV>
<DIV>I am returning the contents of a file xxxx until a $ is =
detected.</DIV>
<DIV>This data is then appended into another file yyyy.</DIV>
<DIV>&nbsp;</DIV>
<DIV>However each time this occurs I get a blank line between</DIV>
<DIV>the data, but I cannot see why.....</DIV>
<DIV>&nbsp;</DIV>
<DIV>Many thanks for any input.</DIV>
<DIV>&nbsp;</DIV>
<DIV>$login-&gt;print("type=20
xxxx");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
($alertfile) =3D $login-&gt;waitfor('/\$=20
*$/');<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;=20
open (LIVEFILE,"&gt;&gt;yyyy") ||<BR>die "Could not open=20
file\n";<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
print LIVEFILE "$alertfile";<BR><BR></DIV></BODY></HTML>

------=_NextPart_000_0053_01C02CC8.CB2ED7E0--



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

Date: Tue, 03 Oct 2000 00:03:25 GMT
From: rathmore@tierceron.com
Subject: Comparing Timestamps
Message-Id: <8rb7oa$j17$1@nnrp1.deja.com>

My problem:

I want to search a directory for files that are more than 7 days old
and do somthing to them.

The code I wrote to do this is completely wrong which shows how lost I
am on this one, but it is worth looking at to get a better feel for
where I left the path of good Perl programming so I'll include it below.

Any suggestions/help would be greatly appreciated!

use strict;

$dirname = 'c:/Documents/LA/';
$SECONDS_PER_DAY = 60 * 60 * 24;
$today = localtime;

opendir (DIR,$dirname) or die "can't opendir $dirname: $!";

foreach $sourcefile (@sourcefile) {
   ($modify) = (stat($sourcefile))[9];
      my $compare = ($modify + (7 * $SECONDS_PER_DAY));
      if ($compare <= $today) {
         # Do something here
      }
}


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 3 Oct 2000 11:47:25 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Comparing Timestamps
Message-Id: <slrn8tib4t.jr6.mgjv@martien.heliotrope.home>

On Tue, 03 Oct 2000 00:03:25 GMT,
    rathmore@tierceron.com <rathmore@tierceron.com> wrote:
> My problem:
> 
> I want to search a directory for files that are more than 7 days old
> and do somthing to them.
> 
> The code I wrote to do this is completely wrong which shows how lost I
> am on this one, but it is worth looking at to get a better feel for
> where I left the path of good Perl programming so I'll include it below.
> 
> Any suggestions/help would be greatly appreciated!
> 
> use strict;
> 
> $dirname = 'c:/Documents/LA/';
> $SECONDS_PER_DAY = 60 * 60 * 24;
> $today = localtime;
> 
> opendir (DIR,$dirname) or die "can't opendir $dirname: $!";
> 
> foreach $sourcefile (@sourcefile) {

Where did you fill @sourcefile? Did you forget to show us your readdir
lines? Also, if you did do a readdir somewhere, you will need to prepend
$dirname to get the full path of the file.

>    ($modify) = (stat($sourcefile))[9];
>       my $compare = ($modify + (7 * $SECONDS_PER_DAY));
>       if ($compare <= $today) {
>          # Do something here
>       }
> }

Unnecessarily complex :). And you do too much work yourself, explicitly.

Oh, and you should get in the habit of using the strict pragma and the
-w flag:

#!/usr/local/bin/perl -w
use strict;

If you are already doing that, then you should at least consider scoping
your variables a little more precisely.

For a slightly less verbose solution of the above:

opendir(D, $dir) or die "opendir $dir: $!";
my @files = grep { -M "$dir/$_" > 7 } readdir D;
closedir D;

foreach my $file (@files)
{
    # do something with "$dir/$file"
}


If, when you say 'files' above, you mean that you want to exclude
directories and other special files:

opendir(D, $dir) or die "opendir $dir: $!";
my @files = grep { -f "$dir/$_" && -M _ > 7 } readdir D;
closedir D;

modify the tests to suit your need. 
If you want to use an explicit loop, instead of the grep:

opendir(D, $dir) or die "opendir $dir: $!";
while(my $file = readdir D)
{
    next unless -f "$dir/$file" && -M _ > 7;
    # do your stuff here
}
closedir D;

You will be interested in the following documentation:

# perldoc -f -X
(to read about the various -X file tests and the special filehandle _)

# perldoc -f opendir
# perldoc -f readdir
# perldoc -f closedir
# perldoc -f grep

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Freudian slip: when you say one
Commercial Dynamics Pty. Ltd.   | thing but mean your mother.
NSW, Australia                  | 


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

Date: Mon, 02 Oct 2000 23:28:46 GMT
From: kennethhansen@my-deja.com
Subject: Database to html script help
Message-Id: <8rb5n7$h8q$1@nnrp1.deja.com>

Hi all

I need some help with a script.

I'm trying to achieve the following: a entry in a
database containing some text that I then pull
out and turn into a html page via perl. This
works fine, but now I need the text to contain
one or more variables that is determined other
places in the database, and this I can't seem to
get working.

A (naive) example would go something like this:

Database entry:
key|01
description|This is a sample text of type
{$type}, that...
type|test

Resulting html:
<P>
This is a sample text of type test, that...
</P>

Any suggestions?

TIA
Kenneth






Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 3 Oct 2000 09:21:23 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: die() ignores tied STDERR?
Message-Id: <slrn8ti2j3.jr6.mgjv@martien.heliotrope.home>

On 2 Oct 2000 14:59:08 GMT,
	Ilmari Karonen <iltzu@sci.invalid> wrote:
> In article <slrn8tgp4k.jr6.mgjv@martien.heliotrope.home>, Martien Verbruggen wrote:
> >
> >That last one looks like a bug. perl should never segfault.
> 
> Not even "unpack p => rand() while 1;"?
> 
> Sorry.  Just couldn't resist.  I know what you meant.

Heh, hadn't thought of that. But then, anything you do with syscall()
might invoke segfaults. I know your response was tongue-in-cheek, but
you do have a point. Perl still has areas where you are allowed to play
with fire.

Ok, apart from pointer abuse with unpack and passing bad stuff to
syscall, can anyone think of other things one can do from Perl (not XS
or using the Inline stuff) that causes perl to segfault?

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Little girls, like butterflies, need
Commercial Dynamics Pty. Ltd.   | no excuse - Lazarus Long
NSW, Australia                  | 


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

Date: 2 Oct 2000 22:09:57 GMT
From: daniel@chetlin.com (Daniel Chetlin)
Subject: Re: die() ignores tied STDERR?
Message-Id: <8rb13l01g0r@news2.newsguy.com>

On Mon, 2 Oct 2000 21:33:56 +1100,
 Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
[snip]
>Possibly because warn and die use perl's internal stderr, or more
>directly, the file descriptor that goes with it. warn and die are not
>implemented as Perl code, but are part of perl's internals, and
>therefore don't need to pass their control through the Perl STDERR
>filehandle, but can directly work with the stderr or file descriptor 2.

That's absolutely correct, and what I ran into.

>i don't _know_ that this is what is happening, but I can easily see that
>there is a potential large difference between STDERR and the channels
>warn and die use. Maybe there shouldn't be, but that's for the perl
>developers to decide.
[snip]
>That last one looks like a bug. perl should never segfault.  5.004_05
>acts the same as 5.005_03.

Yep, the segfault is definitely a bug.

>Let me just see what I can find in the documentation..
[snip docs for warn and die]
>Both _explicitly_ mentione STDERR, and don't use something vague like
>'standard error output' or some such thing. If the documentation can be
>taken to reflect the intention, than this misbehaviour is certainly a
>bug.
>
>However, if it's broken, it has been broken at least since version
>5.004_05, for which warn and die output also bypasses a tied STDERR. 
>You could try submitting a bug report. If nothing else, it should get
>people to decide whether this is 'correct' behaviour or not.

I did you one better ... well, sort of. I fixed two of the three bugs I
can see. Those being that aliased filehandles don't obey tied-ness, and
attempting to warn or die to a tied STDERR produces a segfault (put
simplistically). The third is that warn and die go directly to
PerlIO_stderr rather than following STDERR if it's tied. I can't decide
whether it's a doc bug or an implementation bug, and I'm not smart
enough to fix it if it's an implementation bug.

FYI, below is the mail I sent to p5p this afternoon. Thanks for your
input, Martien.

-dlc

-----

This patch really fixes two vaguely related bugs. First, if a filehandle
is aliased to a tied filehandle and then the non-tied filehandle is used,
it goes through the methods for the tied filehandle (as I believe it
should). Second, if STDERR is tied, C<warn> and C<die> produce segfaults
in bleadperl all the way back through 5.6.0. (Likewise, a perl-induced
warn or die also segfaults). This fixes that. (See the patch to the
testfile below for test cases).

It seems to me that ideally, warnings should follow STDERR even if
STDERR is tied, but that doesn't seem particularly possible right now
(or at least, I'm not smart enough to figure it out). If nothing else,
this needs documenting, as C<warn> and C<die> both claim that they print
to STDERR, which to me means that they follow it wherever it goes.

I haven't written that docpatch yet in hopes that someone will agree
with me and figure out how to make warnings go through the tied FH.

Finally, how the heck to you test C<warn>? I couldn't find an example of
it being tested in the suite. What I wanted to do was tie STDERR and
then call warn. Before this patch, that would have segfaulted. After
this patch, that would print the warning to PerlIO_stderr(), which looks
ugly in the test running. So I made a bit of a workaround, but it's
still not really testing what I want it to be.

-dlc

--- t/op/tiehandle.t	2000/10/02 08:53:02	1.1
+++ t/op/tiehandle.t	2000/10/02 21:42:52
@@ -77,7 +77,7 @@
 
 use Symbol;
 
-print "1..29\n";
+print "1..33\n";
 
 my $fh = gensym;
 
@@ -149,3 +149,19 @@
 @expect = (CLOSE => $ob);
 $r = close $fh;
 ok($r == 5);
+
+# Does aliasing work with tied FHs?
+*ALIAS = *$fh;
+@expect = (PRINT => $ob,"some","text");
+$r = print ALIAS @expect[2,3];
+ok($r == 1);
+
+{
+    use warnings;
+    # Special case of aliasing STDERR, which used
+    # to dump core when warnings were enabled
+    *STDERR = *$fh;
+    @expect = (PRINT => $ob,"some","text");
+    $r = print STDERR @expect[2,3];
+    ok($r == 1);
+}
--- pp_hot.c	2000/10/02 03:00:33	1.1
+++ pp_hot.c	2000/10/02 08:21:25
@@ -373,6 +373,7 @@
     else
 	gv = PL_defoutgv;
     if ((mg = SvTIED_mg((SV*)gv, 'q'))) {
+      had_magic:
 	if (MARK == ORIGMARK) {
 	    /* If using default handle then we need to make space to
 	     * pass object as 1st arg, so move other args up ...
@@ -396,6 +397,8 @@
     }
     if (!(io = GvIO(gv))) {
         dTHR;
+        if ((GvEGV(gv)) && (mg = SvTIED_mg((SV*)GvEGV(gv),'q')))
+            goto had_magic;
 	if (ckWARN2(WARN_UNOPENED,WARN_CLOSED))
 	    report_evil_fh(gv, io, PL_op->op_type);
 	SETERRNO(EBADF,RMS$_IFI);
--- perl.h	2000/10/02 08:47:27	1.1
+++ perl.h	2000/10/02 21:41:27
@@ -2056,6 +2056,7 @@
 
 #ifndef Perl_error_log
 #  define Perl_error_log	(PL_stderrgv			\
+				 && GvIOp(PL_stderrgv)          \
 				 && IoOFP(GvIOp(PL_stderrgv))	\
 				 ? IoOFP(GvIOp(PL_stderrgv))	\
 				 : PerlIO_stderr())



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

Date: Tue, 3 Oct 2000 11:18:05 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: die() ignores tied STDERR?
Message-Id: <slrn8ti9dt.jr6.mgjv@martien.heliotrope.home>

On 2 Oct 2000 21:59:59 GMT,
	Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
> [A complimentary Cc of this posting was NOT sent to Martien Verbruggen
> <mgjv@tradingpost.com.au>],
> who wrote in article <slrn8tgp4k.jr6.mgjv@martien.heliotrope.home>:
> > > So why aren't C<warn> or C<die> following a C<tie>-ed STDERR?
> > > 
> > >   [~] $ perl -wle'sub TIEHANDLE {bless{}} sub PRINT {print "tied"}
> > >                   tie *STDERR,"main"; warn "untied"'
> > >   untied at -e line 1.
> > 
> > Possibly because warn and die use perl's internal stderr, or more
> > directly, the file descriptor that goes with it. warn and die are not
> > implemented as Perl code, but are part of perl's internals, and
> > therefore don't need to pass their control through the Perl STDERR
> > filehandle, but can directly work with the stderr or file descriptor 2.
> > 
> > i don't _know_ that this is what is happening, but I can easily see that
> > there is a potential large difference between STDERR and the channels
> > warn and die use. Maybe there shouldn't be, but that's for the perl
> > developers to decide.
> 
> Why?  Perl developers should decide things basing on how things are
> going to be *used*.  It is the responsibility of users to bug the
> developers about not-intuitive behaviour (if the behaviour is judged
> not-intuitive by *users*). 

Yes, you are right. The above paragraph wasn't exactly clear. Later in
the post I stated more clearly what I meant: The perl developers can
decide whether or not this was _intended_ behaviour. In other words, is
this difference there by design, or not.

On the other hand, even if I had phrased it that way, you could still be
right in saying that it's not up to the perl developers to decide
whether it should stay this way :)

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I took an IQ test and the results
Commercial Dynamics Pty. Ltd.   | were negative.
NSW, Australia                  | 


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

Date: Tue, 3 Oct 2000 00:39:54 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Help With Script!!
Message-Id: <G1twII.LDE@news.boeing.com>

In article <8raitj$vtv$1@nnrp1.deja.com>,  <malatov@my-deja.com> wrote:
>When I try to run this script I get an error message:
>"Can't Locate object method "url" via package HTTP::Headers at
>...
>$response = $ua->request($request);
>$cookie_jar->add_cookie_header($response);
                                ^^^^^^^^^
                                $request

hth,
--
Charles DeRykus


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

Date: Mon, 02 Oct 2000 22:52:03 GMT
From: coughlan@gothaminteractive.com
Subject: Re: How to access form data in CGI.pm?
Message-Id: <8rb3ii$fid$1@nnrp1.deja.com>

Thanks for the help all.  In short, I'm building a web-based company
rolodex that integrates to Outlook and Netscape via OpenLDAP.

LDAP uses "$$" as it's the newline char.  After my users submits his
form, I'd like to immeadiately  s/\n/"$$"/g for all form data in the
CGI query structure.

I can do it the long way, item by item. Prior suggestions didn't work
for me.

I now need to figure out how to represent two dollars signs.  The \$
char didn't seem to work, nor did "$$".  I keep getting the process id.

Thanks again,

Mike C



In article <Pine.A41.4.21.0010021607430.14510-
100000@ginger.libs.uga.edu>,
  Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> On Mon, 2 Oct 2000 coughlan@gothaminteractive.com wrote:
>
> > I am using CGI.pm.  How can I do a global search of A for B in all
my
> > form data?  I tried:
> >
> >     tr/B/A/ foreach $query->all_parameters;
> >
> > and
> >
> >     tr/B/A/ foreach $query->param();
> >
> > I can't seem to find the structure that holds the data to run the tr
> > function.
> >
> > Any suggeastions?
> >
> > TIA,
> > Mike Coughlan
>
> I'm confused about what exactly you mean by "global search of A for
B".
> You seem to be trying to translate all of your B's to A's.  Could you
> perhaps explain what you want a different way--maybe with an example?
>
> Brad
>
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Mon, 02 Oct 2000 22:10:13 GMT
From: sarbayo@telis.org (Steve A.)
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <39d906fa.2254836@news.inreach.com>

On Mon, 2 Oct 2000 15:38:06 -0500, "Andrew N. McGuire "
<anmcguire@ce.mediaone.net> wrote:

>On Mon, 2 Oct 2000, Larry Rosler quoth:
>
>LR> In article <39d8bdc4.1426347@news.inreach.com> on Mon, 02 Oct 2000 
>LR> 17:40:23 GMT, Steve A. <sarbayo@telis.org> says...
>LR> > >How can I open this file from within a CGI script and read the
>LR> > >contents and write them to the browser screen as if the file had been
>LR> > >#INCLUDEd using SSI.
>LR> > 
>LR> > If this is a clean HTML text file , it should be as easy as this:
>LR> > "
>LR> >    open(FHANDLE, $your_filename);
>LR> > 	while(<FHANDLE>) {
>LR> > 		$Html_data .= $_;
>LR> > 	}
>LR> >    close(FHANDLE);
>LR> >    print $Html_data;
>LR> > "
>LR> > I use this simple code to do just that, read in an entire file at
>LR> > once, into a "string", and print the entire file/string.
>LR> 
>LR> There are more efficient ways to read an entire file into one string.  
>LR> But why do that at all?
>LR> 
>LR> Simply this:
>LR> 
>LR>      print while <FHANDLE>;
>LR> 
>LR> makes a lot more sense, and is far easier on the memory of the computer 
>LR> if the file is large.
>
>
>Or even:
>
>        print <FHANDLE>;
>
It all sounds good to me.
It's just that I sometimes a person needs to manipulate the incomming
data stream prior to dumping it.
Agreed, if all you want to do is a dump, the two above methods look
fine.



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

Date: Mon, 02 Oct 2000 22:10:19 GMT
From: sarbayo@telis.org (Steve A.)
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <39d9059c.1904689@news.inreach.com>

On Mon, 2 Oct 2000 20:58:41 +0200, "Alan J. Flavell"
<flavell@mail.cern.ch> wrote:

>On Mon, 2 Oct 2000, Steve A. wrote:
>
>>    open(FHANDLE, $your_filename);
>> 	while(<FHANDLE>) {
>> 		$Html_data .= $_;
>> 	}
>>    close(FHANDLE);
>>    print $Html_data;
>
>Bizarre.  And no tests for success, either.  Score adjusted.
>
Bizarre,  the idea was to describe a process,  one which a person
could visualize the process.
I suppose I could have written a hundred lines of code too, including
the shebang line and the header.
Or did you overlook that ?
" Score adjusted. "


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

Date: Mon, 02 Oct 2000 22:46:28 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <dt3its44jnslmn7aq55kt06qkcps0nt9v7@4ax.com>

Steve A. wrote:

>Bizarre,  the idea was to describe a process,  one which a person
>could visualize the process.
>I suppose I could have written a hundred lines of code too, including
>the shebang line and the header.
>Or did you overlook that ?

No, what I think A.J. Flavell ment was that first you read in the file
line by line, append it to a totalling string by hand, and finally print
it out. It works, but it's pretty unperlish, IMO. In Perl style, you'd
either:

 * undef $/ and read the file in one <FH>

	{
	    local $/;  # undef
	    $string = <FH>;
	}

 * read and print one line at a time:

	print while defined($_ = <FH>);

or

	while(<FH>) {
	    print;
	}

-- 
	Bart.


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

Date: Tue, 3 Oct 2000 01:20:23 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Inserting HTML into CGI script as if it was beinging #NCLUDEd via SSI
Message-Id: <Pine.GHP.4.21.0010030106400.27436-100000@hpplus03.cern.ch>

On Mon, 2 Oct 2000, Bart Lateur wrote:

> No, what I think A.J. Flavell ment was that first you read in the file
> line by line, append it to a totalling string by hand, and finally print
> it out.

Sure.

> In Perl style, you'd either:

>  * undef $/ and read the file in one <FH>

If you wanted it, that's what you'd do...

Oh well, the hon. Usenaut's other outbursts have qualified for my
score basement, so let's hope he puts me in his killfile and then
we'll all be a lot happier.

print while <FH>; was good.  I'll try to be as concise myself
one of these days (but physicists write fortran in any language, as
you know ;-).

cheers



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

Date: Tue, 03 Oct 2000 00:49:50 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Is this is Regexp bug?
Message-Id: <slrn8tib9c.f5o.tjla@thislove.dyndns.org>

I was shocked! How could Glyndwr <glynFOOdwr@FSCKdeleteEmeD.co.uk>
say such a terrible thing:
>Probably not - part of this SafePerl rubbish is that we can't run *any*
>modules at all, or indeed almost anything else useful. I shall check the
>perldoc, however. Cheers.

No problem if it's pure perl. Just copy it into your script.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
The Public is merely a multiplied "me."
		-- Mark Twain


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

Date: Mon, 02 Oct 2000 22:50:27 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: Just Another Perl Hacker
Message-Id: <Ti8C5.285892$Gh.7997539@news20.bellglobal.com>

B. Elijah Griffin <eli@panix5.panix.com> wrote:
: In comp.lang.perl.misc, Yanick Champoux  <yanick1@sympatico.ca> wrote:
:> ($_,$y)=('Yhre lo  .kePnarhtretcae',     '(.) (.)');
:> $y=~s/\(/(./gwhile s/$y/$2$1/xg;print #      @ 
:>                                       #    `---'

: Hmmm. You could easily get a \n in there:

: ($_,$y)=("Yhre lo  .kePnarhtretcae\n", '(.) (.)');
: $y=~s/\(/(./gwhile s/$y/$2$1/xg;print#     @ 
:                                      #   `---'

True. And I could also get rid of those cowardly comments...

($_,$y)=("Yhre lo  .kePnarhtretcae\n",   '(.) (.)'  );
$y=~s/\(/(./gwhile s/$y/$2$1/xg;print;       @      !; 
                                     "     `---'    ";

Who would have thought that a clown's face would compile. 8-/

Yanick



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

Date: Mon, 02 Oct 2000 22:59:50 GMT
From: Elaine Ashton <elaine@chaos.wustl.edu>
Subject: Re: Module Install on Solaris 8?
Message-Id: <B5FE8BA9.70E1%elaine@chaos.wustl.edu>

in article Wx7C5.233$b7.15729@eagle.america.net, Garry Williams at
garry@ifr.zvolve.net quoth:
>> In spite of the perceived utility of such a link, you shouldn't ever do that
>> as it will always bite you in the ass when you least expect it...like now.
>> :) If you make gcc not masquerade as cc you won't see this problem.
> 
> I bet the original poster saw another problem which led him to do this.

Yes, like the fact that Perl on Solaris 8 is compiled with cc which is a
commercial product that sells for $1000.00 for a single node, single user
license and is not included with the base OS. The default SunPerl then looks
for cc when building a module and fails thus the bad hack of putting in the
link to "fool" Perl into thinking that cc does exist when, in fact, it does
not.
 
>> I would suggest compiling a Perl with gcc and installing it elsewhere than
>> the Sun installation so that you have yours separate...this will ensure that
>> all gcc versions are together and that you can still use the kstat tool and
>> that patches for the Sun version will work, etc.
> 
> Good suggestion (assuming that Sun's compiler is not available).  I
> would suggest, if you do this that you also rename the /bin/perl
> executable as well.  The /bin directory often appears before others in
> the PATH variable.  That will cause your installed modules to be
> masked.  

Again, SparcWorks is an expensive and optional package which is why most
people who use Solaris outside of a corporate environment use gcc. Also,
renaming /bin/perl is not optimal unless you don't mind any system patches
Sun might provide for Perl in the future failing. Same as it ever was with
Solaris and you eventually get used to its warts.

> Of course, if you have access to Sun's compiler, just remove the link
> for gcc.  

If he had cc we wouldn't be here.....

e.



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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V9 Issue 4498
**************************************


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