[18543] in Perl-Users-Digest
Perl-Users Digest, Issue: 711 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Apr 19 09:06:39 2001
Date: Thu, 19 Apr 2001 06:06:03 -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: <987685563-v10-i711@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 19 Apr 2001 Volume: 10 Number: 711
Today's topics:
$& <brianlk@pacific.net.hk>
$1, $2, $3 can be lvalues <johnlin@chttl.com.tw>
Re: $1, $2, $3 can be lvalues (David Efflandt)
Re: $1, $2, $3 can be lvalues <joe+usenet@sunstarsys.com>
Re: $1, $2, $3 can be lvalues (Dave Bailey)
Re: $1, $2, $3 can be lvalues <johnlin@chttl.com.tw>
\G not having any effect in pattern ! Any ideas? (Avinash Chopde; <avinash@acm.org>)
Re: \G not having any effect in pattern ! Any ideas? <ren@tivoli.com>
Re: \G not having any effect in pattern ! Any ideas? (Avinash Chopde; <avinash@acm.org>)
Re: adding a constant to elements in an array! <uri@sysarch.com>
Re: adding a constant to elements in an array! (Randal L. Schwartz)
Re: an example Re: How can u group together fields and <abe@ztreet.demon.nl>
ANNOUNCE: Text::Reform 1.06 (Damian Conway)
another format issue <webmaster@webdragon.unmunge.net>
Re: apache - autoflush <tom@hotversion.com>
Re: apache - autoflush (David Efflandt)
Re: are associative arrays the way to go? <bart.lateur@skynet.be>
Automated HTML Forms <ballmann@co-de.de>
Re: Automated HTML Forms (Rafael Garcia-Suarez)
Re: Automated HTML Forms (Abigail)
Banner does not display <get_got_it@yahoo.com>
Re: basic TRUE / FALSE <mjcarman@home.com>
Re: Beta Testers/Perl Hackers <pne-news-20010417@newton.digitalspace.net>
Re: binmode <mjcarman@home.com>
Re: binmode <bart.lateur@skynet.be>
Re: Can't open file, dies (Abigail)
CGI Programmer Wanted derek@imarkconsulting.com
Re: CGI Timing Question (Iain Chalmers)
CGI upload and CGITempxxx files <pratt@biop.ox.ac.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Apr 2001 11:54:42 +0800
From: "Brian Leung" <brianlk@pacific.net.hk>
Subject: $&
Message-Id: <9bj39h$re8$1@hfc.pacific.net.hk>
Hi,
What is the meaning of $& in perl script?
Thanks
Brian
------------------------------
Date: Wed, 18 Apr 2001 11:44:00 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: $1, $2, $3 can be lvalues
Message-Id: <9bj2e9$92j@netnews.hinet.net>
Dear all,
Seeing this in document perlvar:
$1 is the same as substr($var, $-[1], $+[1] - $-[1])
$2 is the same as substr($var, $-[2], $+[2] - $-[2])
$3 is the same as substr($var, $-[3], $+[3] - $-[3])
The first thing that came into my mind was,
why won't Perl break the limit that $1 $2 $3 must be read-only?
substr can be lvalue, so can $1 $2 $3 be lvalues, IMHO.
$_ = 'good';
if(/(g)/) { $1 = 'G' }
(Contemporary version of Perl will get error message.)
Modification of a read-only value attempted at line 2.
What do you think about that?
Thank you.
John Lin
------------------------------
Date: Wed, 18 Apr 2001 04:31:57 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: $1, $2, $3 can be lvalues
Message-Id: <slrn9dq65t.jc6.see-sig@typhoon.xnet.com>
On Wed, 18 Apr 2001 11:44:00 +0800, John Lin <johnlin@chttl.com.tw> wrote:
> Dear all,
>
> Seeing this in document perlvar:
>
> $1 is the same as substr($var, $-[1], $+[1] - $-[1])
> $2 is the same as substr($var, $-[2], $+[2] - $-[2])
> $3 is the same as substr($var, $-[3], $+[3] - $-[3])
>
> The first thing that came into my mind was,
> why won't Perl break the limit that $1 $2 $3 must be read-only?
>
> substr can be lvalue, so can $1 $2 $3 be lvalues, IMHO.
>
> $_ = 'good';
> if(/(g)/) { $1 = 'G' }
>
> (Contemporary version of Perl will get error message.)
> Modification of a read-only value attempted at line 2.
>
> What do you think about that?
I don't understand the substr statements at the top or what you are
trying to achieve, but maybe this is what you are looking for:
$_ = 'good';
print ucfirst($_),"\n";
--
David Efflandt (Reply-To is valid) http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: 18 Apr 2001 00:41:59 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: $1, $2, $3 can be lvalues
Message-Id: <m3wv8izunc.fsf@mumonkan.sunstarsys.com>
"John Lin" <johnlin@chttl.com.tw> writes:
> Seeing this in document perlvar:
>
> $1 is the same as substr($var, $-[1], $+[1] - $-[1])
> $2 is the same as substr($var, $-[2], $+[2] - $-[2])
> $3 is the same as substr($var, $-[3], $+[3] - $-[3])
>
> The first thing that came into my mind was,
> why won't Perl break the limit that $1 $2 $3 must be read-only?
>
> substr can be lvalue, so can $1 $2 $3 be lvalues, IMHO.
>
> $_ = 'good';
> if(/(g)/) { $1 = 'G' }
>
> (Contemporary version of Perl will get error message.)
> Modification of a read-only value attempted at line 2.
>
> What do you think about that?
Hmm...Wow! Good gawd that's awful clever, but can you clarify
what should be the printed result in this case?
$_ = 'good';
m!(\w(o+)\w)!;
$1 = 'Good';
$2 = 'awful';
print "$_ => $1 $2 ?\n";
I suppose the devil is in the details :-)
--
Joe Schaefer "The opposite of a correct statement is a false statement. The
opposite of a profound truth may well be another profound
truth."
--Niels Bohr
------------------------------
Date: 18 Apr 2001 05:08:13 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: $1, $2, $3 can be lvalues
Message-Id: <slrn9dpu16.cm4.dave@sydney.daveb.net>
On Wed, 18 Apr 2001 11:44:00 +0800, John Lin <johnlin@chttl.com.tw> wrote:
>Dear all,
>
>Seeing this in document perlvar:
>
>$1 is the same as substr($var, $-[1], $+[1] - $-[1])
>$2 is the same as substr($var, $-[2], $+[2] - $-[2])
>$3 is the same as substr($var, $-[3], $+[3] - $-[3])
>
>The first thing that came into my mind was,
>why won't Perl break the limit that $1 $2 $3 must be read-only?
>
>substr can be lvalue, so can $1 $2 $3 be lvalues, IMHO.
$+ is read-only.
--
Dave Bailey
davidb54@yahoo.com
------------------------------
Date: Wed, 18 Apr 2001 14:19:17 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: $1, $2, $3 can be lvalues
Message-Id: <9bjbhf$s3d@netnews.hinet.net>
"Joe Schaefer" wrote
> "John Lin" writes:
>
> > Seeing this in document perlvar:
> >
> > $1 is the same as substr($var, $-[1], $+[1] - $-[1])
> > $2 is the same as substr($var, $-[2], $+[2] - $-[2])
> > $3 is the same as substr($var, $-[3], $+[3] - $-[3])
> >
> > The first thing that came into my mind was,
> > why won't Perl break the limit that $1 $2 $3 must be read-only?
> >
> > substr can be lvalue, so can $1 $2 $3 be lvalues, IMHO.
> Can you clarify what should be the printed result in this case?
>
> $_ = 'good';
>
> m!(\w(o+)\w)!;
> $1 = 'Good';
> $2 = 'awful';
>
> print "$_ => $1 $2 ?\n";
What about making it equivalent to
$_ = 'good';
m!(\w(o+)\w)!;
substr($_, $-[1], $+[1] - $-[1]) = 'Good';
substr($_, $-[2], $+[2] - $-[2]) = 'awful';
print;
__END__
Gawfuld
John Lin
------------------------------
Date: Mon, 16 Apr 2001 21:41:16 GMT
From: achopde@BLACKHOLE.nyx.net (Avinash Chopde; <avinash@acm.org>)
Subject: \G not having any effect in pattern ! Any ideas?
Message-Id: <987457004.512568@irys.nyx.net>
From the perl FAQ's, I found this piece code of code
to build a tokenizer:
while (<>) {
chomp;
PARSER: {
if ( /\G( \d+\b )/gcx ) {
print "number: $1\n";
redo PARSER;
}
}
}
But - looks like this code only matches input once per line - how can
I make it match multiple numbers in a single line?
Using this perl: "This is perl, v5.6.0 built for MSWin32-x86-multi-thread",
and giving this input:
12
13 14
15
the output I get is:
number: 12
number: 13
number: 15
What happened to 14??
This can't be right, the \G looks like a no-op up there...what could
be wrong here?
--
Avinash Chopde
e-mail: avinash@acm.org
home page: http://www.aczone.com/
------------------------------
Date: 16 Apr 2001 16:50:52 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: \G not having any effect in pattern ! Any ideas?
Message-Id: <m31yqs5xab.fsf@dhcp9-172.support.tivoli.com>
On Mon, 16 Apr 2001, achopde@BLACKHOLE.nyx.net wrote:
> From the perl FAQ's, I found this piece code of code
> to build a tokenizer:
> while (<>) {
> chomp;
> PARSER: {
> if ( /\G( \d+\b )/gcx ) {
You are requiring the next number to immediately follow the "\G", which
means it will immediately follow the word-break immediately following
the previous number. That just isn't going to work. You need to
parse the separator, which in this case it white-space. Stick a "\s*"
after the "\G", and you're good to go.
> print "number: $1\n";
> redo PARSER;
> }
> }
> }
[snip]
> and giving this input:
> 12
> 13 14
^-- that's the separator (white-space) that you need to handle
> 15
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Mon, 16 Apr 2001 23:24:45 GMT
From: achopde@BLACKHOLE.nyx.net (Avinash Chopde; <avinash@acm.org>)
Subject: Re: \G not having any effect in pattern ! Any ideas?
Message-Id: <987463213.368654@irys.nyx.net>
Following up to my article - found the answer, thanks to an
email from S.Kuo.
Basically - I had only copied the partial example from:
http://www.perl.com/pub/doc/manual/html/pod/perlfaq6.html
which was my mistake - the one rule I had is not enough, I need
another rule to match the stuff between my tokens too to skip
over the un-needed characters... perl isn't lex!
--
Avinash Chopde
e-mail: avinash@acm.org
home page: http://www.aczone.com/
------------------------------
Date: Sun, 15 Apr 2001 23:37:11 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: adding a constant to elements in an array!
Message-Id: <x7g0f9lopj.fsf@home.sysarch.com>
>>>>> "M" == Milliwave <milliwave@rfengineering.freeserve.co.uk> writes:
M> the Y values, I'm looking
M> for a generic approach which would enable me to do the same with the x
M> values too!
M> X11 Y11+50 X12 Y12+50 X13 Y13+50 X14 Y14+50
M> X21 Y21+50 X22 Y22+50 X23 Y23+50
M> X31 Y31+50 X32 Y32+50
M> X41 Y41+50
use map/for and s///e. i leave the rest as an exercise.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: 16 Apr 2001 05:01:14 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: adding a constant to elements in an array!
Message-Id: <m1n19hvyt1.fsf@halfdome.holdit.com>
>>>>> "Milliwave" == Milliwave <milliwave@rfengineering.freeserve.co.uk> writes:
Milliwave> Hello,
Milliwave> I have an array containing a random width of digits, an exact example of
Milliwave> such an array
Milliwave> is as follows
Milliwave> X11 Y11 X12 Y12 X13 Y13 X14 Y14
Milliwave> X21 Y21 X22 Y22 X23 Y23
Milliwave> X31 Y31 X32 Y32
Milliwave> X41 Y41
[Dave then answered based on your sample.]
Milliwave> Hello Dave
Milliwave> The approach is excellent, but what if the array I already have consists of
Milliwave> numbers
Milliwave> example:
Milliwave> 12 20 30 40 50 34 23 22
Milliwave> 11 10 11 20 20 33
Milliwave> 10 12 22 12
Milliwave> 34 33
Uh, the reason you got a mis-answer is that you said you had an "exact
example". If you don't mean "exact example", then don't say that!
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Mon, 16 Apr 2001 13:28:10 +0200
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: an example Re: How can u group together fields and sum them up
Message-Id: <e6lldtsoml8j1ivsh0q8j0esv33uftj3b7@4ax.com>
[Please put your reply _after_ the (trimmed) text you're responding to]
On 14 Apr 2001 17:14:05 -0500, sdfes@dsf.com (sdfsd) wrote:
> the reca are single line like the following fixed lenght no delimiter each
> line independent of the other ones.
>
> 543343404022001x10000003465Yx20000006573Yx30000000124Nx70000007534Y
>
> acct 7 chars
> date 8 chars
> type1 2 chars
> amount 10 chars
> billable 1 char
[ rest sniped ]
#!/usr/bin/perl -w
use strict;
# INPUT, account, date and 4 (type/amount/bill) groups
my $upfmt = 'a7a8' . 'a2a10a1' x 4;
# OUTPUT: reformat (type/amout/bill) group
my $spfmt = '%2s%010u%1s';
while ( <DATA> ) {
my( $acct, $date, @types ) = unpack $upfmt, $_;
my %seen;
for (my $i = 0; $i < @types; $i += 3) {
if ( exists $seen{ $types[$i] } ) {
$types[ $seen{ $types[$i] } + 1 ] +=
$types[ $i + 1];
splice @types, $i, 3;
$i -= 3;
} else {
$seen{ $types[$i] } = $i;
}
}
print $_; # original
local $\ = "\n";
print "$acct$date", sprintf( $spfmt x (@types/3), @types );
}
# 2nd line should become:
print "543343404022001x10000003465Yx20000014107Yx30000000124N\n"
__DATA__
543343404022001x10000003465Yx20000006573Yx30000000124Nx60000007534Y
543343404022001x10000003465Yx20000006573Yx30000000124Nx20000007534Y
--
Good luck, Abe
Amsterdam Perl Mongers http://amsterdam.pm.org
perl -e '$_=sub{split//,pop;print pop while@_};&$_("rekcah lreP rehtona tsuJ")'
------------------------------
Date: 16 Apr 2001 04:42:37 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: ANNOUNCE: Text::Reform 1.06
Message-Id: <tdllud7f68be51@corp.supernews.com>
Keywords: perl, module, release
==============================================================================
Release of version 1.06 of Text::Reform
==============================================================================
NAME
Text::Reform - Manual text wrapping and reformating
DESCRIPTION
The module supplies a re-entrant, highly configurable replacement
for the built-in Perl format() mechanism.
AUTHOR
Damian Conway (damian@conway.org)
COPYRIGHT
Copyright (c) 1997-2001, Damian Conway. All Rights Reserved.
This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)
==============================================================================
CHANGES IN VERSION 1.06
- Devolved &from and &tag from Text::Autoformat to Text::Reform
(still shipped in Text::Autoformat distribution)
- Tweaked pod to remove invalid markup
- Documented '<<<>>>' and '[[[]]]' fields in &form
- Documented the '~' single character block field in &form
- Modified &form to convert undef fields to ""
- Fixed non-filling of multiple consecutive newlines (thanks Elias)
- Fixed left justification of last line of fully justified text
(thanks Elias)
- Added 'interleave' config flag for &form
See documentation on "Multi-line format specifiers"
(Thanks Elias and Phil)
- Added 'filler' option to control character used to fill
short lines (thanks Phil)
- Made recursive calls to &form respect page numbers correctly
==============================================================================
AVAILABILITY
Text::Reform has been uploaded to the CPAN
and is also available from:
http://www.csse.monash.edu.au/~damian/CPAN/Text-Reform.tar.gz
==============================================================================
------------------------------
Date: 19 Apr 2001 12:10:10 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: another format issue
Message-Id: <9bmkj2$ljh$0@216.155.32.202>
in Perl 5.004 with the following snip from within a rather large format
declaration:
format TEXTOUT =
#[snip]
Unzip @*
$UT::filename,
Store the *.unr file in your Unreal Tournament/Maps directory along with
the others (see guide below), then either doubleclick on it, or type
open @*
$UT::mapname,
in the console, or select the Map in a Botmatch or an Internet game.
#[snip]
.
was how I wound up having to do it, when what I would have preferred was
something like:
format TEXTOUT =
#[snip]
Unzip the @* *.unr file in your Unreal Tournament/Maps directory
$UT::filename,
along with the others (see guide below), then either doubleclick on it,
or type ' open @* ' in the console, or select the Map in a Botmatch
$UT::mapname,
or an Internet game.
#[snip]
.
using @* instead of @<<<<<<<<< values supresses the extra spaces that
would normally result (I wound up using @* a lot in this template
output), however the problem is that the output text wound up including
the characters '@*' _after_ the end of the value of $UT::filename, which
I thought rather weird. i.e. it looked like :
"Unzip the dm-bishop.zip@* *.unr file ..."
does this behaviour still exhibit in perl 5.6.* ? I don't have the
ability to install it yet, as it's still being ported by Chris Nandor,
and I'm not quite prepared to mess with the alpha test releases yet :-)
--
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw";
# ( damn spammers. *shakes fist* take a hint. =:P )
------------------------------
Date: Sun, 15 Apr 2001 22:55:22 GMT
From: "Tom" <tom@hotversion.com>
Subject: Re: apache - autoflush
Message-Id: <uFpC6.21059$BU4.34955@news1.blktn1.nsw.optushome.com.au>
I am using apache 1.3.14 so I don't think thats a problem..
Tom
<nobull@mail.com> wrote in message news:u9g0favyxv.fsf@wcl-l.bham.ac.uk...
> "Tom" <tom@hotversion.com> writes:
>
> > Hi guys I've noted with my apache server it isn't outputing results to
the
> > browser as it receives in fact it waits for the script to finish running
> > before sending anything to the browser..
> >
> > I have used autoflush..
> >
> > anyone know how I can fix this ?
>
> Just a thought, is the browser HTTP/1.1? HTTP/1.0 does not allow
> output from the script to the client until the script is finished.
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Mon, 16 Apr 2001 04:47:21 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: apache - autoflush
Message-Id: <slrn9dkuao.rdr.see-sig@typhoon.xnet.com>
On Sun, 15 Apr 2001 22:55:22 GMT, Tom <tom@hotversion.com> wrote:
> I am using apache 1.3.14 so I don't think thats a problem..
Apache 1.2 buffered output (could be overridden with nph- prefix and
required complete HTTP response headers). 1.3 is not buffered.
If you are absolutely certain that you are unbuffering Perl (does it work
from the shell?), it might be a browser rendering issue if the output is
other than simple text (tables, frames, etc.). For example older MSIE
versions (and Mosaic it was based on) at one time would not display
anything until the connection for the html was closed.
--
David Efflandt (Reply-To is valid) http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Thu, 19 Apr 2001 09:17:30 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: are associative arrays the way to go?
Message-Id: <52btdtkouph248osjf2dbcrv35vk3atic4@4ax.com>
Just in wrote:
>I have two text files, one has quantities and
>names in it, and the other has names and its related generic code.
> I want to add all the quantities that have the same code.
Yes, hashes are the way to go. They are the ideal mechanism to do
in-memory-only database handling.
So you want to look up codes by name, and then add quantities together
for all names that have the same code?
Here it goes. Assuming one line per record and a tab between two fields:
open IN, "codes.txt" or die "Cannot open codes.txt: $!";
while(<IN>) {
chomp;
my($name, $code) = split /\t/;
$code{$name} = $code;
}
open IN, "quantities.txt"
or die "Cannot open quantities.txt: $!";
while(<IN>) {
chomp;
my($name, $qty) = split /\t/;
$qty{$code{$name}} += $qty;
}
($\,$,) = ("\n", "\t");
foreach (sort keys %qty) {
print $_, $qty{$_};
}
--
Bart.
------------------------------
Date: Thu, 19 Apr 2001 10:51:41 +0200
From: "Bastian Ballmann" <ballmann@co-de.de>
Subject: Automated HTML Forms
Message-Id: <20010419.105141.87755422.736@pc035.co-de.de>
Hi @ll!
How can I automatically fill out HTML forms? And how can I spoof a http
referer? Is there anywhere a nice perl module to do this?
Greetz
Basti
------------------------------
Date: Thu, 19 Apr 2001 09:02:11 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Automated HTML Forms
Message-Id: <slrn9dtads.gp5.rgarciasuarez@rafael.kazibao.net>
Bastian Ballmann wrote in comp.lang.perl.misc:
}
} How can I automatically fill out HTML forms? And how can I spoof a http
} referer? Is there anywhere a nice perl module to do this?
Yes, the libwww bundle of modules, available from CPAN
(<http://search.cpan.org/>), or from the libwww homepage
(<http://www.linpro.no/lwp/>).
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Thu, 19 Apr 2001 10:08:09 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Automated HTML Forms
Message-Id: <slrn9dte89.5l9.abigail@tsathoggua.rlyeh.net>
Bastian Ballmann (ballmann@co-de.de) wrote on MMDCCLXXXVIII September
MCMXCIII in <URL:news:20010419.105141.87755422.736@pc035.co-de.de>:
$$ Hi @ll!
$$ How can I automatically fill out HTML forms?
Use LWP and an HTML parser. You also might want to write a smart
module so it actually understands the questions and gives sensible
input.
$$ And how can I spoof a http
$$ referer? Is there anywhere a nice perl module to do this?
By supplying your own referer. Use LWP.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
Date: Thu, 19 Apr 2001 10:30:07 -0000
From: <get_got_it@yahoo.com>
Subject: Banner does not display
Message-Id: <tdtfhfg7040366@corp.supernews.com>
I have problem displaying a banner in a dynamic page. The banner is coming
from a dynamic page (a perl script).For showing the image am using
redirection (Location : $url) in the perl script.
It works fine when the code for the banner is put in a static page(HTML)
or a dynamic page(provided it uses the GET method).
But if one uses the POST method in the form, then the page to which the
form is submitted the banner does not appear. On looking at the
Environment variables i have seen that when HTTP_ACCEPT is */* the banner
appears else when its image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg ... it fails ..when the form is being submitted.
But it works fine when the same page is submitted using GET method.
There is not problem in Netscape. It works fine on all versions of
netscape and versions of IE5 and lower.
Is it a bug in IE5.5 or iam having some problem in my script?
Please some body help me out
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Mon, 16 Apr 2001 15:21:01 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: basic TRUE / FALSE
Message-Id: <3ADB542D.2808B337@home.com>
"R. Utterback" wrote:
>
> Thanks to all. I suspected that these might not be implemented,
> but wanted to make sure. I'm just going to forget about them.
Just as well -- there are places where declaring contants is handy, but
boolean logic isn't one of them. Perl's native boolean context is much
better.
> As a side note, I did try:
>
> use constant TRUE => 1;
> use constant FALSE => 0;
>
> and got the following:
>
> Can't locate constant.pm in @INC at /users/rutterba/bin/gdiff.tst
> line 15 (#1)
>
> I guess my configuration may be scrod.
No, that just means that your Perl is old. All the constant module would
do here is this:
sub TRUE() {1};
sub FALSE() {0};
which I think looks a little kludgy, and also obscures the intent. Using
constant.pm gives a cleaner interface, but the behavior is the same.
-mjc
------------------------------
Date: Tue, 17 Apr 2001 11:15:58 +0200
From: Philip Newton <pne-news-20010417@newton.digitalspace.net>
Subject: Re: Beta Testers/Perl Hackers
Message-Id: <0d2odt8h5d6upfhlai768k9b0q1n46io5m@4ax.com>
On 14 Apr 2001 07:02:36 GMT, anotherway83@aol.com (The Mosquito
ScriptKiddiot) wrote:
> ms/mrs abigail <insert lastname here>
Abigail has no lastname.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
Yes, that really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Mon, 16 Apr 2001 15:36:12 -0500
From: Michael Carman <mjcarman@home.com>
Subject: Re: binmode
Message-Id: <3ADB57BC.2A585964@home.com>
Lyndon Leggate wrote:
>
> I'm writing a file upload script, but the script needs
> to be able to upload in both binary and ascii format. I wrote
> the program and it could upload in ascii files fine, but binary
> ones always got corrupted. So I did a little research, and
> discovered I needed to use binmode on both the uploading file
> handle and the file handle that I was writing the contents
> to. Binary files then worked!!! Yippee .... but now ascii ones don't.
Have you read the binmode() manpage? You should always binmode() binary
files, and never binmode() text ones. You must binmode() a filehandle
*after* opening the file, but *before* any I/O is done. So you'll want
to do something like this:
my $infile = 'foo';
my $outfile = 'bar';
my $file_is_binary = ! -T $infile;
open(IN, $infile) or die "Couldn't open '$infile' [$!]\n";
open(OUT, ">$outfile") or die "Couldn't open '$outfile' [$!]\n";
if ($file_is_binary) {
binmode(IN);
binmode(OUT);
}
# Process files...
> Anyone got any ideas, or know how to change the format to Ascii mode
> (I tried looking in my books, and on the net but couldn't find out
> what the opposite command to binmode is).
There is no "opposite" command for binmode(). You either use it or you
don't. If you don't, text mode is assumed. As of 5.6, you can specify to
use either raw or text mode with an optional second argument, but it's
kind of redundant to explicitly request text mode... At any rate, this
is all in the documentation.
-mjc
------------------------------
Date: Tue, 17 Apr 2001 08:16:36 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: binmode
Message-Id: <8sundt07cggvhem9608fp5slbd44h4uk5v@4ax.com>
Lyndon Leggate wrote:
>So I did
>a little research, and discovered I needed to use binmode on both the
>uploading file handle and the file handle that I was writing the contents
>to. Binary files then worked!!! Yippee .... but now ascii ones don't.
Oh yes they do. WHat is uploaded is the same as what you uploaded. It's
just that the resulting files are not what you want in native format. Is
the server of Unix type? Then all you still need to do is to delete the
"\r" characters, or, slightly safer in some pathetic cases, replace
"\015\012" sequences with plain "\n".
--
Bart.
------------------------------
Date: Thu, 19 Apr 2001 10:10:53 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Can't open file, dies
Message-Id: <slrn9dtedd.5l9.abigail@tsathoggua.rlyeh.net>
Jim Kroger (minorseventhSPAMBLOCK@earthlink.net) wrote on MMDCCLXXXVII
September MCMXCIII in <URL:news:minorseventhSPAMBLOCK-1804011533370001@tritone.csbmb.princeton.edu>:
[]
[] open(LOG) || die "can not open \n"; <<<<<<<<<<<<<<<<<
1) You are not printing $! in your error message.
2) Have you looked in the documentation what one-arg open does?
Perhaps you should.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: Tue, 17 Apr 2001 18:00:10 GMT
From: derek@imarkconsulting.com
Subject: CGI Programmer Wanted
Message-Id: <3adc8434.20397833@news.hala1.on.home.com>
I'm looking for a cgi programmer with Excel experience for contract
work. State your hourly rate and experience. . I'm from Canada so let
me know if your rate is US or Cdn. Reply directly to me please not to
the group.
Derek
------------------------------
Date: Tue, 17 Apr 2001 16:45:12 +1000
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: CGI Timing Question
Message-Id: <bigiain-1704011645120001@bigman.mighty.com.au>
In article <scsldtg5hm9vq59fhv8s2qh6oid7bvva1u@4ax.com>,
sg@loralskynet.com wrote:
>I have a Perl CGI script that queries some databases, massages the
>data returned and prints it out in HTML format. The only problem is
>that the script takes about 30 seconds to run.
>
>What I would like to happen is that when the user pushes a button to
>start the program running, the screen would instantly change to some
>message like "Gathering data...Please wait" and then be replaced by
>the actual data as soon as it is done. Very similar to those web
>pages that say "Page moved. Transferring you to the new location in
>ten seconds".
>
>Any ideas? Thanks!
I haven't been there for a while, but I'm _sure_ one of Randals columns
addresses this requirement. Try <http://www.stonehenge.com/>.
Actually, before making a fool of myself and posting an incorrect url, I
just checked - you want
<http://www.stonehenge.com/merlyn/WebTechniques/col20.html>
cheers
big
------------------------------
Date: Wed, 18 Apr 2001 15:44:34 -0500
From: "David Pratt" <pratt@biop.ox.ac.uk>
Subject: CGI upload and CGITempxxx files
Message-Id: <9bk8n1$96h$1@news.ox.ac.uk>
Hi,
I'm a little confused about how CGI.pm creates it's temporary file.
My code runs as
if (!defined(param()))
#Initial output
start_multipart_form(..... etc);
filefield(-name=>'file' .... etc);
submit(-name=>'submit' .... etc);
end_form()
}
if (param('submit')) {
$submitted_file = param('file');
do regular expression untainting on $submitted_file;
if okay {
continue with processing
*** CGITempxxx file has been created and data uploaded into it
} else {
display error
*** CGITempxxx has been created but empty
}
}
etc
Now... what I'm confused about is, does CGI.pm create the CGITempxxx file
immediately the submit button is pressed and upload the user file into it if
it can? If so, how does CGI.pm know it is safe to upload the file into a
CGITempxxx file?
If I run $submitted_file through my regex to untaint it, then upload the
data with the upload() method, how is this data different, if at all, from
the CGITempxxx file?
Thanks
Dave
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.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 711
**************************************