[18158] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 326 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 21 09:05:38 2001

Date: Wed, 21 Feb 2001 06:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <982764310-v10-i326@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 21 Feb 2001     Volume: 10 Number: 326

Today's topics:
        Apache mod_perl & MySQL <jyli-luu@gc2.geracap.fi>
        Can't be done?? <karlt@pine-grove.com>
    Re: Change unknown filenames <c_clarkson@hotmail.com>
    Re: Difficult Split Question (Anno Siegel)
    Re: Difficult Split Question (Anno Siegel)
    Re: Difficult Split Question (Christopher Burke)
    Re: Difficult Split Question (Christopher Burke)
    Re: Interpolate filehandle (Anno Siegel)
        Is this a bug? Can someone explain? <dev@trahojen.REMOVETHIS.com>
    Re: Is this a bug? Can someone explain? (Anno Siegel)
    Re: Is this a bug? Can someone explain? <dev@trahojen.REMOVETHIS.com>
        Print a page of HTML <barr@ppllc.com>
    Re: Regular Expression Question <ianb@ot.com.au>
    Re: Specifying the length of regular expression <ianb@ot.com.au>
    Re: Specifying the length of regular expression <ianb@ot.com.au>
    Re: Using a Java class from Perl. Is it possible? <barr@ppllc.com>
    Re: what is param? (Mark Jason Dominus)
    Re: Whats wrong with this???? <infinityzone@hotmail.com>
    Re: Whats wrong with this???? <john@princenaseem.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 21 Feb 2001 15:13:47 +0200
From: "Jaakko Yli-Luukko" <jyli-luu@gc2.geracap.fi>
Subject: Apache mod_perl & MySQL
Message-Id: <970evm$6f8$1@plaza.suomi.net>

Hi

I am using Apache with mod_perl and my Perl (CGI-)script is accessing MySQL
server.

I need to speed up my Apache requests. I understand it is possible to leave
MySQL connection 'open' between Apache request.But I don't know how should I
do that.
Can anyone give me a hint for this one?

I have no idea how much this would speed up my script, but I want see if it
helps.

---
Jaakko Yli-Luukko





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

Date: Wed, 21 Feb 2001 11:59:41 GMT
From: "Karl Thompson" <karlt@pine-grove.com>
Subject: Can't be done??
Message-Id: <N4Ok6.292664$w35.48205897@news1.rdc1.nj.home.com>

Hi,

Sorry to double post, but there has been no reply to this message (posted
Feb 8) under subject "Printing to Windows' default printer." Any ideas from
anyone?

>>Hi,

I'm familiar with opening a device such as LPT1 and printing to the device.
I don't understand how to print to Windows' default printer, whether it be a
local printer or located on the network.

What's the syntax for doing this please?

Thanks,
Karl<<<







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

Date: Wed, 21 Feb 2001 02:23:13 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: Change unknown filenames
Message-Id: <35C7116C1C68EB19.2A45923C655E06E9.34023D16E0CB8CF6@lp.airnews.net>


"Bart Lateur" <bart.lateur@skynet.be> wrote
: Bart Lateur wrote:
:
: > use File::Find;
: > find sub {
: >     -f or return;
: >     (my $new = $_) =~ s/\.(pl|cgi|exe)$/.txt/i and
: >         rename $_, $new;
: > }, $tempdir;
:
: Oh damned, I alway fall for this one. It won't work, because you simply
: cannot declare a lexical variable ($new), assing it a value, and read
: that variable again in the same statement. Solution: either make the
: declaration a separate statement, or replace then "and" by a real "if",
: again making the second part a separate statement.
:
: find sub {
:     -f or return;
:     my $new = $_;
:     $new =~ s/\.(pl|cgi|exe)$/.txt/i and
:         rename $_, $new;
: }, $tempdir;
:
: or
:
: find sub {
:     -f or return;
:     if((my $new = $_) =~ s/\.(pl|cgi|exe)$/.txt/i) {
:         rename $_, $new;
:     }
: }, $tempdir;

or we could let s/// remember the old name:

find sub {
    rename $1, $_ if -f && s/^((.*\.)(pl|cgi|exe))$/$2txt/i;
}, $tempdir;

Charles K. Clarkson





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

Date: 21 Feb 2001 11:24:53 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Difficult Split Question
Message-Id: <9708i5$33i$1@mamenchi.zrz.TU-Berlin.DE>

According to Christopher Burke <craznar@hotmail.com>:
> ebohlman@omsdev.com (Eric Bohlman) wrote in
> <96v5fp$opd$1@bob.news.rcn.net>: 
> 
> >Christopher Burke <craznar@hotmail.com> wrote:
> >> I have input lines of the form :
> >
> >> a,b,c,xyz(p,q,r),d
> >> a,def(x,y,z),b,pqr(m,n)
> >
> >> I wish to split the line based on all ',' characters that are not
> >> between '(' and ')'.
> >
> >> Is there any "simple" way of doing this using split or regex or do I
> >> need to do some 'brute force' coding ?
> >
> >
> >This is actually only a minor variation of the problem of splitting 
> >comma-separated strings that may have quotes; it should be possible to 
> >adapt most of the solutions to the latter (starting with the one in 
> >perlfaq4) to handle it.
> >
> 
> No its not, because I want to keep the stuff outside the quotes and the 
> quotes. It was different enough to me to ask if there was an easy way of 
> doing it... I have worked out a 'brute force' way.

If your parentheses are just quote-like delimiters and don't nest,
the FAQ solution can easily be adapted.  First make it work with
() instead of "".  You will have to replace some of the " in the
regex with \( and others with \) as appropriate.  Next, allow text
without " and , to precede an opening parenthesis. \( becomes
[^(,]*\( in this step. Finally move the capturing parentheses (one
pair) so that the first \( and the final \) are inside instead of
outside.  That's all.  The solution from the FAQ becomes:

    push @new, $+ while $text =~ m/
          ([^(,]*\([^\)\\]*(?:\\.[^\)\\]*)*\)),? # changes in this line only
        | ([^,]+),?
        | ,
    /gx;

Whether this qualifies as a minor variation of the theme or not, the
changes are all straightforward and the hard stuff stays in place.

Anno


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

Date: 21 Feb 2001 11:27:32 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Difficult Split Question
Message-Id: <9708n4$33i$2@mamenchi.zrz.TU-Berlin.DE>

According to Gwyn Judd <tjla@guvfybir.qlaqaf.bet>:
> I was shocked! How could Christopher Burke <craznar@hotmail.com>
> say such a terrible thing:
> 
> >No its not, because I want to keep the stuff outside the quotes and the 
> >quotes. It was different enough to me to ask if there was an easy way of 
> >doing it... I have worked out a 'brute force' way.
> 
> Huh? Quotes? What are you talking about? Your example uses comma's to
> separate the fields except when inside brackets. It doesn't mention
> anything about quotes. The only difference between your example and the
> FAQ is that you have to look for '(' and ')' instead of just '"'.

Well, he must also allow some text (that doesn't contain "," or "(")
before the "(", but that's trivial as well.

Anno


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

Date: Wed, 21 Feb 2001 11:44:15 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Difficult Split Question
Message-Id: <904FD27ADCraznar@61.9.128.12>

Thanks for the hint - I'll give it a go.

On a scale of 1 to 10 in Perl where 10 = guru, I'm still at about 3 or 4.

anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in
<9708i5$33i$1@mamenchi.zrz.TU-Berlin.DE>: 

>    push @new, $+ while $text =~ m/
>          ([^(,]*\([^\)\\]*(?:\\.[^\)\\]*)*\)),? # changes in this line
>          only 
>        | ([^,]+),?
>        | ,
>    /gx;

-- 
---
/* Christopher Burke - Spam Mail to craznar@hotmail.com
|* www.craznar.com - International Internet Writing Experiment
\* Real mail to cburke(at)craznar(dot)com


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

Date: Wed, 21 Feb 2001 11:46:04 GMT
From: craznar@hotmail.com (Christopher Burke)
Subject: Re: Difficult Split Question
Message-Id: <904FDA6A1Craznar@61.9.128.12>

tjla@guvfybir.qlaqaf.bet (Gwyn Judd) wrote in 
<slrn996fu8.311.tjla@thislove.dyndns.org>:

>I was shocked! How could Christopher Burke <craznar@hotmail.com>
>say such a terrible thing:
>
>>No its not, because I want to keep the stuff outside the quotes and the 
>>quotes. It was different enough to me to ask if there was an easy way of 
>>doing it... I have worked out a 'brute force' way.
>
>Huh? Quotes? What are you talking about? Your example uses comma's to
>separate the fields except when inside brackets. It doesn't mention
>anything about quotes. The only difference between your example and the
>FAQ is that you have to look for '(' and ')' instead of just '"'.
>

No - with quotes, you turn
x,y,"pqr,st",z into ('x','y','pqr,st','z')

What I want is to turn
x,y,def(pqr,st),z into ('x','y','def(pqr,st)','z')

A big enough difference to lose me in regex land...
-- 
---
/* Christopher Burke - Spam Mail to craznar@hotmail.com
|* www.craznar.com - International Internet Writing Experiment
\* Real mail to cburke(at)craznar(dot)com


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

Date: 21 Feb 2001 13:16:37 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Interpolate filehandle
Message-Id: <970f3l$90b$2@mamenchi.zrz.TU-Berlin.DE>

According to Gwyn Judd <tjla@guvfybir.qlaqaf.bet>:
> I was shocked! How could Martijn Mulder <soso@open.net>
> say such a terrible thing:
> >I expect the following code to print
> >
> >   It's only Rock & Roll but I like it
> >
> >but I end up with
> >
> >   It's only $a but I like it
> 
> $a = "Rock & Roll";
> print map {$_ = '"'.$_.'"'; eval} <DATA>;

  print map eval "qq($_)", <DATA>; # slightly more compact

> __DATA__
>    It's only $a but I like it




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

Date: Wed, 21 Feb 2001 13:34:16 +0100
From: "Trahojen" <dev@trahojen.REMOVETHIS.com>
Subject: Is this a bug? Can someone explain?
Message-Id: <OBOk6.3419$hi2.9791@nntpserver.swip.net>

Hi.

I really can't understand this. I thought qq() behaviour was exactly the
same as double quotes.
Can someone explain to me why this code doesn't produce the intended results
when using qq()?
Note: It doesn't matter if I pass the result of and_array to @result_list
and then print the list like q(print @result_list;). Also note that \n works
fine. \s does not.
It doesn't matter much, I'm just curious, because I might have found a bug
that can be hard to track down when future packages or modules rely on it...
I'm currently using an ActiveState win32 port of perl, v5.6.0, build 620, an
about 2 month old release.


use strict;

sub and_array
{
  my ($ref1, $ref2, @list, $t_val) = @_;
  foreach(@$ref1)
  {
    $t_val = $_;
    foreach(@$ref2)
    {
      push(@list, $_) if /^$t_val$/i; # push this name to @list if it
matches a record in previous list.
    }
  }
  return @list;
}


my @list1 = ('Hi', 'this', 'is', 'a', 'test', 'to', 'see', 'if', 'it',
'works', 'properly', 'a');
my @list2 = ('This', 'test', 'works', 'not');

$\ = qq(\n);
$, = qq(\s);
print and_array(\@list1, \@list2);

$, = " ";
print and_array(\@list1, \@list2);

# ---
# just before posting I figured join had to be used internally, so I tried
this too, same result:

print join(qq(\s), and_array(\@list1, \@list2));


What's going on?

- Samuel [dev@trahojen.REMOVETHIS.com]




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

Date: 21 Feb 2001 13:03:49 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Is this a bug? Can someone explain?
Message-Id: <970ebl$90b$1@mamenchi.zrz.TU-Berlin.DE>

According to Trahojen <dev@trahojen.REMOVETHIS.com>:
> Hi.
> 
> I really can't understand this. I thought qq() behaviour was exactly the
> same as double quotes.

Except with qq you get to chose the delimiter.  That matters if the
delimiter appears in the quoted string.

> Can someone explain to me why this code doesn't produce the intended results
> when using qq()?

What are the intended results, and what happens instead?

> Note: It doesn't matter if I pass the result of and_array to @result_list
> and then print the list like q(print @result_list;). Also note that \n works
> fine. \s does not.

Works how?  \s has only a special meaning in regular expressions, where
it is any whitespace character.  In quoted text, \s is the same as s.

> It doesn't matter much, I'm just curious, because I might have found a bug
> that can be hard to track down when future packages or modules rely on it...
> I'm currently using an ActiveState win32 port of perl, v5.6.0, build 620, an
> about 2 month old release.
> 
> 
> use strict;
> 
> sub and_array
> {
>   my ($ref1, $ref2, @list, $t_val) = @_;

Do you realize that $t_val will never be set in that assignment?
Apparently, @list is also not intended to be set from @_.  It is
best to provide an extra my() declaration for such variables.
The way you write it, a reader must look twice to see how @list
and $t_val are initialized.

>   foreach(@$ref1)
>   {
>     $t_val = $_;
>     foreach(@$ref2)
>     {
>       push(@list, $_) if /^$t_val$/i; # push this name to @list if it
> matches a record in previous list.
>     }
>   }
>   return @list;
> }
> 
> 
> my @list1 = ('Hi', 'this', 'is', 'a', 'test', 'to', 'see', 'if', 'it',
> 'works', 'properly', 'a');
> my @list2 = ('This', 'test', 'works', 'not');
> 
> $\ = qq(\n);
> $, = qq(\s);
> print and_array(\@list1, \@list2);
> 
> $, = " ";
> print and_array(\@list1, \@list2);
> 
> # ---
> # just before posting I figured join had to be used internally, so I tried
> this too, same result:
> 
> print join(qq(\s), and_array(\@list1, \@list2));
> 
> 
> What's going on?

You tell us, but I doubt it's a bug.

Anno


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

Date: Wed, 21 Feb 2001 14:43:01 +0100
From: "Trahojen" <dev@trahojen.REMOVETHIS.com>
Subject: Re: Is this a bug? Can someone explain?
Message-Id: <zCPk6.3426$hi2.9587@nntpserver.swip.net>

Anno,

>> Can someone explain to me why this code doesn't produce the intended
results
>> when using qq()?
> What are the intended results, and what happens instead?

Had you run the code, you'd have noticed.
But I totally agree I should have included that.
The intended results were to separate list items when
printing the result with a blank space. Instead, when
using qq(\s) it separated with "s", as you've pointed
out below.
All this arouse from the fact that I thought
$\ = qq(\s) looked much nicer than $\ = " "...
I guess I should stop doing that. ;)


*snip*
>> Also note that \n works fine. \s does not.
> Works how?  \s has only a special meaning in regular expressions, where
> it is any whitespace character.  In quoted text, \s is the same as s.

To much regex'ing lately. That explains it all.
Sorry, just got a bit exited about it.


- Samuel [dev@trahojen.REMOVETHIS.com]




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

Date: Wed, 21 Feb 2001 08:56:41 -0500
From: "Sereno Barr-Kumar" <barr@ppllc.com>
Subject: Print a page of HTML
Message-Id: <nOPk6.18$QI2.43263@news.nyc.globix.net>

How could I print a HTML formatted page to a printeer
using perl or any other method.

Is this possible,  I imagine some browser emulation
of the page needs to be done before it is sent to
the printer.


Thanks

barr






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

Date: Wed, 21 Feb 2001 22:20:54 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: Regular Expression Question
Message-Id: <3A93A495.62C70531@ot.com.au>

Eli the Bearded wrote:

> Well, solving for just ten or more Ns should be easy. The ABC
> problem was a bit more complicated. You'll find it much easier
> if you kill the line breaks, first though.
>
> $geneseq =~ tr:A-Z::cd; # kill non-capital letters
> @frags   = split(/N{10,}/, $geneseq);

I would say this is about as close to ideal as you could get, since it nicely
eliminates the newlines that remain, which are going to be pretty much
useless. I notice that it's still unclear whether the original poster wants
"more than ten" or "ten or more". I'll stick with the "ten or more" for this
discussion.

> > So ten or more consecutive N's are like delimiters, basically I want a
> > regular expression that says one or more N's followed by an optional
> > newline symbol (if the consecutive N's are on two lines) followed by
> > one or more N's, with the total number of N's greater than 10.
>
> This is a bit more complicated, but if we can assume that there
> will be at most one newline in the sequence (possibly false, if
> Ns go one for multiple very short lines), then this can do it:
>
> (?=N{10,}|[N\n]{11,})[N\n]+

If we allow any number of newlines, it's actually even easier:

    (?:N\n*){10,}

Based on the description of the data format, we could also assume that there
won't be consecutive newlines, and change the "*" to a "?". I guess if you
wanted to be anal about it, you could try to code in the fact that successive
newlines are separated by exactly 50 Ns.

> By not mentioning split() originally, people here wanted to solve
> a different problem.

Not to mention asking for a regex that specified a minimum total length,
rather than a minimum number of a certain type of element. Or that there were
only two types, not three (very important for these solutions to work).

Regards,


Ian





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

Date: Wed, 21 Feb 2001 22:51:50 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: Specifying the length of regular expression
Message-Id: <3A93ABD6.90E1851@ot.com.au>

Greg Bacon wrote:

> I know you objected to the distinction before, but matching strings of
> the form A+B*C+ that are at least ten characters in length is an
> academic problem.  Introduce concatenations, character classes,
> alternations, lookaheads, and so forth to severely complicate the
> problem.

As it happens, this was posed as a real, practical problem by the original
poster (see the parallel thread "Regular Expression Question" for more
information on the actual problem), although it turned out that it was the
wrong question. However, the right question was similar, and it was still
heavily biased towards a regex solution, since it had to be used in "split".
Yes, other solutions are possible, but in this case probably not better.

> I would argue the a module like the one you've described is
> unnecessarily limited.

As are about 99% of third-party products you'll ever be required to use.

> Maybe I'm just unimaginative, but what's wrong with
>
>     for (@strings) {
>         if (/$monster_regular_expression/o) { ... }
>         elsif (/^(A+B*C+)$/ && length($1) > 10) { ... }
>     }

Well, you're hard-coding your special logic into your program, for a start.
Having to edit the program logic every time you want to change what matches
makes the program more error-prone and harder to maintain. I was considering a
system in which you just added regexes to a file (possibly paired with other
data, depending on what the program does). Think of lex, for example. It's
designed to allow you to specify input in a regex + data form, rather than
making you edit the lex program to hard-code in all the regexes and special
case logic.

> As for security concerns, there are patterns that can push the regular
> expression matcher into exponential time, so, if you're concerned about
> denial of service, you shouldn't allow untrusted users to specify
> arbitrary regular expressions.

So allowing them to specify arbitrary code to evaluate is supposed to make this
safer?

You could attempt to detect these sorts of patterns, or just place a timeout on
the operation. But denial of service is pretty low on the danger list (relative
to data security and privacy), and if someone wants to mount such an attack,
they hardly need to use the regex engine to do it for them.

The perl regex engine seems to be getting better at detecting these, too. I
haven't looked under the covers, but the obvious sorts of patterns for doing
this, such as (a*)*, don't seem to hold it up. Perhaps someone with a knowledge
of the guts could enlighten me? I don't imagine it's foolproof, though.

> You can choose to continue working around an incomplete
> or awkward interface (with respect to your needs), or you can update
> the interface to make your life easier.

I'm sure we all want to do that from time to time, some of us all the time. But
we've also got limited lifespans and deadlines. You have to fix what's really
important to fix, put up with the minor annoyances, and get on with life.

I can just imagine you telling your boss "Well, I could just use the interface
as is, and spend a few minutes coming up with a regex, or I could spend days
fixing the package, thereby branching it from its core development source tree
and taking on responsibility for maintaining it for the rest of our product's
lifetime, or requiring me to contact the developers and wait for months for
them to decide whether to incorporate my changes and lose backwards
compatibility for the thousands of other users."

Regards,


Ian




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

Date: Wed, 21 Feb 2001 23:09:20 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: Specifying the length of regular expression
Message-Id: <3A93AFF0.351E3F9@ot.com.au>

Ian Boreham wrote:

> The perl regex engine seems to be getting better at detecting these, too. I
> haven't looked under the covers, but the obvious sorts of patterns for doing
> this, such as (a*)*, don't seem to hold it up. Perhaps someone with a knowledge
> of the guts could enlighten me? I don't imagine it's foolproof, though.

Well, it didn't take much further exploration to find regexes that would cause
slowth, e.g.

>date;perl -e
'"aaaaabaaaaaaaaaaaaabaaaaaaababbaaaaaaabaaaabaaaaaaaaaaaabaaaaaaaaaaaaabaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaa"
=~ /((b?a*b?)*)*b/;';date
Wed Feb 21 23:00:44 EST 2001
Wed Feb 21 23:01:30 EST 2001

Still, that's what timeouts are for...


Ian




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

Date: Wed, 21 Feb 2001 09:00:48 -0500
From: "Sereno Barr-Kumar" <barr@ppllc.com>
Subject: Re: Using a Java class from Perl. Is it possible?
Message-Id: <eSPk6.19$QI2.43399@news.nyc.globix.net>

I think there are a couple of solutions offered at
http://www.perl.com/reference/query.cgi?java

Not tried any of them though.

barr




"John Smith" <jsmith@cecioni.com> wrote in message
news:3A9393C7.2CDD757B@cecioni.com...
>
> Jallo, assuming I have a Java class or a package, is it possible
> to use it from Perl? I'm thinking of some wrapper
> or something....
> I would like to instantiate objects of that class and invoke their
> methods...
>
> Is there a series of alternatives to choose from?
>
> thank you
>
> John




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

Date: Wed, 21 Feb 2001 11:41:02 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: what is param?
Message-Id: <3a93a94d.5921$85@news.op.net>

In article <96vibt$4c0$1@ashe.cs.unc.edu>,
Sungwook Park <parks@cs.unc.edu> wrote:
>I starting learning Perl.

Good luck!

>my $a = param('a');
>what is "param"?

'param' is a function supplied by the 'CGI' module.
If a web form is submitted to your program, the form may contain 
information supplied by the web user named 'a'. 
param('a') will look in the form and find out what the user entered in
that part of the form.  

If the form has

        <input type=text name=a>

The page will show a box where the user can type something.
 param('a') retrieves what they types.

> and what is "CGI::Carp"

This tells Perl that if there is an error, the error message should be
turned into a web page.
-- 
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print


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

Date: Wed, 21 Feb 2001 12:30:03 -0000
From: Eric Provence <infinityzone@hotmail.com>
Subject: Re: Whats wrong with this????
Message-Id: <t97d6b4man3rba@corp.supernews.com>

First off, Godzilla!, you are totaly wrong. It does run. *duh*. I'm not 
just some newbie who fell off the planet Newbish. Another thing, its only 
singled down to one block of code.How do I know? Because If I switch 
NEWPOST and ADDPOST's places, ADDPOST will work, but NEWPOST won't. So 
i've singled it down to one block:

open (NEWPOST, ">$subject");
print NEWPOST "<table border=\"0\" bgcolor=\"#000000\" width=\"80%\">\n";
print NEWPOST "<tr valign=top>\n";
print NEWPOST "<td bgcolor=\"#181818\" valign=\"top\">\n";
print NEWPOST "<center><font face=\"Verdana\" 
color=\"white\">$subject</font></center></td></tr>\n";
print NEWPOST "<tr>\n";
print NEWPOST "<td bgcolor=\"#2F2F2F\" valign=\"top\">\n";
print NEWPOST "<font face=\"Verdana\" color=\"white\" size=2>\n";
print NEWPOST "$msg\n";
print NEWPOST "</font></td></tr>\n";
close (NEWPOST);

I look at this over and over, and I still can't find anything wrong with 
it. Currently, with the code above, it doesn't produce any errors, but it 
still doesn't write. However if I change the open command to:
open (NEWPOST, ">$subject") or die "Can't Write File: $!\n";

It produces an Internal Server Error, but when I check the error log, it 
just says "Premature End Of Script Headers" and doesn't give me any actual 
errors in the code. I'm about to go insane, so I hope someone can help me!

Eric

--
Posted via CNET Help.com
http://www.help.com/


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

Date: Wed, 21 Feb 2001 13:29:19 -0000
From: "JohnShep" <john@princenaseem.com>
Subject: Re: Whats wrong with this????
Message-Id: <apPk6.1839$5U3.16450@NewsReader>


Eric Provence <infinityzone@hotmail.com> wrote in message
news:t97d6b4man3rba@corp.supernews.com...

> I look at this over and over, and I still can't find anything wrong with
> it. Currently, with the code above, it doesn't produce any errors, but it
> still doesn't write. However if I change the open command to:
> open (NEWPOST, ">$subject") or die "Can't Write File: $!\n";
>
> It produces an Internal Server Error, but when I check the error log, it
> just says "Premature End Of Script Headers" and doesn't give me any actual
> errors in the code. I'm about to go insane, so I hope someone can help me!
>
> Eric
>
> --
> Posted via CNET Help.com
> http://www.help.com/

Hi Eric,
I changed
#!/usr/bin/perl to #!/usr/bin/perl -w
and your code ran first time on my machine and wrote out two files
"testmessage" and "mainboard.txt".

John




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

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 V10 Issue 326
**************************************


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