[10459] in Perl-Users-Digest
Perl-Users Digest, Issue: 4051 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 23 02:04:02 1998
Date: Thu, 22 Oct 98 23:00:20 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 22 Oct 1998 Volume: 8 Number: 4051
Today's topics:
Re: += operator produces error, = operator doesn't? (Ronald J Kimball)
Re: += operator produces error, = operator doesn't? (Sam Holden)
Re: += operator produces error, = operator doesn't? (Peter J. Kernan)
Re: .gz extention?????? (Tad McClellan)
3D array: request lengths? (Justin Wilde)
Re: CGI.pm and $query->self_url problems (Ronald J Kimball)
Re: Count files in a dir SSI or CGI <gadget@bc.sympatico.ca>
Re: End of File..... <emills@harris.com>
Re: how do you add three variables (Tad McClellan)
How do I determin if a remote-address is a FQDN or IP <robert@chalmers.com.au>
Re: how to process fixes length record files <sugalskd@netserve.ous.edu>
Re: how to redirect POST parameters ? <emills@harris.com>
Re: How to view lexical variables in the Perl Debugger? (Ronald J Kimball)
Re: How to yield processor time? <bfb@att.net>
HTTP POST (John)
Re: Info on crypt() (Martin Vorlaender)
Interpolated, squared? <bsteer@gwi.net>
making a variable variable? <emills@harris.com>
Re: Marrying S-Lang and Perl -- boon or blasphemy? (John E. Davis)
Re: Newbie tries to create time-limited form! (Martien Verbruggen)
Re: Newbie tries to create time-limited form! (Michael J Gebis)
Re: PERL & simple flat file database??? <mph@pcola.gulf.net>
Re: PERL & simple flat file database??? (John Hardy)
Re: Perl & Y2K - booby trap code (Ronald J Kimball)
Re: Problem with perl scripts... (Ronald J Kimball)
Re: Q:Array of Lists (Tad McClellan)
Re: Resubmit: Kindly help with file locking (Brendan O'Dea)
write a long string... (GEMINI)
Re: write a long string... <ajohnson@gatewest.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 22 Oct 1998 23:43:40 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: += operator produces error, = operator doesn't?
Message-Id: <1dhbooz.1chipidfwy7k2N@bay2-265.quincy.ziplink.net>
Uri Guttman <uri@fastengines.com> wrote:
> other posts show it with list operators too. and i saw it with
>
> print( $n += 4 );
>
> where $n cannot be mistaken for an indirect file handle.
Umm... Why can't it?
print (STDOUT "hello world\n");
certainly works. And so does
$fh = 'STDOUT';
print ($fh "hello world\n");
> so it may be more than just list operators. i think it is a general
> parse problem with a space before x= after built in operators. x= in
> expressions seems to be fine.
But you're right about that.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 23 Oct 1998 04:34:12 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: += operator produces error, = operator doesn't?
Message-Id: <slrn7301q4.t4b.sholden@pgrad.cs.usyd.edu.au>
On 22 Oct 1998 16:19:47 -0400, Uri Guttman <uri@fastengines.com> wrote:
>>>>>> "JL" == James Ludlow <ludlow@us.ibm.com> writes:
>
> JL> Sean McAfee wrote:
> >> > perl -e 'print $n += 5' syntax error at -e line 1, near "+="
> >> Execution of -e aborted due to compilation errors.
> >>
> >> > perl -e 'print $n = 5' 5
> >>
> >> What the..? I checked perlop and didn't see that += and = have any
> >> sort of differing semantics.
>
> JL> Well, I can solve your problem, but I can't completely answer your
> JL> question. It's not the operators that are screwed up, it's
> JL> print(). print() thinks that $n is your filehandle.
>
> JL> Try: print +$n += 5;
>
> JL> Now, as to why print parses += differently than =, I have no idea.
>
>print doesn't parse, perl does.
>
>but this fails too:
>
>perl -e 'print ($n += 4)'
>
>but this works:
>
>perl -e 'print ($n+= 4)'
>
>i think this should be reported to p5p with perlbug. if it is not a bug
>then someone could explain the parsing of it. the parens should make it
>an expression. why = works and += doesn't is buggy to me.
The parens will be interpreted as a being the parens around the arguments
of a function call...
However, the original behaviour I would classify as a bug. I too would
have thought that = and += should behave the same way.
--
Sam
People get annoyed when you try to debug them.
--Larry Wall
------------------------------
Date: 23 Oct 1998 04:49:18 GMT
From: pete@localhost.localdomain (Peter J. Kernan)
Subject: Re: += operator produces error, = operator doesn't?
Message-Id: <70p1sf$3ha$1@alexander.INS.CWRU.Edu>
In article <aUNX1.3093$fS.9750167@news.itd.umich.edu>,
mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:
[...snip...]
> Done. Here's my report, for anyone who cares:
[...snip...]
would these differences of opinion be of the same class?
~> perl -e 'print $n++,"\n"'
0
~> perl -e 'print $n--,"\n"'
~> perl -e 'print --$n,"\n"'
-1
~> perl -e 'print ++$n,"\n"'
1
hmm... looks like someone above got the short straw.
or is this because ++ is "magical", if so is this secret magic?
perl -v
This is perl, version 5.004_04 built for i586-linux
(same old on 5.005_02)
--
Pete Kernan CWRU Physics and Statistics Depts
http://theory2.phys.cwru.edu/~pete
------------------------------
Date: Thu, 22 Oct 1998 21:16:28 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: .gz extention??????
Message-Id: <stoo07.ebq.ln@flash.net>
Mattjm82 (mattjm82@aol.com) wrote:
: How do I use a file with the extention of .gz? Is there a spetial program to
: unzip it can I just run it?
That is the filename extension used by Gnu Zip.
'gzip' compresses.
'gunzip' uncompresses.
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 22 Oct 1998 22:54:31 -0600
From: jwilde@openskies.com (Justin Wilde)
Subject: 3D array: request lengths?
Message-Id: <36300C07.4DC4BCB@openskies.com>
Here's a multidim. array I've set up.
I would like to run this beast through
a loop to make comparisions. I manage
to reference individual elements with:
$fareTableCodes -> [1] [0] [1];
# references element J
However, I can't figure out how to request
the num of elements in each of these lists.
(There are 3 levels of lists... see them all?)
Thanks in advance,
Justin
$fareTableCodes =
[
[
[ "B" , "D" , "F" ] ,
[ "A" , "R" ]
] ,
[
[ "H" , "J" , "C" , "R" ] ,
[ "F" , "C" , "D" , "C" ] ,
[ "R" , "D" , "D" ]
]
]
------------------------------
Date: Thu, 22 Oct 1998 23:43:42 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: CGI.pm and $query->self_url problems
Message-Id: <1dhbpcl.6rj8d11v1lr9cN@bay2-265.quincy.ziplink.net>
Clinton Gormley <cgormley@netcomuk.co.uk> wrote:
> So the script is called recursively. in order to preserve state, I am using
> the CGI method self_url to generate URL + query string as a redirection.
> (running on NT 4 + IIS).
>
> The problem is (if the URL is http://www.foo.com/cgi-bin/bar.pl?a=1&b=2),
> self_url is generating url's life
> http://www.foo.com/cgi-bin/bar.pl/www.foo.com/cgi-bin/bar.pl/www.foo.com/cgi
> -bin/bar.pl?a=1&b=2)
>
> Obviously, it is putting in the URL as many times as the script has been
> called. I've got around this by redirecting to
> $query->url.'?'.$query->query_string.
>
> Is this a problem with CGI.pm, or IIS, or something I'm doing.
I'd have to assume it's either IIS, or something you are doing. I did
not have any problems with the following script:
#!/usr/local/bin/perl5.004_04
use strict;
use CGI;
my $query = new CGI;
print $query->header;
my $self_url = $query->self_url;
print <<EOHTML;
<HTML>
<HEAD>
<TITLE>Self Url</TITLE>
</HEAD>
<BODY>
<A HREF="$self_url">$self_url</A>
</BODY>
</HTML>
EOHTML
__END__
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 22 Oct 1998 20:04:16 -0700
From: Fred Richards <gadget@bc.sympatico.ca>
To: cautious_lurker@my-dejanews.com
Subject: Re: Count files in a dir SSI or CGI
Message-Id: <362FF230.B404B88B@bc.sympatico.ca>
cautious_lurker@my-dejanews.com wrote:
> Does anybody know of a SSI or CGI that will count the number of files in a dir
> [and sub dir's] and put the result in html.
> The cgi would work better for me it would only have to be run once or twice a
> day [by cron]
>
> Thanks
> C_L
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
opendir(DIR, ".");
@files = readdir(DIR);
closedir(DIR);
# *** Evaluate @files array in a scalar context ***
$files_found = @files;
print "Files found: ", $files_found;
Note: It will include '.' and '..' (WIN95)
Hope this helps
Fred Richards
The Gadget Guy
------------------------------
Date: Wed, 21 Oct 1998 14:01:21 -0400
From: "PERL ROCKS!" <emills@harris.com>
Subject: Re: End of File.....
Message-Id: <362E2171.6DA570AF@harris.com>
the filehandle is always reliable:
while (<F>) {stuff}
of course you can use it in other contexts as well, such as
if (!<F>) {}
unless (<F>) {}
Tony Curtis wrote:
> Re: End of File....., Darren <dward@pla.net.au> said:
>
> Darren> occasionally for a weird reason and I'd like a
> Darren> better answer.
>
> while (<HANDLE>) {
>
------------------------------
Date: Thu, 22 Oct 1998 21:54:27 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: how do you add three variables
Message-Id: <35ro07.lfq.ln@flash.net>
Scratchie (upsetter@ziplink.net) wrote:
: Marcus J. Foody <marx@idiom.com> wrote:
: : Hello, I know this is a lame question. How do you add three variables
: : together.
: : For example, I want to sum up three fields into on variable.
: : This is what I have. Is this a correct format?
: : $sum = $data[14]+$data[15]+$data[16];
: What happened when you tried it?
WHWYTI
I'd seen that occasionally in the past.
Someone (who was that anyway?) suggested that it be an
"official acronym" within the last ten days or so.
I've seen occasions for its use more frequently since then.
I vote for official status too (and fame for the coiner).
Are any of the "Perl Certification Authorities" still reading
the group?
Wanna kick in a Certification for WHWYTI so it'll be
all official-like?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 23 Oct 1998 14:18:04 +1000
From: "Robert Chalmers" <robert@chalmers.com.au>
Subject: How do I determin if a remote-address is a FQDN or IP
Message-Id: <36300184.0@news.chalmers.com.au>
I'm trying to discover if an incoming $remote address that needs processing
is a fully qualified domain name, or is a valid format Ip address. If it's
neither, dump the attempt to connect. It doesn't have to do lookup or
anything, just check that it is in a valid format, like freds.computer.com
or bills.computer.net or even bill.com, but not just "bill". The same for
the IP. It has to be xxx.xxx.xxx.xxx, and not just xxx.
Of course if someone has a routine that also does lookups to verify that
what is coming in is not just some bogus address, then that would be even
better, but at this point I'm trying to keep it simple.
I'm getting $remote from the ENV, like this
$remote = $ENV{'REMOTE_ADDR'};
Trouble is, its getting any old thing that some programs use instead of the
full domain name or ip.
Thanks for any ideas,
Robert
------------------------------
Date: 23 Oct 1998 05:55:09 GMT
From: Dan Sugalski <sugalskd@netserve.ous.edu>
Subject: Re: how to process fixes length record files
Message-Id: <70p5nt$s0o$1@news.NERO.NET>
Tim Schelfhout <tim.schelfhout@telenet.be> wrote:
: Hi there,
: I've been trying to process files with a fixed length records content
: (fields of 25 bytes).
: Is there perhaps a function I don't know about that would take care of this
: ? Some of the fields are not filled in so I can't do it wit split !!
: I've done it with <read TEST,$veld,25> but I think it's rather stupid.
: there must be a more intelligent way to go about it.
Well, read's a perfectly fine way to go snag in fixed-length records. If
you prefer the <> form for input and use perl 5.005+, you can always set
$/ to an integer ref, like so:
$/ = \25;
while(<FILEHANDLE>) {
# $_ is 25 bytes of stuff
(...whatever...) = unpack($format, $_);
}
You'll still need to unpack your data, but that's straightforward enough
to do.
Dan
------------------------------
Date: Thu, 22 Oct 1998 07:55:50 -0400
From: "PERL ROCKS!" <emills@harris.com>
Subject: Re: how to redirect POST parameters ?
Message-Id: <362F1D46.179111E2@harris.com>
Obviously you can't do logic in HTML, so I guess my approach might be
something like (dont flame me for syntax):
require ./people.pl
require ./contents.pl
if (in{param} eq "p") {start_people()}
else {start_contents};
You shouldn't loose any post args (in{}) since its a global in all of the
modules.
I know its not as pretty or clean as just forking into module a or b, since
the whole damn thing is compiled either way, but it might work for you.
Buena suerte,
E
flash wrote:
> hi all,
>
> do someone know how to redirect an URL with POST parameters ?
>
> I have 2 web pages (so 2 forms) for 2 search engines. I want to POST
> the parameters to the same CGI perl.
>
> Depending on these parameters, I would like to rePOST to another CGI.
> Sometimes to people.pl, sometimes to contents.pl .
>
> I can do the redirection but I loose the POST !
>
> I think redirect() ( CGI.pm ) can help me, but I still loose the POST
> !!!
>
> I'm using Perl 5.00404, and CGI.pm 2.36.
>
> Do u have an idea ?
>
> Thanks, flash
------------------------------
Date: Thu, 22 Oct 1998 23:43:45 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: How to view lexical variables in the Perl Debugger?
Message-Id: <1dhbpq0.shbo6mhrrhjdN@bay2-265.quincy.ziplink.net>
Tk Soh <r28629@email.sps.mot.com> wrote:
> Hmn.., Interesting! Now I can even do these:
>
> x keys %hash
> x values %hash
You can use x on any Perl expression!
DB<1> h x
x expr Evals expression in array context, dumps the result.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 23 Oct 1998 03:43:28 GMT
From: Bernie <bfb@att.net>
Subject: Re: How to yield processor time?
Message-Id: <362FFB22.43E22C84@att.net>
Is there a way in perl to limit the amout of CPU usage
a script uses? I'm aware I can use nice, but was wondering
if perl itself was capable of this.
-Thanks
------------------------------
Date: Fri, 23 Oct 1998 05:11:19 GMT
From: jsaya@iname.com (John)
Subject: HTTP POST
Message-Id: <36310fe9.12890707@news.earthlink.net>
Hello,
I'm using LWP to post to search engines and directories with perl, but
it seems my script doesn't post correctly to major search engines like
altavista.com. Here's my code to post to altavista:
$| = 1;
require LWP::Protocol::http;
require LWP::UserAgent;
$ua = new LWP::UserAgent;
$url = "http://add-url.altavista.com/cgi-bin/newurl";
$form="ads=1&q=http://www.server.com/index.html";
$request = new HTTP::Request('POST', $url, undef, $form);
$request->header('Content-type','application/x-www-form-urlencoded');
$response = $ua->request($request, undef, undef);
$str = $response->as_string;
print $str;
I keep getting the url you submitted (and it displays nothing) was
invalid. I know the above name=value pairs are correct because I
pulled them off of altavista's submission form.
What am I doing wrong?
Please email me at jsaya@iname.com
Thanks
------------------------------
Date: Fri, 23 Oct 1998 05:43:52 +0200
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Info on crypt()
Message-Id: <362ffb78.524144494f47414741@radiogaga.harz.de>
Bart Lateur (bart.mediamind@ping.be) wrote:
: CRC-32 looks just as decent as crypt() (though with fewer characters in
: the result), but more portable.
I ported some code implementing the "standard" crypt() functionality
from Java (which was a re-implementation of the original C code ;-)
to Perl to get crypt() for Win32. You can get it from
http://www.pdv-systeme.de/users/martinv/Crypt.pm
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
VMS is today what | work: mv@pdv-systeme.de
Microsoft wants | http://www.pdv-systeme.de/users/martinv/
Windows NT 8.0 to be! | home: martin@radiogaga.harz.de
------------------------------
Date: 23 Oct 1998 00:46:49 GMT
From: "Bill Steer" <bsteer@gwi.net>
Subject: Interpolated, squared?
Message-Id: <01bdfe1f$0c71fc80$0e00a8c0@zaphod>
I've just started reading this newsgroup, so apologize if this is a repeat
question...
How can I perform interpolation on variables in a nested fashion? That is,
suppose I have a variable, say $var, that contains a string that contains
yet other variables (in my case, $1 and $2 after a match operation). So
my $var variable may look like "$1something$2". And now I want to use
$var in a substitute operation, like s/<something>/$var/, and want the
$1 and $2 variables to be used.
I've read the FAQs and can't find this, nor can I find it in my books.
Thanks for any help/advice.
B. Steer
------------------------------
Date: Thu, 22 Oct 1998 08:27:51 -0400
From: "PERL ROCKS!" <emills@harris.com>
Subject: making a variable variable?
Message-Id: <362F24C7.30308F@harris.com>
I just read an interesting article on why its "stupid" to make a
variable store the name of another variable. Its by Mark-Jason Dominus
at http://www.plover.com/~mjd/perl/varvarname.html In fact, it was
well-written and made me reconsider my application.
Here is the deal. I'm creating a mess of dynamic HTML from a perl
script. Inside it is a table of 0..n rows, and each row has an <input>
field. Since HTML doesn't support arrays, I generate it using something
like (I know the damn <td>s are missing):
<tr><input name=v1..></tr>
<tr><input name=v2..></tr>
and so on. When I POST this, the CGI has a mess of global variables now
in{v1}..in{vn}. I then access those using, among other constructs:
for ($i=0;$i<=$in{recs};$i++)
{ if ($in{sel.$i}==1) {$dx += 1;} }
So I get a sort of virtual array from globals in{v1}..in{vn}. As you may
have noted I pass the number of recs in a hidden field to the dynamic
HTML, and pull it back in in the POST CGI as in{recs}.
Anyhow, it works pretty well, but I wouldn't apreciate having to debug
this if someone else wrote it. I'd appreciate any comments on this
approach, and would also appreciate any other approaches to this
problem. For you sensitive-types, I'm not asking anyone to write code
for me! The app works fine as it stands. I'm just curious about how
other handle this problem., and if anyone figured out a practical way to
derive a list from a table.
------------------------------
Date: 23 Oct 1998 02:00:51 GMT
From: davis@space.mit.edu (John E. Davis)
Subject: Re: Marrying S-Lang and Perl -- boon or blasphemy?
Message-Id: <slrn72voqg.9be.davis@aluche.mit.edu>
On 22 Oct 1998 19:57:41 -400, Lloyd Zusman <ljz@asfast.com>
wrote:
>I like S-Lang because it provides a set of curses-like routines for
>ascii-screen-based applications which are more robust, useful, and
>higher-level than their curses counterparts. Even powerful text
>editors can be built using S-Lang (for example, `jed').
What about making a perl module that uses the SLsmg routines (SLsmg
stands for SLang Screen Management) that you can dynamically link into
a perl program? For example, the latest slang snapshot
(ftp://space.mit.edu/slang/snapshots) contains a module directory that
implements an SLsmg module suitable for dynamically linking into a
slang interpreter. Of course, you would want to create perl bindings.
If you take a peek at the modules subdirectory in the snapshot, be
sure to look at:
demo.c
- Simple C program which embeds the slang interpreter
smg.sl
- A slang script that imports the SLsmg module and uses it to
draw lines, etc.
smg-module.c
- The SLsmg module with slang bindings
Since it is small, here is smg.sl:
import ("smg");
variable Button_Color = 3;
variable Box_Color = 2;
smg_define_color (Button_Color, "white", "green");
smg_define_color (Box_Color, "yellow", "blue");
define display_button (name, r, c)
{
smg_gotorc (r, c);
smg_set_color (Button_Color);
smg_write_string (" " + name + " ");
smg_set_color (0);
}
define draw_centered_string (s, r, c, dc)
{
variable len;
len = strlen (s);
smg_gotorc (r, c + (dc - len)/2);
smg_write_string (s);
}
define get_yes_no_cancel (question)
{
variable r, c, dr, dc;
dc = strlen (question) + 2;
dr = 7;
% We also need room for the yes-no-cancel buttons
if (dc < 32) dc = 36;
r = (Smg_Screen_Rows - dr)/2;
c = (Smg_Screen_Cols - dc)/2;
smg_set_color (Box_Color);
smg_draw_box (r, c, dr, dc);
smg_set_color (0);
r += 2;
draw_centered_string (question + "?", r, c, dc);
r += 2;
display_button ("Yes", r, c + 4);
display_button ("No", r, c + 14);
display_button ("Cancel", r, c + 24);
}
smg_init_smg ();
get_yes_no_cancel ("Are you listening to me");
smg_refresh ();
sleep (5);
smg_reset_smg ();
exit(0);
--
John E. Davis Center for Space Research/AXAF Science Center
617-258-8119 One Hampshire St., Building NE80-6019
http://space.mit.edu/~davis Cambridge, MA 02139-4307
------------------------------
Date: Fri, 23 Oct 1998 02:34:35 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie tries to create time-limited form!
Message-Id: <%WRX1.41$Jy4.224403@nsw.nnrp.telstra.net>
In article <362fda34.4190513@news.fibr.net>,
jbutler@express-news.net writes:
> I'm looking for advice on how to prepare an online test (HTML) that
> will stop accepting answers from the applicant after a set amount of
> time, and submit the answers automatically after that time (if the
> applicant has not already done so). I suspect a cookie is called for
> here?
You should ask this question in a group that talks about programming
for the web. One of the comp.infosystems.www.* groups will do.
Here we talk about perl, not about cookies, unless they have chocolate
in them. The solution to this problem will be the same, regardless of
the language you use to implement it.
Martien
--
Martien Verbruggen |
Webmaster www.tradingpost.com.au | "In a world without fences,
Commercial Dynamics Pty. Ltd. | who needs Gates?"
NSW, Australia |
------------------------------
Date: 23 Oct 1998 02:48:36 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Newbie tries to create time-limited form!
Message-Id: <70oqq4$qaj@mozo.cc.purdue.edu>
jbutler@express-news.net writes:
}I'm looking for advice on how to prepare an online test (HTML) that
}will stop accepting answers from the applicant after a set amount of
}time, and submit the answers automatically after that time (if the
}applicant has not already done so). I suspect a cookie is called for
}here?
}I'm also trying to set up the form so the applicant cannot exit the
}test and try again later.
Sounds like a javascript question, or maybe just a CGI question.
Try one of those newsgroups.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: Thu, 22 Oct 1998 22:55:38 -0500
From: "Mark Hurley" <mph@pcola.gulf.net>
Subject: Re: PERL & simple flat file database???
Message-Id: <e5TX1.815$Kp5.4500192@news1.atlantic.net>
Martien,
Thank you for the help. You have helped to clear up some things for me.
I'm still getting the SAME response (as wrote in my first msg), the server
is still trying to get me to download the file: second.
I will contact the other newsgroup for that question.
Thanks again!!!
Mark
------------------------------
Date: Fri, 23 Oct 1998 05:34:44 GMT
From: jhardy@cins.com (John Hardy)
Subject: Re: PERL & simple flat file database???
Message-Id: <UzUX1.1029$KM4.681258@198.235.216.4>
Try changing your second.cgi to second.pl. I beleive your server doesn't
know what to do with .cgi.
John
In article <e5TX1.815$Kp5.4500192@news1.atlantic.net>, mph@pcola.gulf.net
says...
>
>Martien,
>
>Thank you for the help. You have helped to clear up some things for me.
>
>I'm still getting the SAME response (as wrote in my first msg), the server
>is still trying to get me to download the file: second.
>
>I will contact the other newsgroup for that question.
>
>
>Thanks again!!!
>
>Mark
>
>
------------------------------
Date: Thu, 22 Oct 1998 23:43:47 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <1dhbq62.39mvmo1u0mt8yN@bay2-265.quincy.ziplink.net>
Jim Brewer <jimbo@soundimages.co.uk> wrote:
> mjd@op.net (Mark-Jason Dominus) writes:
>
> > If someone trips on a banana peel, it's partly their fault for not
> > looking where they were going, but it's also partly the fault of
> > whoever left the banana peel in the way. This is a banana peel.
> >
>
> Only in civil litigation mad America would such a perverted concept be
> uttered. Who the hell will you blame when you fall off the unstable
> sea cliff because you were standing too near the edge? God?
> Geologists? The city government?
What a ridiculous analogy. We can argue with analogies all day, but it
will be completely futile if our analogies map so poorly onto reality.
Here's an alternative analogy:
Suppose I sell you a car. I happen to know that the parking brake on
this car only works if you twist the handle. I leave a little note in
the glove box that reads "Warning! The parking brake on this car only
works if you twist the handle!"
Who is at fault when your car rolls down a hill and smashes into a
storefront?
Is that analogy any better? Who cares. The fact remains, returning the
year - 1900 is not intuitive. Simply returning the year would have been
simpler and less likely to lead to programmer error.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 22 Oct 1998 23:43:51 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Problem with perl scripts...
Message-Id: <1dhbqpx.1850i2e4jafhuN@bay2-265.quincy.ziplink.net>
<droby@copyright.com> wrote:
> Another error: This being imbedded in HTML without <PRE> and </PRE>, the
> newlines are quite irrelevant.
I know I'm thrilled when I view the source of an HTML document, and find
ridiculously long lines with the parts I'm interested in way off to the
right.
Newlines may not affect the display of a page any more than other
whitespace, but they are certainly not irrelevant.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Thu, 22 Oct 1998 21:46:46 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Q:Array of Lists
Message-Id: <mmqo07.lfq.ln@flash.net>
Ala Qumsieh (aqumsieh@matrox.com) wrote:
: stefan_007@my-dejanews.com writes:
: > sorry about this question (I'm not familiar with perl), but why doesn't this
: > work ?
: >
: > @Data[0] = ( "red", "green", "blue" );
[snip]
: An array is a list of SCALARS. @Data[0] is not defined.
Eh? @Data[0] is a legal (though silly) array slice.
It has meaning (is defined, I don't think you meant defined() there...)
@Data[0] = ( "red", "green", "blue" );
foreach (@Data) {print "$_\n"}
prints 'red'
Not what he wanted, but not "not defined" either...
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 23 Oct 1998 13:36:04 +1000
From: bod@compusol.com.au (Brendan O'Dea)
Subject: Re: Resubmit: Kindly help with file locking
Message-Id: <70otj4$2jj$1@duende.compusol.com.au>
[posted & mailed to ff@creative.net]
In article <MPG.1097f8223cbeec1798969b@news.supernews.com>,
Daniel Beckham <danbeck@eudoramail.com> wrote:
>I've heard that lockf and flock both have trouble locking across the
>network. Anyone know something for sure about this?
The FAQ does.
$ perldoc -q lock
[snip]
Some versions of flock() can't lock files over a network (e.g. on NFS
file systems), so you'd need to force the use of fcntl(2) when you
build Perl. See the flock entry of L<perlfunc>, and the F<INSTALL>
file in the source distribution for information on building Perl to do
this.
[snip]
>In article <362E0F39.BA6C6B45@creative.net>, ff@creative.net says...
>> Hello,
>>
>> I'm trying to use the lockf module to lock files across the network but
>> have not had much luck. Would really appreciate a hint or a clue. Here's
>> a simple script that shows the problem:
>>
>> #!/bin/perl -w
>>
>> use strict;
>> use File::lockf;
>>
>> open F, "<foo" or die "Unable to open foo\n";
>> my $err = File::lockf::lock(\*F);
>> print "Error = $err\n";
>>
>> which prints
>>
>> Error = 9.
>>
>> Thanks in advance for any help. Would also appreciate direct e-mail because
>> this newsgroup grows so fast and if I don't check for a couple of days I
>> lose the messages off our server.
First, why use File::lockf? Perl's flock builtin provides a portable
interface which will work correctly on NFS filesystems so long as the
underlying OS provides a flock/fcntl/lockf function which does.
As far as this particular problem goes, lockf requires that the handle
is writable, otherwise you get EBADF (9).
You need something like:
open F, "+<foo" or die "Unable to open foo\n";
You may also want to look at flock. Stick this into a file called
`trylock':
use Fcntl ':flock';
open F, "+<foo" or die "can't open foo ($!)\n";
flock F, LOCK_EX or die "can't lock foo ($!)\n";
print "$$: lock\n";
sleep 5;
print "$$: unlock\n";
close F;
then try this from your NFS directory (assuming that `trylock' and `foo'
exist there):
$ perl trylock & perl trylock & perl trylock; wait
which should produce something like this:
3593: lock
3593: unlock
3592: lock
3592: unlock
3594: lock
3594: unlock
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9809 0133
------------------------------
Date: 23 Oct 1998 03:45:27 GMT
From: dennis@info4.csie.nctu.edu.tw (GEMINI)
Subject: write a long string...
Message-Id: <70ou4n$it4$1@netnews.csie.NCTU.edu.tw>
hi all,
if I want to define a variable with a long string,
I usually use:
$A="a long string long string long string long string ".
"a long string long string long string long string ".
"a long string long string long string long string ";
Is there any way to avoid from concatenate several strings into one
and also not to write the string too long?
------------------------------
Date: Fri, 23 Oct 1998 00:29:40 -0500
From: Andrew Johnson <ajohnson@gatewest.net>
Subject: Re: write a long string...
Message-Id: <36301444.21BD3CB4@gatewest.net>
GEMINI wrote:
>
> hi all,
> if I want to define a variable with a long string,
> I usually use:
>
> $A="a long string long string long string long string ".
> "a long string long string long string long string ".
> "a long string long string long string long string ";
>
> Is there any way to avoid from concatenate several strings into one
> and also not to write the string too long?
here's one alternative method:
($long_string =<<EOF) =~ s/\n/ /g;
well, this is a pretty long string,
not as long as your example but
perhaps enough to suffice.
EOF
print $long_string;
however, if you are concerned about efficiency, you should
use the Benchmark module and run some tests.
regards
andrew
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 4051
**************************************