[15763] in Perl-Users-Digest
Perl-Users Digest, Issue: 3176 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 26 14:10:36 2000
Date: Fri, 26 May 2000 11:10:22 -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: <959364622-v9-i3176@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 26 May 2000 Volume: 9 Number: 3176
Today's topics:
Re: Perl 5.6.0: Why would a while cause a subroutine/me <dwhaskin@earthlink.net>
Re: Perl unusable as a programming language (Craig Berry)
Re: Perl unusable as a programming language (brian d foy)
Re: Perl unusable as a programming language (Lack Mr G M)
Re: Perl: using exec function <nospam@devnull.com>
Re: PerLotto 0.1a1. My first "real" Perl script!!! (Gwyn Judd)
printing to browser and file with single FILEHANDLE (Eric Smith)
Problems installing DBI-1.13 (LMC)
Re: Problems installing DBI-1.13 <red_orc@my-deja.com>
Re: seeking method to encode email addresses in web pag <nospam@devnull.com>
Re: seeking method to encode email addresses in web pag <godzilla@stomp.stomp.tokyo>
Re: Sybperl/dump database <ivan.santhumayor@gs.com>
Re: system commands (Abigail)
Re: the use of $_ (Mark-Jason Dominus)
time in microseconds? <jgarrett@ans.net>
Re: time in microseconds? <dwhaskin@earthlink.net>
Re: time in microseconds? <andkaha@my-deja.com>
Re: Timing ? (Abigail)
using OLE to open files in READ ONLY mode <spatterson@ganymede.com>
Re: using param() and CGI.pm to store a persistent valu <csorensen@uptimeresources.net>
Re: using param() and CGI.pm to store a persistent valu <godzilla@stomp.stomp.tokyo>
Re: using param() and CGI.pm to store a persistent valu <csorensen@uptimeresources.net>
Re: using param() and CGI.pm to store a persistent valu <nospam@devnull.com>
Re: using param() and CGI.pm to store a persistent valu <csorensen@uptimeresources.net>
Re: What web url to send scripts to the world??? (Michel Dalle)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 26 May 2000 16:29:53 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: Perl 5.6.0: Why would a while cause a subroutine/method to disappear?
Message-Id: <392EA60D.4EBF8646@earthlink.net>
Eric Bohlman wrote:
> I saw at least one variable ($contentPtr) declared within the scope of
> the loop and then used outside the loop. Your poor indentation made it
> hard to look at the code in more detail, but the first thing I'd check is
> whether you inadvertently changed any other variables' scope by
> introducing the loop.
Dang! Apologies, I did a cut and paste from Emacs and I hadn't done the
(setq-default indent-tabs-mode nil) thing in my .emacs. My indentation is
fine, I just didn't check that it was okay after pasting it into email.
You're right about the var defined within the loop scope and then used
outside. I've just fixed that, but the same problem still persists. Also, it
was very strange that perl didn't complain about that particular variable,
because I'm use'ing strict. Hmm.
Thanks,
dwh
------------------------------
Date: Fri, 26 May 2000 16:52:24 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Perl unusable as a programming language
Message-Id: <sitau8bqo199@corp.supernews.com>
Distribution:
Simon Cozens (simon@brecon.co.uk) wrote:
: At last count, Perl had 70,000 lines of core documentation. If that's
: incomplete, we're in bigger trouble than I thought.
Size != completeness. If those 70,000 lines fail to cover some topics
(which they do), they're incomplete. A lot of Perl's dwimmery remains
totally undocumented, leading to try-it-and-see as the only development
path. This is what leads to critiques of Perl as a production-grade
programming language.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "The road of Excess leads to the Palace
of Wisdom" - William Blake
------------------------------
Date: Thu, 25 May 2000 16:35:58 -0400
From: brian@smithrenaud.com (brian d foy)
Subject: Re: Perl unusable as a programming language
Message-Id: <brian-ya02408000R2505001635580001@news.panix.com>
In article <8gjh00$cni$1@nnrp1.deja.com>, The Glauber <theglauber@my-deja.com> posted:
> In article <8f498v$751$1@charm.magnus.acs.ohio-state.edu>,
> ilya@math.ohio-state.edu (Ilya Zakharevich) wrote:
> > Let me reiterate my current opinion on the topic: the reason for my
> > puzzlement (and your trouble) is the difference between Perl as a
> > scripting language and Perl as a programming language. Perl is
> > absolutely fine as a scripting language. Perl is pretty unusable as a
> > programming language.
> Is it just me or did this scare the heck out of anybody else? It's
> something to hear people ranting about Perl, but it's something else
> when someone as important to Perl as Ilya is, says that Perl is
> unusable as a programming language.
you have to define "programming language" first. Perl does what it
does, but it does not mean that it is the solution for every problem.
before you get too worked up, define the operational terms. :)
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Mongers <URL:http://www.perl.org/>
------------------------------
Date: Fri, 26 May 2000 12:30:51 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Perl unusable as a programming language
Message-Id: <8gmcqc$r5l$1@nntp.Stanford.EDU>
In article <MPG.139738e4cf27566f98aae2@nntp.hpl.hp.com>, Larry Rosler <lr@hpl.hp.com> writes:
|>
|> A company selling commercial software products (Micro$..t excepted, of
|> course :-) can -- and usually does -- impose quality criteria and
|> metrics on its employees.
What about the ones that ship early and only pick up the bugs as part
of the money-spinning support contracts? "quality criteria" doesn't
define the criteria are "good", just that they exist.
--
--------- Gordon Lack --------------- gml4410@ggr.co.uk ------------
This message *may* reflect my personal opinion. It is *not* intended
to reflect those of my employer, or anyone else.
------------------------------
Date: 26 May 2000 15:33:07 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: Perl: using exec function
Message-Id: <8gm5fj$qeq$0@216.155.32.216>
In article <04f036e0.d19e96ea@usw-ex0107-049.remarq.com>, yasin
<yesmail_99NOyeSPAM@yahoo.com.invalid> wrote:
| Hi,
|
| I have a perl code sitting on the server and it executes evrytime time
| it is prompted and the output it generates is placed in a file on the
| server in the cgi-bin directory. Now, the file gets created and
| everything works fine however when I use the function as:
|
| exec("filename.xml"); # the file contains the xml tags
|
| The perl code runs in a loop and I believe it has a hard time finding
| the specified file.
|
| A similar code I place in the c-drive and it works perfectly fine.
| Anybody, who has any idea about this please let me know, thanks
one thing you should try is the use of File::Spec to make sure you A>
have portable perl code, and B> are talking to the right directory.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 26 May 2000 15:07:43 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: PerLotto 0.1a1. My first "real" Perl script!!!
Message-Id: <slrn8ivpa8.3cn.tjla@thislove.dyndns.org>
I was shocked! How could A <y-o-y@home.com>
say such a terrible thing:
<snip>
Note that the following is more or less untested but it conforms a bit
more to the perl "way". You have a fair bit to learn, look in the
documentation available to you and read as many books as you can,
especially ones that focus on programming well, with good style. I
learnt perl from "Programming Perl" (the one with a camel on the front)
and can highly recommend it but maybe not as a first book if you are
just starting out.
>print("Enter winning number separated by spaces: ");
>$input = <STDIN>;
>chomp($input);
>@lotto = (split/ /, $input);
you might want to do this:
@lotto = split /\s+/, $input;
This will allow any amount of whitespace between the numbers.
>open(IN, 'games');
>while ($line = <IN>)
>{
> chomp($line);
> @win = (split/ /, $line);
>
> $picks = 0;
>
>#Check for duplicate numbers in a game
>for ($y=$#win ; $y>=0 ; $y--)
> {
> for ($x=$#win ; $x>=0 ; $x--)
> {
> if ($y == $x)
> {
> }
Why do you have this empty test? Wouldn't it be better to do:
if ($y != $x)
and leave out the else?
> else
> {
> if ($win[$y] == $win[$x])
> {
> print("INALID: Duplicate number in game below.\n");
> $y = 0;
> }
> }
> }
> }
I recommend you do the above loop as:
while (<IN>)
{
chomp; # use the "default" $_ variable
@win = split; # use the default split, this is safer than yours if the
# lines in the "lotto" file are tab delimited (say)
LOOP: for ($i = 0; $i < @win; $i++)
{
for ($j = $i + 1; $j < @win; $j++)
{
if ($win[$i] == $win[$j])
{
print "INVALID: Duplicate number in game below.\n";
last LOOP;
}
}
OR you could simply find and remove duplicate entries from the array in
one step. This means that if the file accidentally has some duplicate
entries they wont matter:
undef @saw;
@win = grep(!$saw[$_]++, @win);
If you don't understand this one then don't worry about it (yet).
>
>#Check for too few entries in a game
>if ($#win != $#lotto)
> {
> if ($#win < $#lotto)
> {
> print("INALID: Too few numbers in game below.\n");
> }
> else
> {
> print("INVALID: Too many numbers in game below.\n");
> }
> }
Note that you can get the size of an array simply by using it in a
scalar context. Also note that the first if test is not necessary eg:
if (@win < @lotto)
{
...
}
elsif (@win > @lotto)
{
...
}
>
> for ($y=$#lotto ; $y>=0 ; $y--)
> {
> for ($x=$#win ; $x>=0 ; $x--)
> {
> if (($lotto[$y]) == ($win[$x]))
> {
> $picks++;
> }
> }
> }
foreach $num (@win)
{
foreach $guess (@lotto)
{
picks++ if ($num == $guess);
}
}
> $last = $#lotto +2;
> $win[$last] = "--$picks";
uhhh. I wouldn't do this. Why not just print the number of correct
guesses explicitly?
$, = " "; # look in the "perlvar" documentation for an explanation of
# this and other funky named variables. In this case $, sets
# the character to put between elements in a list when
# printing
print @win;
print $picks . "\n";
}
> foreach $item (@win)
> {
> print("$item ");
> }
>
> print("\b\n");
what does the "\b" do?
>}
>
>close(IN);
It shouldn't be necessary to close the file since you are quitting
anyway.
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
"Next! We start by removing your clothes."
"Not without dinner and flowers."
-- Dr. Franklin and Ivanova, "The Quality of Mercy"
------------------------------
Date: 26 May 2000 15:26:05 GMT
From: eric@fruitcom.com (Eric Smith)
Subject: printing to browser and file with single FILEHANDLE
Message-Id: <slrn8it5qn.rid.eric@plum.fruitcom.com>
I would like to send a copy of browser output to a file.
This works from the command line but not in a cgi script.
The browser just prompts to save the cgi file.
open FILEANDBROWSER, "| tee /tmp/copyofputput" or die "nope";
Also tried this and only got output to the logfile and not the STDOUT:
open(LOG, ">>/tmp/logfile");
open(STDOUT, ">&LOG");
How could I achieve this?
(apologies for posting here but I tried the cgi group).
--
Eric Smith
eric@fruitcom.com
------------------------------
Date: Fri, 26 May 2000 11:30:32 -0400
From: "Martin C Dore (LMC)" <lmcmcad@lmc.ericsson.se>
Subject: Problems installing DBI-1.13
Message-Id: <392E9898.BBF7AE2E@lmc.ericsson.se>
Hi
I have get the DBI-1.13 from this website:
http://www.perl.com/CPAN-local/modules/by-module/DBI/
I have read the instruction to install it. It says to do:
perl Makefile.PL
make
make test
make install
I have done perl Makefile.PL with no problem
The problem is with the make. When i have made the make, he starts
and stop suddenly saying:
cc -c -I/usr/local/include -O -DVERSION=\"1.13\"
-DXS_VERSION=\"1.13\" -KPIC
-I/usr/local/bin/nsPerl5.005_03/lib/sun4-solaris/CORE -DDBI_NO_THREADS
Perl.c
/usr/ucb/cc: language optional software package not installed
*** Error code 1
make: Fatal error: Command failed for target 'Perl.o'
HELP please!!!
------------------------------
Date: Fri, 26 May 2000 16:18:04 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: Problems installing DBI-1.13
Message-Id: <8gm83a$c6r$1@nnrp1.deja.com>
In article <392E9898.BBF7AE2E@lmc.ericsson.se>,
"Martin C Dore (LMC)" <lmcmcad@lmc.ericsson.se> wrote:
> Hi
>
> I have get the DBI-1.13 from this website:
> http://www.perl.com/CPAN-local/modules/by-module/DBI/
>
> I have read the instruction to install it. It says to do:
> perl Makefile.PL
> make
> make test
> make install
>
> I have done perl Makefile.PL with no problem
>
> The problem is with the make. When i have made the make, he starts
> and stop suddenly saying:
>
> cc -c -I/usr/local/include -O -DVERSION=\"1.13\"
> -DXS_VERSION=\"1.13\" -KPIC
try this without the K in -KPIC
> -I/usr/local/bin/nsPerl5.005_03/lib/sun4-solaris/CORE -DDBI_NO_THREADS
> Perl.c
>
> /usr/ucb/cc: language optional software package not installed
>
> *** Error code 1
>
> make: Fatal error: Command failed for target 'Perl.o'
>
> HELP please!!!
>
>
--
Some drink at the fountain of knowledge...others just gargle.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 May 2000 16:17:59 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <8gm83n$vg6$0@216.155.32.216>
In article <392CF01C.BE324457@stomp.stomp.tokyo>, "Godzilla!"
<godzilla@stomp.stomp.tokyo> wrote:
[snip]
| TEST SCRIPT:
| ____________
|
[snip]
Fiddled with your script a bit, and have a few suggestions:
o don't use so much whitespace unless you *really* need to -- I find
this 'ajusted' script just as easy to read if not easier, plus it takes
up less space on the newsreader. (bear in mind, while you read it, that
I'm viewing this with a 12-point font on a 17" display running at 21"
(1152x870) resolution, and wear glasses/contacts, and am not having any
trouble ;)
o good placement of short comments makes short scripts even shorter..
look below and think about it in the future. ;)
o always use #!perl -w switch
(even in short scripts like this, it's always good to set a good
example for the newbies that may read this)
o always use strict; # good habits
(not that it was really necessary for this script, anyway, but ..
force of habit ;)
resultant 'adjusted' script:
---------------------------
#!/usr/local/bin/perl -w
use strict;
my $email = "callgirl\@la.znet.com";
print "Method One, ROT-13: \n";
$email =~ tr/a-zA-Z/n-za-mN-ZA-M/;# encode
print " encode: $email \n";
$email =~ tr/a-zA-Z/n-za-mN-ZA-M/;# decode
print " decode: $email \n";
print "-------\nMethod Two, Custom ROT-13:\n";
$email =~ tr/a-zA-Z/s-za-rS-ZA-R/;# encode
print " encode: $email \n";
$email =~ tr/s-za-rS-ZA-R/a-zA-Z/;# decode
print " decode: $email \n";
print "-------\nMethod Three, HEX: \n";
$email =~ s/(.)/ sprintf('%02x',ord($1)) /ge ;# encode
print " encode: $email \n";
$email =~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;# decode
print " decode: $email \n";
print "-------\nMethod Four, Custom ROT-13 + HEX: \n";
# encode (2-step)
$email =~ tr/a-zA-Z/s-za-rS-ZA-R/;
$email =~ s/(.)/ sprintf('%02x',ord($1)) /ge ;
print " encode: $email \n";
# decode (2-step)
$email =~ s/([0-9A-Fa-f]{2})/ sprintf("%c",hex($1)) /ge ;
$email =~ tr/s-za-rS-ZA-R/a-zA-Z/;
print " decode: $email \n";
print "-------\n";
---------------------------
note that I made good use of the 'format' of how the script runs to
simply offset the print statements from the calculations on $email to
make scanning and parsing it visually very simple. (
also formats the output a little more neatly and doesn't need the
redundant mention of which method each section is presenting:
Method One, ROT-13:
encode: pnyytvey@yn.marg.pbz
decode: callgirl@la.znet.com
-------
Method Two, Custom ROT-13:
encode: usddyajd@ds.rfwl.uge
decode: callgirl@la.znet.com
-------
Method Three, HEX:
encode: 63616c6c6769726c406c612e7a6e65742e636f6d
decode: callgirl@la.znet.com
-------
Method Four, Custom ROT-13 + HEX:
encode: 7573646479616a644064732e7266776c2e756765
decode: callgirl@la.znet.com
-------
other than that, interesting trick with the sprintf... I wasn't aware
one could do that. :)
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: Fri, 26 May 2000 10:27:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: seeking method to encode email addresses in web page forms
Message-Id: <392EB402.B812D4F1@stomp.stomp.tokyo>
The WebDragon wrote:
>
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> [snip]
> | TEST SCRIPT:
> | ____________
> |
> [snip]
> Fiddled with your script a bit, and have a few suggestions:
> o don't use so much whitespace unless you *really* need to --
These are my articles. I will format my articles
in any fashion I choose, Adolf.
> I find this 'ajusted' script just as easy to read if not easier
That's nice. Make all the adjustments you want.
> o good placement of short comments makes short scripts
> even shorter.. look below and think about it in the future. ;)
These are my scripts, my efforts. I will write
my scripts in any fashion I choose, Adolf.
> o always use #!perl -w switch
I have no need for -w. I do not write errors
into my code as a general rule and, I provide
my own error checking codes, as recently
exemplified in one of my articles.
Training wheels are for sissified geeks.
> o always use strict; # good habits
No, I will not do this, Adolf. I have
no need for strict. I know how to write
programs correctly.
Training wheels are for sissified geeks.
> resultant 'adjusted' script:
I will have to get back to you on your
adjusted script once I have a fellow
professor skilled in Egyptian Hieroglyphics
translate it for me. For now, I will retain
a copy of your script in my circular filing
cabinet, right next to my desk.
> note that I made good use of the 'format'
yeah.. sure..
> other than that, interesting trick with the sprintf...
> I wasn't aware one could do that. :)
Pay attention. You might just learn some
really slick tricks from me, tricks nobody
else seems to know, like how to write truly
effective and imaginative programs which
do things "experts" claim you cannot do.
Godzilla!
------------------------------
Date: Fri, 26 May 2000 12:34:38 -0400
From: Ivan Santhumayor <ivan.santhumayor@gs.com>
Subject: Re: Sybperl/dump database
Message-Id: <392EA79D.4A5BCACB@gs.com>
Errors will not appear in the dbnextrow() or dbresults(). You have to
install errorhandler and messagehandler routines, and these functions are
triggered whenever there is an error. Check the sample programs to cut and
paste these 2 functions into your program.
Toby Arkless wrote:
> Hi,
>
> I am running perl 5.005 with Sybperl built on. I am writing a script to
> dump the databases and I cannot work out how to process the output.
> dbresults/dbnextrow seem to have no effect. I guess the script is just
> outputing to STDOUT/STDERR.
>
> I don't really want to have to output to a file and process that. I am
> fairly new to perl in general and am still working out the tricks.
>
> The code I am using is (the dump command look OK when printed):
>
> $sql="dump database $dbname to $dumpdev";
> print "$sql\n";
> $dbh->dbcmd("$sql");
> $dbh->dbsqlexec;
> while ($dbh->dbresults != Sybase::DBlib->NO_MORE_RESULTS) {
> }
>
> I have tried all sorts of things and got nowhere.
>
> Any advice would be appreciated.
>
> Thanks
>
> Toby Arkless
> Wilco International
>
> (PS this is on solaris 2.6 and solaris 7)
------------------------------
Date: 26 May 2000 18:01:31 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: system commands
Message-Id: <8gme5r$q7k$3@news.panix.com>
On Fri, 26 May 2000 07:23:14 GMT, LostSailor <pharrer@idmail.com> wrote:
++ Hello. I'm trying to run an AWK program on a windowsNT iis server. The
++ perl script successfully returns back an html page but won't execute
++ the AWK program. Any idea what I'm doing wrong?
I think you have an error in your program.
++ Please email me personally.
No.
Abigail
------------------------------
Date: Fri, 26 May 2000 16:00:26 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: the use of $_
Message-Id: <392e9f9a.654a$116@news.op.net>
In article <39299159.FE4AEEA@stomp.stomp.tokyo>,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>I am insulted by this type of lying.
>This is personally offensive and
>malice intent abuse on your part.
My goodness, what a little freak you are.
------------------------------
Date: Fri, 26 May 2000 13:04:04 -0400
From: Jennifer Garrett <jgarrett@ans.net>
Subject: time in microseconds?
Message-Id: <392EAE84.83F6BB8D@ans.net>
--------------C8D458A8924B9B30D2C553B3
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Is it possible to find the time in microseconds in perl?
I haven't seen anything that lets you do that.
--------------C8D458A8924B9B30D2C553B3
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<pre>Is it possible to find the time in microseconds in perl?
I haven't seen anything that lets you do that.</pre>
</html>
--------------C8D458A8924B9B30D2C553B3--
------------------------------
Date: Fri, 26 May 2000 17:33:01 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: time in microseconds?
Message-Id: <392EB4D9.4665D468@earthlink.net>
Jennifer Garrett wrote:
> Is it possible to find the time in microseconds in perl?
> I haven't seen anything that lets you do that.
>
See Time::HiRes.
------------------------------
Date: Fri, 26 May 2000 17:43:58 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: time in microseconds?
Message-Id: <8gmd4q$g79$1@nnrp1.deja.com>
In article <392EAE84.83F6BB8D@ans.net>,
jgarrett@ans.net wrote:
>
> --------------C8D458A8924B9B30D2C553B3
> Content-Type: text/plain; charset=us-ascii
> Content-Transfer-Encoding: 7bit
>
> Is it possible to find the time in microseconds in perl?
> I haven't seen anything that lets you do that.
[HTML crap cut]
Please look for the question "How can I measure time under a second?" in
the FAQ.
perldoc -q "time under"
or browse perlfaq8 at
<URL:http://www.perl.com/pub/doc/manual/html/pod/perlfaq8.html>.
/A
--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk e-mail is reported to the
# appropriate authorities, no exceptions.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 May 2000 17:50:05 GMT
From: abigail@arena-i.com (Abigail)
Subject: Re: Timing ?
Message-Id: <8gmdgd$q7k$1@news.panix.com>
On Fri, 26 May 2000 17:15:34 +1200, Lew <Info@dynasoft.co.nz> wrote:
++ I'm not quite sure what you mean by the program finishing before the alarm
++ gets activated. I don't see it?
Please don't reply Jeopardy style.
What I mean is simple. You program finishes (in this case, it reaches the
end of the file) before the 5 seconds of the alarm have passed.
Once the program has terminated, all the information associated with the
program is gone (except for the exit status to be reaped by the parent
process), including any pending alarms.
Basically, there's no process left the OS can send a signal to.
Abigail
------------------------------
Date: Fri, 26 May 2000 11:34:16 -0400
From: "Scott Patterson" <spatterson@ganymede.com>
Subject: using OLE to open files in READ ONLY mode
Message-Id: <392e997a@defiant.btitelecom.net>
I have been ablel to succesfuly open word docs and get text from them using
the WIN32::OLE module, but if the word doc is opened I am prompted with a
question asking if read only mode is ok. Since I am simply wanting to read
from the file, I always choose yes. However, it would be nice to be able to
suppress this message. So, is there a way to specify I want to open the file
in read-only mode from the beginning? Here's what I got so far:
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Word';
my $Word = Win32::OLE->new('Word.Application', 'Quit');
#$Word->{'Visible'} = 1; # if you want to see what's going on
$Word->Documents->Open("C:\\test.doc")|| die("Unable to open document ",
Win32::OLE->LastError());
Thanks!
Scott
------------------------------
Date: 26 May 2000 12:48:16 EDT
From: Chris <csorensen@uptimeresources.net>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <392EAAC0.A7A2CE3B@uptimeresources.net>
Neil Kandalgaonkar wrote:
>
> I'm confused. If you need to retrieve a standard CGI parameter, cookies
> seem irrelevant. And if you wanted to tag the remote browser with a
> cookie, I'm not sure why you are storing the referring siteID of all things.
>
> Is it that you want to permanently record where a particular user came
> from on the very first visit? If so you should test if the cookie is
> set already.
I need to record the siteID variable that is passed when the user bounces to the
site and I need to store this value for as long as they are at this site ..
if they submit a form I need to read the cookie and write the siteID variable to
a flat file ..
>
> >cookie ( -name=>'siteID',
> > -value=>'param(siteID)');
> You can't set a cookie like this as far as I know, you need to include it
> in the header manually.
ok .. how about this - will this work ?
$the_cookie = cookie(-name=>'siteID',
-value=>param("siteID") );
print header(-cookie=>$the_cookie);
>
> Refresh pages are lame. They make it impossible to go back a step.
> Consider using a redirect instead. See the CGI book or the CGI docs.
>
how about this ?
print $q->redirect('http://www.insuremybiz.com');
Chris
csorensen@uptimeresources.net
------------------------------
Date: Fri, 26 May 2000 09:48:43 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <392EAAEB.CC10878C@stomp.stomp.tokyo>
Neil Kandalgaonkar wrote:
> Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
> >It is
> >in dealing with modules you are having basic
> >problems; get rid of them.
> >KISS: Keep It Simple Silly.
> Most people find using modules reduces the complexity of the
> code they have to write. Sometimes at the cost of execution speed.
I use modules at times. One I really like is LWP (simple)
No, for this originating author wants to do, there is
no need for modules. His needs are very simple; set a
cookie and redirect. However, you have put me a position
of making a comment I really would rather not. This comment
is I suspect the author doesn't know enough about cookies
to do this right, thus my emphasis on learning about how
to setup and use cookies. I try to be gracious.
> Honestly, Kira, if you would take a little time to learn them,
> I think you'd grow to like them. Perhaps you had bad experiences
> the few times you tried it and went back to perl4, which is
> your right.
I use modules and know them well. Any module I use,
I open and actually study. My choice is to not use
modules. By studying how a module works, I can write
my own code to do the same, with less lines and less
use of memory. I would rather write my own programming
rather than rely on copy and paste of another's work.
> This test script is not only replete with inefficiencies,
> as far as I can tell it does not actually set a cookie.
No, if you read for comprehension, no attempt is made
to set a cookie. I am showing him how to extract info
from a query string for use in a cookie. His problem
seems to be twofold; his query string and setting a
cookie correctly. My thoughts are he needs to backup
a bit and learn some basics, then move forward.
On cgi-wrap, yeah I have worked with this many times.
My personal experiences are not good. I will qualify
I believe the problems I encountered, as stated, are
directly contributable to a sysop not configuring
cgi-wrap correctly. What I encountered is problems
with pumping math formulas through cgi-wrap and
have always encountered problems with nph style
scripts. I think the nph problem is sysops don't
realize there are two parts to cgi-wrap. One is
for standard scripts, the other, for nph style.
Each has to installed and configured. Might be
most sysops figures nobody uses nph-style. I use
this on a regular basis wanting full control over
all aspects of my scripts, those at least which
are fairly complex.
Anyhow, the point of my article you are commenting
upon Mr. Kandalgaonkar, is to possibly persuade this
author to use more simple basic methods until he gets
a pretty good handle on more complex methods. I honestly
believe he is biting off more than he can chew.
Godzilla!
------------------------------
Date: 26 May 2000 13:12:56 EDT
From: Chris <csorensen@uptimeresources.net>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <392EB088.54B93F66@uptimeresources.net>
Godzilla is certainly correct when pointing out that I am unfamiliar with
cookies
however - I have no choice .. I have to get this done as soon as possible
(the pointy headed boss is starting to get on my nerves)
this is my latest attempt:
#!/usr/bin/perl -w
use CGI qw(:standard);
use strict;
$the_cookie = cookie(-name=>'siteID',
-value=>param("siteID") );
print header(-cookie=>$the_cookie);
print $q->redirect('http://www.insuremybiz.com');
result when run from browser .. internal server error
result when run from command line:
Global symbol "$the_cookie" requires explicit package name at new5.cgi line 8.
Global symbol "$q" requires explicit package name at new5.cgi line 14.
Execution of new5.cgi aborted due to compilation errors.
the script is now as small as I can make it .. the code for the cookie is copied
directly
from Lincoln Stein's book .. so is the code for the redirect ..
the only change I made is I set the value of the cookie as the param() function
rather than a set value ..
------------------------------
Date: 26 May 2000 17:21:24 GMT
From: The WebDragon <nospam@devnull.com>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <8gmbqk$4jl$0@216.155.32.216>
In article <392DCF55.F6BBA3E7@uptimeresources.net>, Chris
<csorensen@uptimeresources.net> wrote:
| #!/usr/bin/perl
the -w switch is your friend! use it!
| use CGI qw(:standard);
| #set cookie to capture siteID variable passed in URL from referring site
|
| cookie ( -name=>'siteID',
| -value=>'param(siteID)');
| # retrieve value
| @cookie_value = cookie(-name=>'siteID');
|
| # print siteID to file - this is just for testing purposes - will be
| removed when script works
|
| open (TESTER, ">testiner.txt") || die "cannot open";
| print TESTER @cookie_value, "\n";
|
| # jump to correct starting page
| start_html('refresher'),
| <meta http-equiv="refresh" content="1;URL=http://insuremybiz.com">,
| end_html;
# Unquoted string "works" may clash with future reserved word.
File 'Untitled #4'; Line 17
# syntax error, near "works
open "
File 'Untitled #4'; Line 17
# Untitled #4 had compilation errors.
--
send mail to mactech (at) webdragon (dot) net instead of the above address.
this is to prevent spamming. e-mail reply-to's have been altered
to prevent scan software from extracting my address for the purpose
of spamming me, which I hate with a passion bordering on obsession.
------------------------------
Date: 26 May 2000 13:56:11 EDT
From: Chris <csorensen@uptimeresources.net>
Subject: Re: using param() and CGI.pm to store a persistent value
Message-Id: <392EBAAB.5CDE2B90@uptimeresources.net>
Well .. I've done alot more testing ..
cookie problem - not solved yet
redirection problem - FIXED !!
i needed to write the redirect this way
print header('text/html'),
print redirect('http//www.whatever.com');
I still can't figure the cookie though
------------------------------
Date: Fri, 26 May 2000 16:45:40 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: What web url to send scripts to the world???
Message-Id: <8gm9qn$7ln$1@news.mch.sbs.de>
In article <bhkX4.209246$Tn4.1851561@news1.rdc2.pa.home.com>, A <y-o-y@home.com> wrote:
>I want to know where to post my scripts!
>
>I posted my first one to this ng, but it's apparent that this isn't the
>the place to share.
>
>I'll check the CPAN site.
Depends on the scripts, I suppose. If you're talking about
re-usable modules, CPAN would be the best place to check.
But if you're talking about some nifty CGI script, you might
upload it to any website and add it to the CGI Resource Index.
Check the appropriate category under :
http://cgi.resourceindex.com/Programs_and_Scripts/Perl/
For some mysterious reason, resources added there end
up on many other CGI script archives as well...
HTH,
Michel.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 3176
**************************************