[19899] in Perl-Users-Digest
Perl-Users Digest, Issue: 2094 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 8 14:10:39 2001
Date: Thu, 8 Nov 2001 11:10:14 -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: <1005246614-v10-i2094@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 8 Nov 2001 Volume: 10 Number: 2094
Today's topics:
Removing whitespace from list / array (mark)
Re: Removing whitespace from list / array (Tad McClellan)
Re: Removing whitespace from list / array <loophole64@home.com>
Re: Removing whitespace from list / array <loophole64@home.com>
repeated string (Houda Araj)
Re: srand or rand question (Anno Siegel)
Re: srand or rand question <alan@headru.sh>
Re: srand or rand question <alan@headru.sh>
Re: srand or rand question <tsee@gmx.net>
Re: Store an object reference as hash key? <djberge@qwest.com>
Re: Store an object reference as hash key? news@roaima.freeserve.co.uk
Re: Store an object reference as hash key? nobull@mail.com
Re: stripping garbage from head of file <nick.alexander@verizon.net>
Re: stripping garbage from head of file (Garry Williams)
Re: Sucking in /etc/passwd <XSPAMmagicrob@newsguy.com>
Re: unexpected behaviour behind a protecte directory <google@psc-it.nl>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Nov 2001 08:52:56 -0800
From: mark.adaoui@siemens.at (mark)
Subject: Removing whitespace from list / array
Message-Id: <487f3b0f.0111080852.13638fbc@posting.google.com>
Hi All,
Firstly, let me apologize if this is a simple, stupid, easily
remedied, anything you might like to add, query. I am obviously new to
perl.
I have a text file that i want to remove tokens from, in order to
create an array / list of just the tokens.
I open the file read it in to a scalar then use m/ to match the tokens
i want,
then i print @Tokens;
My code:
#!usr/local/bin/perl
#open file with comment's removed
open(Telegram, "pcbdata.asn") or die "Can't open pcbdata.asn: $!\n";
while (<Telegram>){
#this for, removes whitespace from the beginning & the eos.
for ($Tokens) {
s/^\s+//;
s/\s+$//;
}
s/--.*$//g; #remove comments
push @Tokens, m/[0-9]*|[a-zA-Z_]*[{}]*[()]*[::=]*/gs;
}
m/([0-9]*|[a-zA-Z][a-zA-Z_]*|[{}()]|[::=])/g;
print join "\n",@Tokens;
What i actualy get printed is an array with lots of added whitespace
between each Token i.e
PcbData
Data
Definitions
::=
BEGIN
CardfailOfActiveCard
::=
SEQUENCE
{
..........
I have tried several ways to remove this whitespace, though none have
worked.
When I remove "\n" newline in the print, i get this with no
whitespace:
PcbDataDEFINITIONS::=BEGINCardFailOfActiveCard::=SEQUENCE{CardFailstateENUMERATED................
Basicly 1 continuous string of all the Tokens, as i would expect.
So to me it appears that by adding the "\n" newline after each Token
to the array, also adds lots of whitespace.
Is it possible to remove this whitespace, so i end up with a print, of
all the Tokens with 1 on top of the other i.e:
Pcbdata
DEFINITIONS
::=
BEGIN
CardFailOfActiveCard
::=
SEQUENCE
{
CardFailState
ENUMERATED
If anyone can offer me some suggestions, it would realy help
alleiviate my ulcer.
Thanx 4 your time & consideration
AN00b
------------------------------
Date: Thu, 08 Nov 2001 18:03:40 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Removing whitespace from list / array
Message-Id: <slrn9ulfe8.jtr.tadmc@tadmc26.august.net>
mark <mark.adaoui@siemens.at> wrote:
>Firstly, let me apologize if this is a simple, stupid, easily
>remedied, anything you might like to add, query. I am obviously new to
>perl.
What you have is a subtle, yet frequently encountered problem.
>My code:
>#!usr/local/bin/perl
Please in the future, make that:
#!usr/local/bin/perl -w
use strict;
Ask for all the help you can get.
>#open file with comment's removed
>open(Telegram, "pcbdata.asn") or die "Can't open pcbdata.asn: $!\n";
^^^^^^^^
It is conventional to use all UPPER CASE for filehandles.
If you ever happen to use some module that imports a 'Telegram'
subroutine, your code will stop working...
> while (<Telegram>){
> #this for, removes whitespace from the beginning & the eos.
> for ($Tokens) {
If you had enabled warnings, it would have pointed out an error here.
You have never put anything into $Tokens. The line from the file
is in a different variable, $_
> s/--.*$//g; #remove comments
^
^
A "g" option is not needed, as you have an anchor in your pattern.
(ie. you cannot match "end of string" more than once anyway,
'cause the string only _has_ one "end".
)
> push @Tokens, m/[0-9]*|[a-zA-Z_]*[{}]*[()]*[::=]*/gs;
A "s" option is not needed. It affects only the meaning of the
dot character, and your pattern does not even _have_ a dot
character.
I'll make some more comments about that pattern below too.
> }
>m/([0-9]*|[a-zA-Z][a-zA-Z_]*|[{}()]|[::=])/g;
This pattern match does not do anything.
Your program should behave identically when you remove it.
(try it and see if I'm right)
What were you trying to accomplish there?
As a general rule, a "naked pattern match" (ie. m///) is
nearly always a mistake. It should be in a conditional test
(eg. if) or be otherwise "used" somehow.
>print join "\n",@Tokens;
>
>What i actualy get printed is an array with lots of added whitespace
^^^^^^^^^^^^^^^^
No, _you_ added the whitespace (newlines) when you wrote the join().
What you have is lots of "empty strings" (length zero), not
"whitespace" (one of these 5 characters [ \n\r\f\t]).
Technically precise terminology is important when discussing
things as technical as programming a machine.
>I have tried several ways to remove this whitespace,
Well you _could_ remove the empty strings:
@tokens = grep length, @tokens; # can't bring myself to use
# Initial Caps in variable names...
but it would be much better to not generate the empty strings
in the first place.
>When I remove "\n" newline in the print, i get this with no
>whitespace:
Now that you know they are empty strings rather than whitespace,
it should be clear why you get the output shown.
>Basicly 1 continuous string of all the Tokens, as i would expect.
But perl printed a bunch of empty strings (which make no output
of course) in between the tokens.
>So to me it appears that by adding the "\n" newline after each Token
>to the array, also adds lots of whitespace.
No, it just makes the empty strings visible to you.
>Is it possible to remove this whitespace, so i end up with a print, of
>all the Tokens with 1 on top of the other i.e:
Probably, but we cannot really repair your pattern as you have
not described at all what it was you were trying to do (ie.
what are legal tokens?).
Your pattern has several strangenesses that makes me think
you are waaayyy off from what you intended.
First and foremost, a careful examination of your pattern
reveals that each part is optional. This allows your pattern
to match "nothing" (empty strings), which is why you are
getting the undesired array elements.
If you completely describe all your possible tokens, then we could
probably help you tokenize them (hint).
A few more anomolies in your pattern:
[{}]*
and
[()]*
that matches continuous series of curlie brackets/parens such as:
{{{}}}
{{{{{{
}{}{}{
is that what you wanted?
[::=]*
that is *exactly equivalent* to
[:=]*
putting a character into a character class once is enough. Mentioning
it again does not change what the char class will match.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 8 Nov 2001 12:50:01 -0600
From: "Jason Kelley" <loophole64@home.com>
Subject: Re: Removing whitespace from list / array
Message-Id: <9sek1p$meu$1@news.chorus.net>
I don't think the problem is with your print statement. I think your
matching statement may be matching whitespace and adding it to your list.
"mark" <mark.adaoui@siemens.at> wrote in message
news:487f3b0f.0111080852.13638fbc@posting.google.com...
> while (<Telegram>){
> #this for, removes whitespace from the beginning & the eos.
> for ($Tokens) {
> s/^\s+//;
> s/\s+$//;
> }
After this match, the contents of your list may be:
@Token = ('PcbData', ' ', 'Data', ' ', 'Definitions', ' ', '::=', ' ',
'BEGIN', ' ', ' ', ' ', ' ', ' ', ' ', 'CardfailOfActiveCard', ' ', '::=',
'SEQUENCE')
So when you print a \n before each element it seems extra whitespace is
added, but in reality it may just be printing elements that are empty or
include only whitespace. Let's see the contents of the text file you are
reading from.
-Jason
------------------------------
Date: Thu, 8 Nov 2001 12:53:17 -0600
From: "Jason Kelley" <loophole64@home.com>
Subject: Re: Removing whitespace from list / array
Message-Id: <9sek7t$mfb$1@news.chorus.net>
Oops, showed the wrong piece of code. This is your matching statement I
meant to referr to:
>push @Tokens, m/[0-9]*|[a-zA-Z_]*[{}]*[()]*[::=]*/gs;
-Jason
------------------------------
Date: 8 Nov 2001 11:00:58 -0800
From: Houda.Araj@cogmedia.com (Houda Araj)
Subject: repeated string
Message-Id: <21916d9f.0111081100.34a2f06d@posting.google.com>
I have a file that I want a perl script to (1) read, (2) find all
identical repeated strings within that file and (3) mark the repeated
strings with <>
Any info is appreciated. Thanks!
------------------------------
Date: 8 Nov 2001 14:10:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: srand or rand question
Message-Id: <9se3p7$d7b$2@mamenchi.zrz.TU-Berlin.DE>
According to alan@ <alan@headru.sh>:
> Hi,
> Now this is to do with Perl, even though I call the script from a web page.
>
> I have a script that creates random passwords and then encrypts them using
> crypt().
>
> It all works fine, but...
>
> I want to create more than one password at a time. If I set a "for" loop
> going, I get the same password generated again and again.
>
> I understand that Perl ver 5.004 and higher, sets srand automatically at the
> start of the script, and to reset srand will most likely make for less
> random figures being generated.
>
> I have tried generating 1 password. Then generating the next, 1 by 1 I get
> the result I want. This leads me to suspect that the current process id
> holds the key to the random values.
>
> So, Any ideas on how I can loop the random generation, with a new srand
> value for each iteration, without exiting the script time after time ?
>
> (I haven't included code because the code works, it's the principle of
> getting round srand thats bugging me ! )
A random password generator generates the same password over and over,
and you say it works? You should have included code. I bet you are
calling srand inappropriately, probably inside the loop, but who knows.
Anno
------------------------------
Date: Thu, 8 Nov 2001 14:16:03 -0000
From: "alan@" <alan@headru.sh>
Subject: Re: srand or rand question
Message-Id: <9se438$j5c$1@newsg2.svr.pol.co.uk>
Ok, heres the code anyway....
the meaty bit....
sub encode
{
$list = "0"; # trying to eliminate var definitions, still makes no
difference !
# Change length of password $i<6; make it six characters long.
for($i=0; $i<10;
+){
# First random sequence determines if it will be
# Upper case, Low case, or Numbers.
$list =int(rand 3) +1;
if ($list ==1){
# Char set 49 - 57 are numbers but I have omitted the
# number 0 to avoid user confusion with the letter O.
# to remove the number 1 change line to $char =int(rand 7)+50;
$char =int(rand 7)+50;
}
if ($list ==2){
# Char set 65 - 90 are capital letters.
$char =int(rand 25)+65;
}
if ($list ==3) {
# Char set 97 - 122 are lower case letters.
$char =int(rand 25)+97;
}
# Converts number to ASCII equivelent.
$char =chr($char);
$password .= $char;
}
$encrypted = crypt($password, substr($password,0,2));
$basic .= $encrypted; # adds my string to the beginning of the password
}
1; # this is because the code is in a separate file that I "require" or "do" from # the main script.
###########################################
The sub that calls the above code...
#########################
sub do_the_loop
{
print "Content-type: text/html\n\n"; ## lets me know it's working on the page
for ($loop_index = 1; $loop_index <= $count; $loop_index++){
&encode; # call the sub shown above .
&encode2; # a different version of the above -
# to generate a second password.
$newentry = join (",", $basic, $newpass); # create a pair
push(@collect, $newentry); # add the pair to the list
$basic = $myuser; # reset the input variable that is added to the front of one #of the passwords
$newpass = ""; # reset the second generated variable
print "Done it<br>"; # lets me know each time a pair is generated
}
open (OUTF, ">>test.dat"); # writes the generated list to disk.
$" = "\n"
;
print OUTF "@collect";
close (OUTF);
}
##################################
Alan
------------------------------
Date: Thu, 8 Nov 2001 14:19:16 -0000
From: "alan@" <alan@headru.sh>
Subject: Re: srand or rand question
Message-Id: <9se499$g8b$1@newsg3.svr.pol.co.uk>
Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote in message
news:9se3p7$d7b$2@mamenchi.zrz.TU-Berlin.DE...
> According to alan@ <alan@headru.sh>:
<snip>
> A random password generator generates the same password over and over,
> and you say it works? You should have included code. I bet you are
> calling srand inappropriately, probably inside the loop, but who knows.
>
> Anno
I have now added the code, see if you can find srand anywhere.
And it does work, just one at a time per execution of the script.
Alan
------------------------------
Date: Thu, 8 Nov 2001 17:56:39 +0100
From: "Steffen Müller" <tsee@gmx.net>
Subject: Re: srand or rand question
Message-Id: <9sedc3$gce$06$1@news.t-online.com>
"alan@" <alan@headru.sh> schrieb im Newsbeitrag
news:9se438$j5c$1@newsg2.svr.pol.co.uk...
| Ok, heres the code anyway....
|
| the meaty bit....
|
#!/bin/perl
use strict; # always!
use warnings; # always!
my @chars = ('a' .. 'z', 'A' .. 'Z', 0 .. 9, '_', '');
my @crypted_passwords;
my $max_length = 8;
my @salt = ( int( rand 256 ), int( rand 256 ) );
foreach ( 0 .. 99 ) {
my $password = '';
foreach ( 1 .. $max_length ) {
$password .= $chars[ int( rand @chars ) ];
}
print $password . ' -> ';
$password = crypt( $password, chr( $salt[0]++ ) . chr( $salt[1]++ ) );
$salt[0] = $salt[0] % 256;
$salt[1] = $salt[1] % 256;
print $password . ', ';
print $salt[0] . ' ' . $salt[1] . "\n";
push @crypted_passwords, $password;
}
HTH,
Steffen
--
$_=q;0cb212c210b0bb010c0113bb0c410c0b516c0bb3d212c2b0b0b016b6cb2b2c21010c0
b41110b3bba0e0c0d2c4b2b6bc013d2c0d0b01012b0b0;;s/\n//g;s/(\d)/$1<2?$1:'0'x
$1/ge;s/([a-f])/'1'x(ord($1)-97)/ge;print"\n";$o=$_;push@o,substr($o,$_*8,
8)for(0..24);for(@o){print"\0"x(26-$i).chr(oct('0b'.($_)))."\n";$i++}#st_m
------------------------------
Date: Thu, 8 Nov 2001 08:23:46 -0600
From: "Mr. Sunblade" <djberge@qwest.com>
Subject: Re: Store an object reference as hash key?
Message-Id: <gwwG7.79$v37.82997@news.uswest.net>
"Markus Dehmann" <markus.cl@gmx.de> wrote in message
news:c1e48b51.0111080244.5684d7be@posting.google.com...
> Can I store a reference to a whole object as hash key?
Yes - see the Tie::RefHash module, included with Perl 5.6.1 (not sure about
earlier versions).
#!/usr/local/bin/perl -w
use strict;
use Tie::RefHash;
use Test;
my $t1 = Test->new;
$t1->set_value("abc");
my $t2 = Test->new;
$t2->set_value("xyz");
my %hash;
tie %hash, 'Tie::RefHash';
%hash = ($t1 => 1, $t2 => 1);
# prints 'xyz' and 'abc'
foreach(keys %hash){
print $_->get_value, "\n";
}
Regards,
Mr. Sunblade
------------------------------
Date: 8 Nov 2001 14:35:57 GMT
From: news@roaima.freeserve.co.uk
Subject: Re: Store an object reference as hash key?
Message-Id: <3bea984d@news.netserv.net>
Markus Dehmann <markus.cl@gmx.de> wrote:
> Can I store a reference to a whole object as hash key?
perldoc -q 'How can I use a reference as a hash key'
------------------------------
Date: 08 Nov 2001 18:08:27 +0000
From: nobull@mail.com
Subject: Re: Store an object reference as hash key?
Message-Id: <u9y9lhp23o.fsf@wcl-l.bham.ac.uk>
markus.cl@gmx.de (Markus Dehmann) writes:
> Can I store a reference to a whole object as hash key?
Not a builtin hash.
> Is there a possibility to do sth like that?
Tie::RefHash
Anyone know why this does not appear in the main CPAN module list?
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 08 Nov 2001 14:08:03 GMT
From: "nick.alexander" <nick.alexander@verizon.net>
Subject: Re: stripping garbage from head of file
Message-Id: <7lwG7.1525$vM6.99103@typhoon1.gnilink.net>
You've been a great help. I really appreciate that. I still have a question.
isn't:
s/^.*(<datafile>)/$1/;
saying 'match from the beginning of the string, any number of characters,
then '<datafile>' and substitute them with all of those characters that were
just matched? That doesn't make sense to me . . . It almost would if $1 was
a variable with the string '<datafile>' in it. I'll try this:
s/^.*(<datafile>)/<datafile>/;
to mean, 'find everything up to and including '<datafile>' and substitute it
with the string '<datafile>'. Am I right?
Again thanks for your help. If i understand your one-liners:
$ perl strip input.file > output.file
'strip' must be the name of the script that strips off the garbage, right?
There's no built-in 'strip' function, is there? But actually, my situation
forces me to precompile the perl script into an executable, so the
one-liners can't help. Interesting, though.
Thanks,
- Nick
"Garry Williams" <garry@ifr.zvolve.net> wrote in message
news:slrn9ujv6v.qv.garry@zfw.zvolve.net...
> On Thu, 08 Nov 2001 01:48:06 GMT, nick.alexander
> <nick.alexander@verizon.net> wrote:
>
> > i'm new to perl, and realize that i don't understand alot. please help
if
> > you can.
> >
> > i have a text file that when created will always have a string of
garbage at
> > its head. i want to strip the garbage from the file.
>
> [ snip ]
>
> > the 'good' part of the file always starts with '<datafile>', so i
thought if
> > i had the line, i could substitute the garbage with an empty string .
but i
> > can't figure out how to write it . . .
> >
> > $_ = s!/<xml>//; #doesn't seem to work ???
>
> I guess that "doesn't seem to work ???" means won't even compile.
>
> Maybe you meant to type
>
> $_ = s/<xml>//;
>
> but even though that will compile, it's probably not what you
> intended. I get the feeling I'm debugging a typing error here instead
> of looking at actual code you've tried and then copy/pasted into your
> post. Am I right?
>
> Well, I'll bite...
>
> That first substitutes nothing for the string `<xml>' in the $_
> variable and assigns the *result* of the substitute to $_ (replacing
> the just substituted string). The *result* of a substitute operation
> (see the perlop manual page, "s/PATTERN/REPLACEMENT/egimosx") is the
> number of substitutions made (maximum of one here since /g wasn't
> used) or false, if the match failed. If I understand what you think
> your data looks like, that would change the first line to a 1 and the
> subsequent lines to false (either "", 0, "0" or undef). probably not
> what you intended.
>
> Maybe you meant
>
> $_ =~ s/<xml>//;
>
> which is the same as
>
> s/<xml>//;
>
> instead.
>
> But that *removes* part of what you seem to want to preserve.
>
> Assumptions.
>
> 1. Only the first line needs altering.
>
> 2. All characters starting at the beginning of the first line up to,
> but not including the string `<datafile>', should be deleted.
>
> Try this:
>
> #!/usr/bin/perl -w
> use strict;
> $_ = <>;
> s/^.*(<datafile>)/$1/;
> print;
> print while <>;
>
> Now use it like this:
>
> $ perl strip input.file > output.file
>
> Or maybe you'd like the one-liner:
>
> $ perl -wpe 'BEGIN{$_=<>;s/^.*(<datafile>)/$1/;print}' input > output
>
> --
> Garry Williams
------------------------------
Date: Thu, 08 Nov 2001 16:47:31 GMT
From: garry@ifr.zvolve.net (Garry Williams)
Subject: Re: stripping garbage from head of file
Message-Id: <slrn9uldp3.11m.garry@zfw.zvolve.net>
On Thu, 08 Nov 2001 14:08:03 GMT, nick.alexander
<nick.alexander@verizon.net> wrote:
> You've been a great help. I really appreciate that.
Well, I'm glad to help, but I have already replied to you in E-mail
because you didn't indicate that this was also posted. Please don't
do that. Now I have to reply again.
Since we're on the subject, please put your replies *after* the
suitably trimmed quoted text you're replying to. It keeps the
ordering of time straight and makes it easier for others to follow the
discussion if their news servers haven't recieved all of the articles.
> I still have a question.
> isn't:
>
> s/^.*(<datafile>)/$1/;
^ ^
^ ^
> saying 'match from the beginning of the string, any number of characters,
> then '<datafile>' and substitute them with all of those characters that were
> just matched?
No. It is "match from the beginning of the string, any number of
characters" that are not new line characters followed by `<datafile>'
_and_ capture `<datafile>' in the $1 variable. The parentheses
*capture* into the $1, $2, ... variables.
You should read the perlre manual page.
> That doesn't make sense to me . . . It almost would if $1 was
> a variable with the string '<datafile>' in it. I'll try this:
>
> s/^.*(<datafile>)/<datafile>/;
Okay, but now the parentheses are not necessary. This is fine
(without them).
See perlre.
> to mean, 'find everything up to and including '<datafile>' and substitute it
> with the string '<datafile>'. Am I right?
Yes.
> Again thanks for your help. If i understand your one-liners:
>
> $ perl strip input.file > output.file
>
> 'strip' must be the name of the script that strips off the garbage, right?
Right.
> There's no built-in 'strip' function, is there?
Well, on my machine there *is*. But is has nothing to do with the
perl command and specifying the file that the perl interpreter is
supposed to compile and execute. I chose to call it `strip'. It has
nothing to do with the strip(1) command. Since it's confusing, I
would now choose another name.
> But actually, my situation
> forces me to precompile the perl script into an executable, so the
> one-liners can't help.
That's just the way you run a Perl script *and* hand it its input and
redirect its output. The code I posted reads from STDIN (or the
file(s) specified on the command line) and writes to STDOUT. It's
called a filter. It is often quite useful to design these kinds of
things this way so that they can be combined with other commands in a
pipeline.
> Interesting, though.
>
> Thanks,
You're welcome. Hope it helps.
[ snipped quote of entire article and sig ]
--
Garry Williams
------------------------------
Date: Thu, 08 Nov 2001 07:39:15 -0700
From: Rob <XSPAMmagicrob@newsguy.com>
Subject: Re: Sucking in /etc/passwd
Message-Id: <av5lutktgvlnmk4v6lpaffb7mpr903vf8k@4ax.com>
Thanks David and Martien. I really appreciate the good answers. This
whole thing wasn't about me feeling a need to actually use the "map"
in my program, but rather just know how it could be done. I'm
actually going to stick with a loop, mainly for readability.
As far as the "getpwent", I was aware of it but had forgotten about it
at the time I did the post. After I got to thinking about how I'd
handle both "trusted" and non-"trusted" modes (on HP-UX hosts), I dug
back into my notes and found it.
Thanks again for the replies -- I still *LOVE* this newsgroup!
--
Rob
(magicrob@newsguy.com)
------------------------------
Date: Thu, 08 Nov 2001 17:40:57 GMT
From: "Kirst Hulspas" <google@psc-it.nl>
Subject: Re: unexpected behaviour behind a protecte directory
Message-Id: <JszG7.814$rW6.489@castor.casema.net>
I found your previous posting on google and *not* :( on my news site. Sorry
about that.
And Yes, perl can be written badly but I doubt if it is the cause this time.
The cgi below behaves *exactly* the same when called from:
<form method="POST" action="http://www.mysite.nl/bin/tst.cgi">
<input type="text" name="Name" value="" size="9" maxlength="9">
<input type="submit" name="send" value=" Send ">
</form>
#!/usr/bin/perl
print "Content-type: text/plain\n\nHello World\n";
exit(0);
It again returns the input unchanged after a 'backspace' when called from
any normal subdir and returns with cleared text when called behind a
password proteced directory.
I tried a proteced directory on a slash server and there it returns in
*both* cases the original field values. So blame th WN server or if this is
this known behaviour too, could you tell me what causes it, whether it is
avoidable, and how?
Thanks, kirst
btw. how do I call your signature? it crashes on me.
Wyzelli <wyzelli@yahoo.com> schreef in berichtnieuws
PIrG7.2$KH6.128@vicpull1.telstra.net...
> "Kirst Hulspas" <google@psc-it.nl> wrote in message
> news:TqrG7.719$rW6.43@castor.casema.net...
> > A perl-script I'm using works fine for what it is designed to.
> > After POST-ing it returns a recap that can be approved or not.
> > If I use the 'back button' (or backspace key) to review my input,
> > it returns the original values in the filled-in form fields. So far so
> good.
> > However, if the same html-page is submitted behind a password protected
> > directory, the back-button returns an *empty* form, with all fields
reset
> to
> > blank.
> >
> > This behaviour applies to the browsers IE5, NS and Mozilla but *not* to
> > Konqueror. The webserver is a linux WN-server 2.2.9, using authwn as
> > authorisation module for the protected directories.
> >
> > I have a feeling this behaviour is not directly caused by perl or the
> > browser. The ISP does not want to answer to this case as it concerns a
> > cgi-script they did not devellop themselves.
> > Has anyone got a clou on the origin of this behaviour and/or a
> work-around??
>
> This is known behaviour of the script you are using. Have you checked the
> web site? BTW as I said last time, not very well written scripts...
>
> Wyzelli
> --
> push@x,$_ for(a..z);push@x,' ';
> @z='092018192600131419070417261504171126070002100417'=~/(..)/g;
> foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
>
>
------------------------------
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 2094
***************************************