[15761] in Perl-Users-Digest
Perl-Users Digest, Issue: 3174 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 26 11:05:39 2000
Date: Fri, 26 May 2000 08:05:12 -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: <959353512-v9-i3174@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 26 May 2000 Volume: 9 Number: 3174
Today's topics:
Re: "Decoding" variable <jad9@po.cwru.edu>
Re: "Decoding" variable <red_orc@my-deja.com>
Re: ([^|]+) vs (.*?) <bmb@dataserv.libs.uga.edu>
@INC Assistance <skpurcell@hotmail.com>
Re: [Q] How to intercept browser's HTTP? (Neil Kandalgaonkar)
Re: Advantages of Perl over Cold Fusion? <lee@insync.net>
Can't get my search and replace script to work dutchm@my-deja.com
Re: Can't get my search and replace script to work <bmb@dataserv.libs.uga.edu>
Re: Can't get my search and replace script to work (Eric Bohlman)
comparing file content? Checksum? newsmf@bigfoot.com
Re: comparing file content? Checksum? <andkaha@my-deja.com>
Re: comparing file content? Checksum? (Eric Bohlman)
DBI + DBD:mysql error 1054 <eric_r@my-deja.com>
Re: DBI + DBD:mysql error 1054 <red_orc@my-deja.com>
Re: DBI:ODBC on windows nt (David Krainess)
Re: hashes vs associative arrays (was: Re: Array Questi <bmb@dataserv.libs.uga.edu>
Re: hashes vs associative arrays (was: Re: Array Questi (Peter Lowe)
IE blocks referer <tag@gmx.de>
Re: IE blocks referer (Eric Bohlman)
Re: Member Area Help! <bmb@dataserv.libs.uga.edu>
Net::FTP locks up during put <iain_hosking@hotmail.com>
Perl 5.6.0: Why would a while cause a subroutine/method <dwhaskin@earthlink.net>
Re: Perl 5.6.0: Why would a while cause a subroutine/me (Eric Bohlman)
Re: Perl unusable as a programming language (Simon Cozens)
regexp - "not this word" pattern ? <wake@thukraine.com>
Re: regexp - "not this word" pattern ? <uackermann@orga.com>
Re: regexp - "not this word" pattern ? (Eric Bohlman)
Sybperl/dump database <tarkless@wilco-int.com>
Re: time and date conversion <dave@dave.org.uk>
Re: time and date conversion <jad9@po.cwru.edu>
Re: Timing ? <sariq@texas.net>
Re: What package does "xsubpp" belong to and where are <dan@tuatha.sidhe.org>
Re: Where to Start + FIFO Stack (Gwyn Judd)
Re: Why not 5.005_03? (Simon Cozens)
Re: Why not 5.005_03? <dwhaskin@earthlink.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 26 May 2000 10:28:46 -0500
From: "John A. Dutton" <jad9@po.cwru.edu>
Subject: Re: "Decoding" variable
Message-Id: <392E982D.B7EBB2C7@po.cwru.edu>
--------------EC6BFB2534568BF1E62E9E47
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Robert Voesten wrote:
> DTM07137199810121215203
>
> - DTM07 is the Date/Time/Period qualifier
> - 137 means "Creation date" (another qualifier)
> - 1998 is the year at the time of creation
> - 10 is the month at the time of creation
> - the first 12 is the date at the time of creation
> - the second 12 is the amount of hours at the time of creation
> - 15 is the amount of minutes at the time of creation
> So the question is: How do I convert this code into "Date of creation: 12th
> Octobre 1998 at 12:15 (PM)"
This is pretty basic perl, so without asking you to RTFM, you mainly want to parse the variable into substrings and then convert those substrings into the relevant data.
#!/usr/bin/perl -w
open(I,$FILE);
while (<I>) {
$line = $_;
$DTP = substr($line,0,5);
$CreationDate = substr($line,5,3);
... etc ...
$LiteralMonth = (January,February,March ...)[$Month];
... etc ...
print "Date of creation: $Day$Suffix $Month $Year at $Hour:$Minute ($AMPM)";
}
close(I);
For the substr(), you give it the scalar you want to work on, the index of the first character you want to take and then how many characters you want.
Remember that the indexing starts from zero.
To get the individual month converted into a literal, you create an array of the literal months and then subscript it with the current month.
Everything else should follow from there.
John
--
http://johnadutton.com/ (currently start.cwru.edu)
senior, case western reserve university
brother, phi kappa theta fraternity
--------------EC6BFB2534568BF1E62E9E47
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Robert Voesten wrote:
<blockquote TYPE=CITE>DTM07137199810121215203
<p>- DTM07 is the Date/Time/Period qualifier
<br>- 137 means "Creation date" (another qualifier)
<br>- 1998 is the year at the time of creation
<br>- 10 is the month at the time of creation
<br>- the first 12 is the date at the time of creation
<br>- the second 12 is the amount of hours at the time of creation
<br>- 15 is the amount of minutes at the time of creation</blockquote>
<blockquote TYPE=CITE>So the question is: How do I convert this code into
"Date of creation: 12th
<br>Octobre 1998 at 12:15 (PM)"</blockquote>
<pre>This is pretty basic perl, so without asking you to RTFM, you mainly want to parse the variable into substrings and then convert those substrings into the relevant data.</pre>
<pre>#!/usr/bin/perl -w</pre>
<pre>open(I,$FILE);</pre>
<pre>while (<I>) {</pre>
<pre> $line = $_;</pre>
<pre> $DTP = substr($line,0,5);</pre>
<pre> $CreationDate = substr($line,5,3);</pre>
<pre> ... etc ...</pre>
<pre> $LiteralMonth = (January,February,March ...)[$Month];</pre>
<pre> ... etc ...</pre>
<pre> print "Date of creation: $Day$Suffix $Month $Year at $Hour:$Minute ($AMPM)";</pre>
<pre>}</pre>
<pre>close(I);</pre>
<pre></pre>
<pre>For the substr(), you give it the scalar you want to work on, the index of the first character you want to take and then how many characters you want.</pre>
<pre>Remember that the indexing starts from zero.</pre>
<pre>To get the individual month converted into a literal, you create an array of the literal months and then subscript it with the current month.</pre>
<pre>Everything else should follow from there.</pre>
<pre></pre>
<pre>John</pre>
<pre>--
<A HREF="http://johnadutton.com/">http://johnadutton.com/</A> (currently start.cwru.edu)
senior, case western reserve university
brother, phi kappa theta fraternity</pre>
</html>
--------------EC6BFB2534568BF1E62E9E47--
------------------------------
Date: Fri, 26 May 2000 14:18:06 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: "Decoding" variable
Message-Id: <8gm12b$6kl$1@nnrp1.deja.com>
In article <8glrqt$km3$1@porthos.nl.uu.net>,
"Robert Voesten" <robert@pharmapartners.nl> wrote:
>
> Hi,
>
> I have a file with some info in it, and I have 2 change it to normal
> readable info.
>
> E.g.
>
> DTM07137199810121215203
>
> means "Created on 12 octobre 1998 at 12:15.
>
> This "code" is created with several elements:
>
> - DTM07 is the Date/Time/Period qualifier
> - 137 means "Creation date" (another qualifier)
> - 1998 is the year at the time of creation
> - 10 is the month at the time of creation
> - the first 12 is the date at the time of creation
> - the second 12 is the amount of hours at the time of creation
> - 15 is the amount of minutes at the time of creation
>
> so the date of creation is written like this:
> CCYYMMDDHHMM
> with a total amount of signs of 35, so every non-used has to be
replaced
> with a space
>
> So the question is: How do I convert this code into "Date of creation:
12th
> Octobre 1998 at 12:15 (PM)"
>
> I hove you can help me out,
>
#!/usr/local/bin/perl -w
use strict;
my $str ='DTM07137199810121215203';
my $am = 'AM';
my $pm = 'PM';
my @month = ('Jan', 'Feb',
'Mar','Apr','May','Jun','Jul','Aug','Sep','Octobre','Dec');
if (substr($str,0,8) eq 'DTM07137') {
printf "Date of creation: %02dth %s %04d at %02d:%02d (%s)\n",
substr($str,14,2), $month[substr($str,12,2)-1], substr($str,8,4),
substr($str,16,2), substr($str,18,2), ((substr($str,16,4)>1200) ? $pm
:$am);
# OR:
$str =~ /.{8}(\d{4})(\d{2})(\d{2})(\d{2})(\d{2});
# $str =~ /........(....)(..)(..)(..)(..)/ ; ???? if format is
guaranteed as above . . .
printf "Date of creation: %02dth %s %04d at %02d:%02d (%s)\n",$3,
$month[$2-1], $1, $4, $5, (($4>11) ? $pm:$am);
# you will, no doubt, want to check the day-of-month and change
# 'th' to 'nd' or 'st' as appropriate . . .
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 10:10:26 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: ([^|]+) vs (.*?)
Message-Id: <Pine.GSO.4.21.0005261008330.29594-100000@dataserv.libs.uga.edu>
On Fri, 26 May 2000, Gwyn Judd wrote:
> I was shocked! How could Abigail <abigail@arena-i.com>
> say such a terrible thing:
> >Well, they are very different:
> >
> > ([^|]+): matches a longest possible (sub)string, of at least one
> > character, that doesn't contain a '|'.
> > (.*?): matches a shortest possible (sub)string, possibly empty,
> > that doesn't contain a newline (unless /s is in effect).
>
> doesn't (.*?) match a string of zero length? No matter what the string
> it was matching against contains I mean. I mean:
>
> $st = "\n\n\n\n\n";
> ($s) = $st =~ /(.*?)/;
> print $s;
>
> gives no warnings (it prints nothing out but that just means that $s is
> zero length, not that it is undefined).
Sure, if it's the only thing in the regx.
1 #!/usr/local/bin/perl -w
2 use strict;
3
4 my $st = "one two buckle";
5 my ($s) = $st =~ /one (.*?) buckle/s;
6 print $s;
This prints "two".
--
Brad
------------------------------
Date: Fri, 26 May 2000 08:13:56 -0500
From: "spurcell" <skpurcell@hotmail.com>
Subject: @INC Assistance
Message-Id: <392e78a2$0$26701@wodc7nh1.news.uu.net>
Hello,
My Perl physically lives at c:\perl
And the lib is at c:\perl\lib
Anyway, I am getting an error when I run a perl script that says it cannot
find my GDBM_File at:
Here is the error:
Can't locate GDBM_File.pm in @INC (@INC contains: C:/usr/bin/Perl/lib
C:/Perl/site/lib .) at D:\gdbm.pl line 6
Anyway, my perl used to live there years ago, but it does not physically
live at c:/Perl.
I went to my control panel, system, environment, and have double checked my
path variable. It says C:\Perl;C:\Perl\lib
So does anyone know what I am doing wrong? Do I need to change another
variable elsewhere to get the @INC to understand where my real perl lives?
Thanks
Scott
------------------------------
Date: 26 May 2000 14:06:09 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: [Q] How to intercept browser's HTTP?
Message-Id: <8gm0ch$1vs$1@newsflash.concordia.ca>
In article <8glsbq$8md$1@panix3.panix.com>, kj0 <kj0@mailcity.com> wrote:
>
>
>Hi. I have a very basic question. I'm learning how to write
>free-standing web clients in Perl (using LWP). It would speed matters
>considerably if I were able to intercept (so I can study it!) the HTTP
>the browser sends out every time one clicks a link, a browser button,
>etc. How can I do this?
A proxy might do the job nicely. This is a program which accepts HTTP
requests and performs them on your behalf. Many web servers have a
proxy mode. All common web browsers can be configured to use proxies.
So, install a proxy somewhere, configure the browser to use a proxy,
and then customize the proxy to do whatever logging you want. Not
very easy but not terribly hard either.
>P.S. This is not really a Perl question; is there a better forum to
>send it to?
Well, with Apache, you can use mod_perl to customize the proxy. There
are plenty of proxy-related modules under Apache:: in the CPAN.
Try comp.infosystems.www.authoring.servers for proxy server questions.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Fri, 26 May 2000 09:34:12 -0500
From: "Lee Sharp" <lee@insync.net>
Subject: Re: Advantages of Perl over Cold Fusion?
Message-Id: <tXvX4.389$I7.6660@insync>
Zak McGregor wrote in message <392DA662.BC8AD27C@icon.co.za>...
|Cory Phillips wrote:
|> I have to write a justification to my employer to allow me to write a
|> web database application using Perl.
|1 - Perl is Perl
|2 - Perl is not Cold Fusion
|3 - Perl is Open Source, Cold fusion proprietary
|4 - Perl is not (by default) and embedded html pre-processing language
|5 - Perl is (likely to be) more flexible
Perl is portable. Our office had a web site on IIS and Cold Fusion NT.
We needed to move it to Solaris iPlanet 4.0 for business reasons. Ooops...
Cold Fusion has different versions and cost structures for each platform.
And it didn't support iPlanet 4.0 at that time. Perl is free, and is the
first active component ported to a new web server. If you ever have to move
your site, or host it somewhere, with Perl it will be cheap and easy.
Lee
--
SCSI is *NOT* magic. There are *fundamental technical reasons* why it is
necessary to sacrifice a young goat to your SCSI chain now and then. * Guns
are no more responsible for killing people than spoons are responsible for
making Rosie O'Donnell and Oprah Winfrey fat - I am speaking as an
individual, not as a representative of any company, organization or other
entity. I am solely responsible for my words.
------------------------------
Date: Fri, 26 May 2000 13:12:01 GMT
From: dutchm@my-deja.com
Subject: Can't get my search and replace script to work
Message-Id: <8glt6j$3pa$1@nnrp1.deja.com>
I can't seem to figure out why this script won't work. I am wanting to
search multiple text files for an expression and replace one word
of the expression.
Thanks for any suggestions
#!/usr/bin/perl -w
$fromdir = "/symlnks/io/jobs/ftp_test";
$todir = "/symlnks/io/jobs/new";
$exp = "page_style (FN) eq
{/plm 0 def /prm 612 def /ptm 775 def /pbm 36 def %page";
chomp $exp;
$repl = "page_style (DN) eq
{/plm 0 def /prm 612 def /ptm 927 def /pbm 36 def %page";
chomp $repl;
opendir(DIR,$fromdir) or die "could not open dir: $!";
while (@file = readdir(DIR)) {
foreach $file (@file) {
chomp $file;
next if (-d $file);
open(FILE, "$fromdir/$file") or die "I shant open $file: $!";
open(OUT,">$todir/$file") or die "I shant cannot open $file: $!";
while (<FILE>) {
$file .= $_;
s/^$exp$/$repl/g;
print OUT;
}}}
close FILE;
close DIR;
exit;
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 10:28:26 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: Can't get my search and replace script to work
Message-Id: <Pine.GSO.4.21.0005261015060.29594-100000@dataserv.libs.uga.edu>
On Fri, 26 May 2000 dutchm@my-deja.com wrote:
> I can't seem to figure out why this script won't work. I am wanting to
> search multiple text files for an expression and replace one word
> of the expression.
>
> Thanks for any suggestions
>
> #!/usr/bin/perl -w
>
>
> $fromdir = "/symlnks/io/jobs/ftp_test";
> $todir = "/symlnks/io/jobs/new";
>
> $exp = "page_style (FN) eq
> {/plm 0 def /prm 612 def /ptm 775 def /pbm 36 def %page";
> chomp $exp;
>
> $repl = "page_style (DN) eq
> {/plm 0 def /prm 612 def /ptm 927 def /pbm 36 def %page";
> chomp $repl;
>
> opendir(DIR,$fromdir) or die "could not open dir: $!";
>
> while (@file = readdir(DIR)) {
> foreach $file (@file) {
> chomp $file;
> next if (-d $file);
>
> open(FILE, "$fromdir/$file") or die "I shant open $file: $!";
> open(OUT,">$todir/$file") or die "I shant cannot open $file: $!";
> while (<FILE>) {
>
> $file .= $_;
>
> s/^$exp$/$repl/g;
>
> print OUT;
> }}}
>
> close FILE;
> close DIR;
>
> exit;
You don't explain in what way exactly it does not work. I do see,
however, that $exp and $repl contain regx metacharacters.
See
perldoc -q "How can I quote a variable to use in a regexp?"
Think about the "/o" pattern match switch.
Also, why to you chomp those two?
Also, that 'while' looks a bit odd; readdir will load @file exactly
once.
Also, why are you concatenating $_ onto $file?
Also, that indentation style leaves a lot to be desired. :-)
--
Brad
------------------------------
Date: 26 May 2000 14:31:58 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Can't get my search and replace script to work
Message-Id: <8gm1su$1dh$2@nntp9.atl.mindspring.net>
dutchm@my-deja.com wrote:
: I can't seem to figure out why this script won't work. I am wanting to
: search multiple text files for an expression and replace one word
: of the expression.
: $fromdir = "/symlnks/io/jobs/ftp_test";
[snip]
: opendir(DIR,$fromdir) or die "could not open dir: $!";
:
: while (@file = readdir(DIR)) {
You know this outer loop will execute at most once, don't you?
: foreach $file (@file) {
: chomp $file;
Why do you think you need to do this?
Why aren't you indenting your loops?
: next if (-d $file);
Have you read what the documentation for readdir() says about doing file
tests on its results?
: open(FILE, "$fromdir/$file") or die "I shant open $file: $!";
: open(OUT,">$todir/$file") or die "I shant cannot open $file: $!";
: while (<FILE>) {
:
: $file .= $_;
Why are you doing this?
: s/^$exp$/$repl/g;
Why did you use /g here?
:
: print OUT;
: }}}
:
: close FILE;
: close DIR;
:
: exit;
Your code contains such an odd mix of cluefulness (checking the results of
filesystem operations, etc.) and cluelessness (statements that serve no
purpose, etc.) that I'm a bit worried that you're simply rubbing together
bits and pieces of code taken from elsewhere in the hope that they'll
ignite into a working program. Trust me, going to the documentation and
looking up constructs you don't understand will help you get the job done
much faster.
------------------------------
Date: Fri, 26 May 2000 13:55:37 GMT
From: newsmf@bigfoot.com
Subject: comparing file content? Checksum?
Message-Id: <8glvoh$5ke$1@nnrp1.deja.com>
Hi -
I need to find a way, preferable with an existing perl library, to
check to see if content on another webpage has changed. in other
words, if i fetch a page on monday and then fetch the same page on
tuesday, how can i tell if the content changed without physically
viewing the page. is there away that a perl library can look at the
html of file and make an educated guess if it has changed and by what
degree??
Cheers from Miami Beach,
Marc
marc@quickbrowseNOSPAMX.com (pls remove NOSPAMX)
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 14:09:56 GMT
From: Andreas Kahari <andkaha@my-deja.com>
Subject: Re: comparing file content? Checksum?
Message-Id: <8gm0j6$6d7$1@nnrp1.deja.com>
I haven't used it, but there's something (a distribution) on CPAN called
"G/GA/GAAS/Digest-MD5-2.09.tar.gz" that supposedly implements the MD5
checksum algorithm. Fire up the CPAN module (see "perlmod CPAN") and
type "i /MD5/".
/A
In article <8glvoh$5ke$1@nnrp1.deja.com>,
newsmf@bigfoot.com wrote:
> Hi -
>
> I need to find a way, preferable with an existing perl library, to
> check to see if content on another webpage has changed. in other
> words, if i fetch a page on monday and then fetch the same page on
> tuesday, how can i tell if the content changed without physically
> viewing the page. is there away that a perl library can look at the
> html of file and make an educated guess if it has changed and by what
> degree??
>
> Cheers from Miami Beach,
>
> Marc
>
> marc@quickbrowseNOSPAMX.com (pls remove NOSPAMX)
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
--
# Andreas Kähäri, <URL:http://hello.to/andkaha/>.
# All junk email is reported to the appropriate authorities.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 26 May 2000 14:41:55 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: comparing file content? Checksum?
Message-Id: <8gm2fj$1dh$3@nntp9.atl.mindspring.net>
newsmf@bigfoot.com wrote:
: I need to find a way, preferable with an existing perl library, to
: check to see if content on another webpage has changed. in other
: words, if i fetch a page on monday and then fetch the same page on
: tuesday, how can i tell if the content changed without physically
: viewing the page. is there away that a perl library can look at the
: html of file and make an educated guess if it has changed and by what
: degree??
You've been pointed to some checksum routines, but there's another tack
you can take if, as I suspect, you're fetching the page via HTTP. HTTP
allows you to ask a server to give you a resource only if it's been
modified since a date you specified (this is how browsers check to see if
they can still use cached copies of resources). You can make such a
request using LWP.
------------------------------
Date: Fri, 26 May 2000 13:49:07 GMT
From: Eric Rainey <eric_r@my-deja.com>
Subject: DBI + DBD:mysql error 1054
Message-Id: <8glvcd$579$1@nnrp1.deja.com>
Howdy:
I'm trying to do a simple insert statement into a mysql database using
Perl (who isn't?).
Here is the line of code: (\ = line continues)
my $success = $dbh->do("insert into $userDBTime \
(eid,sid,pid,hours,dateworked) values \
($user,1,$pid,$entryVal,".($timeData[5]+1900). \
($timeData[4]+1).($timeData[3]).");");
However, my success is nonexistant. Here is a dump od DBI::err and
DBI::error and the output of print "insert..."
1054 Unknown column 'user' in 'field list' insert into 33684TempDBTime
(eid,sid,pid,hours,dateworked) values
(25,1,'user',9,19691231);
Now if I copy and paste the insert... part into the command line of
mysql, everything is hunkey dorey.
Anybody know what's up?
Thanks,
Eric
--
Experiential Analyst
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 14:24:44 GMT
From: Rodney Engdahl <red_orc@my-deja.com>
Subject: Re: DBI + DBD:mysql error 1054
Message-Id: <8gm1en$70f$1@nnrp1.deja.com>
In article <8glvcd$579$1@nnrp1.deja.com>,
Eric Rainey <eric_r@my-deja.com> wrote:
> Howdy:
>
> I'm trying to do a simple insert statement into a mysql database using
> Perl (who isn't?).
>
> Here is the line of code: (\ = line continues)
>
> my $success = $dbh->do("insert into $userDBTime \
> (eid,sid,pid,hours,dateworked) values \
> ($user,1,$pid,$entryVal,".($timeData[5]+1900). \
> ($timeData[4]+1).($timeData[3]).");");
I don't think this will solve the whole problem, but you shouldn't need
the ';' inside the ->do() string, even though you do need it at the
mysql command line.
>
> However, my success is nonexistant. Here is a dump od DBI::err and
> DBI::error and the output of print "insert..."
>
> 1054 Unknown column 'user' in 'field list' insert into 33684TempDBTime
> (eid,sid,pid,hours,dateworked) values
> (25,1,'user',9,19691231);
>
> Now if I copy and paste the insert... part into the command line of
> mysql, everything is hunkey dorey.
>
> Anybody know what's up?
>
> Thanks,
> Eric
> --
> Experiential Analyst
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 26 May 2000 14:46:14 GMT
From: davidkrainess@yahoo.com (David Krainess)
Subject: Re: DBI:ODBC on windows nt
Message-Id: <8F4046ED7davidkrainessyahooco@38.9.69.2>
I guess my main problem is with Microsoft not being to perl friendly
(meaning that there isn't many faqs/documentation sites for perl "web"
database connectivity on NT) and most people buy third party or use ASP for
database access in NT. I'm almost sure it's a MS NT rights issue that the
cgi-bin emulation cannot see the ODBC data sources.
If anybody has set up DBI:ODBC to work via the web on NT, are there any
special tricks(permissions) to get perl to see the data sources?
------------------------------
Date: Fri, 26 May 2000 10:38:26 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: hashes vs associative arrays (was: Re: Array Question)
Message-Id: <Pine.GSO.4.21.0005261034020.29594-100000@dataserv.libs.uga.edu>
On Fri, 26 May 2000, Peter Lowe wrote:
...
> 1 => one
> 2 => two
> 3 -> three
> ...
>
> When I first saw that kind of thing in the source code of someone's
> Perl program, it all fit together - "ahh, associative... I see..."
Probably not.
1 => 'one',
2 => 'two',
3 => 'three',
> --
> This is not the signature you are looking for. Move along now.
These aren't the net 'bots we're looking for. Move along. Move along.
--
Brad
------------------------------
Date: Fri, 26 May 2000 14:45:01 GMT
From: pgl@random.noc.clara.net (Peter Lowe)
Subject: Re: hashes vs associative arrays (was: Re: Array Question)
Message-Id: <slrn8it3gs.10hr.pgl@random.noc.clara.net>
In article <Pine.GSO.4.21.0005261034020.29594-100000@dataserv.libs.uga.edu>,
Brad Baxter wrote:
>On Fri, 26 May 2000, Peter Lowe wrote:
>...
>> 1 => one
>> 2 => two
>> 3 -> three
>> ...
>>
>> When I first saw that kind of thing in the source code of someone's
>> Perl program, it all fit together - "ahh, associative... I see..."
>
>Probably not.
Eh?
> 1 => 'one',
> 2 => 'two',
> 3 => 'three',
I said "that type of thing", and I was just using it as an
example to try and explain why I thought "associative array"
was a more informative term than "hash". I apologise for Not
Quoting Where I Should Have Quote, but I wasn't writing any
code, I was giving an example of associated items. I could
was thinking of putting it something like:
1 is associated with one
2 is associated with two
...
but I didn't.
>> --
>> This is not the signature you are looking for. Move along now.
>
>
>These aren't the net 'bots we're looking for. Move along. Move along.
Sorry, I don't get it...
--
This is not the signature you are looking for. Move along now.
------------------------------
Date: Fri, 26 May 2000 16:12:45 +0200
From: Toni <tag@gmx.de>
Subject: IE blocks referer
Message-Id: <392E865D.C4406A61@gmx.de>
Hy, i´m pretty new to Perl/CGI.
I was puzzled to see, that my referer based authentification method
seems not to work with Internet Explorer (my system is Win98 IE5).
IE refuses sending its http_referer when coming from a
perl generated page. This is strange, because Netscape has got no
problems doing that.
Below is the way I check...and it works but only for netscape.
Why doesn´t IE send the referer (shall i ask this in a MS forum ?)
does anyone know a way around it (i do not want to use cookies).
Thanks in advance.
my ($auth)=0;
$referer=$ENV{HTTP_REFERER};
sub authentificate{
if ($initReferer eq $referer){
$auth++;
print "authentificated $auth";}
elsif($referer =~ /http:\/\/nagetier\/cgi-bin\/editq.pl*/){
$auth++;
print "authentificated $auth";
}
return $auth;
}
------------------------------
Date: 26 May 2000 14:48:48 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: IE blocks referer
Message-Id: <8gm2sg$1dh$4@nntp9.atl.mindspring.net>
Toni (tag@gmx.de) wrote:
: Hy, i´m pretty new to Perl/CGI.
Have you checked out the FAQ documents for both the Perl language and the
CGI protocol?
: I was puzzled to see, that my referer based authentification method
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Those four words cannot exist simultaneously in a meaningful sentence
unless immediately followed by "is a bad idea." Do a Deja search on this
group for posts that contain "referer" to see why.
: seems not to work with Internet Explorer (my system is Win98 IE5).
: IE refuses sending its http_referer when coming from a
: perl generated page. This is strange, because Netscape has got no
: problems doing that.
[snip code that tries to check the value of the header you say isn't
being sent, and which therefore can't possibly be responsible for the
header not being sent. You don't tell us anything about the code that
generates the page in question.]
------------------------------
Date: Fri, 26 May 2000 10:41:35 -0400
From: Brad Baxter <bmb@dataserv.libs.uga.edu>
Subject: Re: Member Area Help!
Message-Id: <Pine.GSO.4.21.0005261040450.29594-100000@dataserv.libs.uga.edu>
On Thu, 25 May 2000, bluegreenturtles wrote:
> I'm very new to the world of perl and cgi, and I really need
> some help. I am trying to set up a site that allows users to
> register, login and then be directed to a member area sepecific
> to them. Their member area would include account info and such.
> I also need to track their activity so I can assign them points
> for specific actions. I have searched all over and have found
> few things to help me. Because I don't understand Cgi or Perl
> much I am very confused on what is needed to do all of theses
> things. Do I need Databases, Trackers, Password Protection
> seperatly or is there a free program or script that can do it
> all. And what is needed from a server to use these scripts.I
> know I'm asking alot but if there is anyone with any info that
> will help it would be greatly appreciated. Thanks
Sounds like you need to hire a consultant.
--
Brad
------------------------------
Date: Fri, 26 May 2000 23:28:35 +1000
From: "Iain Hosking" <iain_hosking@hotmail.com>
Subject: Net::FTP locks up during put
Message-Id: <392e7b93@pink.one.net.au>
(I've also posted this on comp.lang.perl.modules)
I've been using Net::FTP for a while now, but I've just become painfully
aware of a problem when the network connection has a glitch during a put.
The CPU goes to 100% and the perl script appears to hang, even when the
network connection is restored.
Our company runs pushes data to our clients constantly (every few minutes,
24 x 7) and robustness and reliability is very important. I had hoped to
replace the existing VB scripts with Perl scripts, believing Perl to be more
reliable and maintainable, but now I'm not so sure. Has anyone got any
suggestions, either to abort that particular put or to abort the Perl
script?
I'm using ActiveState Perl build 522 on NT 4.0 Server and workstation, and
libnet 1.06 (the most recent version from ActiveState's PPM).
Much obliged for any help.
Iain
------------------------------
Date: Thu, 25 May 2000 17:38:52 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Perl 5.6.0: Why would a while cause a subroutine/method to disappear?
Message-Id: <392D64BE.F45B5BC1@earthlink.net>
This one has me really stumped. I strongly suspect a Perl bug, but I
couldn't find anything in the Perl bug db like it, and I can't make a
simple test case to submit...
[Environment is Perl 5.6.0 on Solaris 5.6]
I have a non-trivial Perl app that's implemented with lots of good,
clean OO. Everything's an object., etc., etc.
It's been functioning more or less fine until I made what I thought
should have been an innocuous change to a method--I wrapped a section of
the method in a while (expr) { } to retry an HTTP GET on failure.
What's utterly bizarre is that when I add this while(){}, all of a
sudden the script fails at the invocation of the method with the
following error:
Undefined subroutine &SI::DatasourceLN::getCitations called at
SI/Collection.pm
line 176, <> line 2 (#1)
The subroutine/method most certainly *is* defined, and if I remove the
while(){} loop inside getCitations(), everything runs just fine!
I'm going to experiment shortly with other versions of Perl, but I
thought I would post this to see if this is a known problem.
Also, does anyone have any suggestions for getting more diagnostic info
out of Perl? I'm already doing use diagnostics, I've run it with -w,
debugger doesn't show much useful. Argh!
Eher's the method, with the while(){} in question marked by '###'. I'm
not including the whole package, but if someone wants to see the whole
file, I could send it.
Much thanks...
dwh
-snip-
sub getCitations {
my $self = shift;
my $query = shift;
my $src = shift;
my $after = shift || 90;
my $num = shift;
my $getCounts = shift;
if (!$query) {
die SI::Error->new(SI::Error::ERROR_INTERNAL,
"SI::DatasourceLN::getCitations called with empty query");
}
my $queryAttempts;
my $error;
my $i=0;
while ($i < 1) { ### this is the culprit ###
### and the following line causes the same problem ###
# while ((!$error) or ($error->getCode() !=
SI::Error::ERROR_RESULT_SET_TOO_LARGE)) {
$i++;
my $afterString = makeAfterString($after);
# :TODO: params should he handled better; join with '&'
# first we do the initial call, which will come back with frames.
$self->{Request}->uri($::Config{Host} . $::Config{Path} .
"v1_search?guts=1&" . $src->getSources() .
"${afterString}&query=" . $query);
my $start = [gettimeofday];
$::log->log($self->{Request}->as_string(), 2);
$self->{Response} = $self->{UA}->request($self->{Request});
$queryAttempts++;
${$self->{_stats}}{'010initialLnRequest'} = tv_interval($start);
$::log->log($self->{Response}->as_string(), 2);
# now pick out the ref in the right frame that actually has the
# contents
# :TODO: this depends on the name of the command, should probably
remove that dependency
my $contentPtr = $self->{Response}->content_ref();
my ($href) = $$contentPtr =~ /SRC=\"(.+doclistDisplay[^\"]+)\"/;
if (!$href) {
$error = $self->identifyError();
if ($error->getCode() == SI::Error::ERROR_RESULT_SET_TOO_LARGE) {
# reduce 'after' by an order of magnitude, try again
$after = POSIX::floor($after / 10);
$after = 1 if ($after < 1);
}
}
} # while ### the other end of the culprit ###
my $hitCount;
# if ($getCounts) {
# get the other href as well, so we can get the document count.
# :TODO: We really don't want to do these 2 requests in
# sequence. Yes, one will go away but is there any way to do it in
# parallel before then?
my $start = [gettimeofday];
my ($otherHref) = $$contentPtr =~
/SRC=\"(.+browseNavigation[^\"]+)\"/;
$self->{Request}->uri($::Config{Host} . $otherHref);
# :TODO: Not sure we need to keep this response in the object,
# ditto for the other actually. Perhaps just method-local
# storage.
$::log->log($self->{Request}->as_string(), 2);
$self->{Response} = $self->{UA}->request($self->{Request});
${$self->{_stats}}{'hitCountRequest'} = tv_interval($start);
($hitCount) = ${$self->{Response}->content_ref()} =~
/Documents\s+\d+\s+\-\s+\d+\s+of\s+(\d+)/;
# }
$start = [gettimeofday];
$self->{Request}->uri($::Config{Host} . $href);
$::log->log($self->{Request}->as_string(), 2);
$self->{Response} = $self->{UA}->request($self->{Request});
${$self->{_stats}}{'020citationListLnRequest'} = tv_interval($start);
# :TODO: we need to check for an error from this request as well.
# One known error is: 'We cannot process your request at this time.'
$start = [gettimeofday];
$self->_prepForParsing('CITELIST');
${$self->{_stats}}{'030PrepForParsing'} = tv_interval($start);
$start = [gettimeofday];
my $citationsDOM = $self->_createDomFromPrepped($hitCount, "Query
attempts: $queryAttempts");
${$self->{_stats}}{'040CreateDOM'} = tv_interval($start);
$self->_insertStats($citationsDOM);
$self->{Response} = undef; # clear results so they're not hanging
# around later
return($citationsDOM);
}
------------------------------
Date: 26 May 2000 14:14:39 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Perl 5.6.0: Why would a while cause a subroutine/method to disappear?
Message-Id: <8gm0sf$1dh$1@nntp9.atl.mindspring.net>
Denis Haskin (dwhaskin@earthlink.net) wrote:
: It's been functioning more or less fine until I made what I thought
: should have been an innocuous change to a method--I wrapped a section of
: the method in a while (expr) { } to retry an HTTP GET on failure.
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.
------------------------------
Date: 26 May 2000 13:25:16 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Perl unusable as a programming language
Message-Id: <slrn8isups.be1.simon@justanother.perlhacker.org>
Tushar Samant (comp.lang.perl.moderated):
>I would say his beef is with incomplete or vague documentation.
I don't think it's that, but I'm happy to take a counter-example. (So
long as it's followed by a patch. :)
At last count, Perl had 70,000 lines of core documentation. If that's
incomplete, we're in bigger trouble than I thought.
--
"MSDOS didn't get as bad as it is overnight -- it took over ten years
of careful development."
(By dmeggins@aix1.uottawa.ca)
------------------------------
Date: Fri, 26 May 2000 15:19:33 +0300
From: "Alexey Alexapolsky" <wake@thukraine.com>
Subject: regexp - "not this word" pattern ?
Message-Id: <8glqen$13sj$1@ark.cris.net>
Hi ! How to write a regexp that finds lines which dont contain
a given sybmol sequence. For example lines that don't contain <img> tag , or
lines that contain table tags but dont contain another table tags between
them.
AFAIK , ^ negation is used only for single symbols , not for oredered
groups.
------------------------------
Date: Fri, 26 May 2000 16:48:24 +0200
From: Ulrich Ackermann <uackermann@orga.com>
Subject: Re: regexp - "not this word" pattern ?
Message-Id: <392E8EB8.1BFB2C13@orga.com>
Alexey Alexapolsky wrote:
>
> Hi ! How to write a regexp that finds lines which dont contain
> a given sybmol sequence. For example lines that don't contain <img> tag , or
> lines that contain table tags but dont contain another table tags between
> them.
> AFAIK , ^ negation is used only for single symbols , not for oredered
> groups.
if ($string !~ m/whatever/) {
# do something
}
HTH, Ulrich
--
Ulrich Ackermann
ORGA Kartensysteme GmbH (SY-PEAT-STA)
Tel.:+49.5254.991-925
mailto:uackermann@orga.com
------------------------------
Date: 26 May 2000 14:51:53 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: regexp - "not this word" pattern ?
Message-Id: <8gm329$1dh$5@nntp9.atl.mindspring.net>
Alexey Alexapolsky (wake@thukraine.com) wrote:
: Hi ! How to write a regexp that finds lines which dont contain
: a given sybmol sequence. For example lines that don't contain <img> tag , or
: lines that contain table tags but dont contain another table tags between
: them.
: AFAIK , ^ negation is used only for single symbols , not for oredered
: groups.
Read the section in perlop about the !~ operator.
------------------------------
Date: Fri, 26 May 2000 15:54:44 +0100
From: Toby Arkless <tarkless@wilco-int.com>
Subject: Sybperl/dump database
Message-Id: <392E9034.F0F8D82E@wilco-int.com>
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: Fri, 26 May 2000 14:43:57 +0100
From: Dave Cross <dave@dave.org.uk>
Subject: Re: time and date conversion
Message-Id: <0evsisgd19q5gmbfmrgag6vpt816k5aajn@4ax.com>
On Fri, 26 May 2000 14:52:19 +0100, Frederic Hoerni
<fhoerni@intelcom.fr> wrote:
>hello,
>i want to convert a date to the internal time format (number of seconds
>since 01/01/1970).
>INPUT : 05/26/2000 12:25:34
>OUTPUT : number of seconds since 01/01/1970
>(it is the opposite of localtime ())
>
>what function does this ?
timelocal in the Time::Local module. But don't forget you'll need to
adjust the month and year values to be 'localtime-friendly'.
#!/usr/bin/perl -w
use strict;
use Time::Local;
my $input = '05/26/2000 12:25:34';
my ($mn, $dy, $yr, $hr, $mi, $sec)
= $input =~ m!(\d\d)/(\d\d})(\d\d\d\d) (\d\d):(\d\d):(\d\d)!;
$mn--;
$yr -=1900;
my $secs = timelocal($sec, $mi, $hr, $dy, $mn, $yr);
print $secs;
hth,
Dave...
--
<http://www.dave.org.uk> SMS: sms@dave.org.uk
yapc::Europe - London, 22 - 24 Sep <http://www.yapc.org/Europe/>
"There ain't half been some clever bastards" - Ian Dury [RIP]
------------------------------
Date: Fri, 26 May 2000 10:10:35 -0500
From: "John A. Dutton" <jad9@po.cwru.edu>
Subject: Re: time and date conversion
Message-Id: <392E93EA.DF19515F@po.cwru.edu>
--------------BC725E64A973271574EB9D61
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Frederic Hoerni wrote:
> hello,
> i want to convert a date to the internal time format (number of seconds
> since 01/01/1970).
> INPUT : 05/26/2000 12:25:34
> OUTPUT : number of seconds since 01/01/1970
> (it is the opposite of localtime ())
>
> what function does this ?
timelocal() in Time::Local
John
--
http://johnadutton.com/ (currently start.cwru.edu)
senior, case western reserve university
brother, phi kappa theta fraternity
--------------BC725E64A973271574EB9D61
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Frederic Hoerni wrote:
<blockquote TYPE=CITE>hello,
<br>i want to convert a date to the internal time format (number of seconds
<br>since 01/01/1970).
<br>INPUT : 05/26/2000 12:25:34
<br>OUTPUT : number of seconds since 01/01/1970
<br>(it is the opposite of localtime ())
<p>what function does this ?</blockquote>
<pre>timelocal() in Time::Local</pre>
<pre>John</pre>
<pre>--
<A HREF="http://johnadutton.com/">http://johnadutton.com/</A> (currently start.cwru.edu)
senior, case western reserve university
brother, phi kappa theta fraternity</pre>
</html>
--------------BC725E64A973271574EB9D61--
------------------------------
Date: Fri, 26 May 2000 09:30:58 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Timing ?
Message-Id: <392E8AA2.13F4313E@texas.net>
Lew wrote:
>
> I need to get some text to display about 5 seconds after some initial > text.
Reread Abigail's response. The solution is there.
- Tom
------------------------------
Date: Fri, 26 May 2000 00:56:23 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: What package does "xsubpp" belong to and where are updates?
Message-Id: <XYjX4.93847$hT2.388039@news1.rdc1.ct.home.com>
In comp.lang.perl.misc Dave Elstner <elstner@bellatlantic.net> wrote:
> While attempting to run makefile.pl in sybperl-2.12, I get the following
> warning:
> Writing Makefile for Sybase::CTlib
> Warning: This extension wants to pass the switch "-prototypes" to xsubpp.
> Your version of xsubpp is 1.0 and cannot handle this.
> Please upgrade to a more recent version of xsubpp.
> "xsubpp" is in c:\perl\lib\extutils. I've searched on both "xsubpp" and
> "extutils" and can't find anything. Can someone tell me where I can get an
> update?
It's part and parcel of the main perl distribution. You'll need to upgrade
to a more recent version of perl to get it. (It's got far too much
dependence on perl's guts to be a drop-in replacement)
Dan
------------------------------
Date: Fri, 26 May 2000 13:46:59 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Where to Start + FIFO Stack
Message-Id: <slrn8ivkit.3cn.tjla@thislove.dyndns.org>
I was shocked! How could Makarand Kulkarni <makarand_kulkarni@My-Deja.com>
say such a terrible thing:
>> 2) How difficult would it be to implement a FIFO stack in Perl (i.e. a
>> script to accept form input, add the input to the top of the stack, and pop
>> the last entry)?
>
>very simple using perl arrays
>see these docs
>perldoc -f shift
>perldoc -f unshift
You mean "push" and "shift"
--
Gwyn Judd (tjla@guvfybir.qlaqaf.bet)
My return address is rot13'ed
The heart has its prisons that intelligence cannot unlock.
-- Marcel Jouhandeau, "De la grandeur"
------------------------------
Date: 26 May 2000 13:23:03 GMT
From: simon@brecon.co.uk (Simon Cozens)
Subject: Re: Why not 5.005_03?
Message-Id: <slrn8isuln.be1.simon@justanother.perlhacker.org>
Denis Haskin (comp.lang.perl.moderated):
>I've been using 5.6.0 for development, and while it's advertised as the
>"stable, tested release that you should use in production environments"
>(see http://www.perl.com/pub/language/info/software.html), I've
>encountered problems with it and Unicode that I had to work around.
Going back to 5.005_03 will not fix a Unicode problem. :)
Seriously, if there are any Unicode issues, let me know.
--
Oh my god! They killed Kennedy!
-- edfromo
------------------------------
Date: Fri, 26 May 2000 13:54:17 GMT
From: Denis Haskin <dwhaskin@earthlink.net>
Subject: Re: Why not 5.005_03?
Message-Id: <392E8196.3CCF6F9@earthlink.net>
My unicode problem was entered into perlbug by Ilya. See
http://bugs.perl.org/perlbug.cgi?req=tid&tid=20000426.003&range=24941&format=h
dwh
Simon Cozens wrote:
> Denis Haskin (comp.lang.perl.moderated):
> >I've been using 5.6.0 for development, and while it's advertised as the
> >"stable, tested release that you should use in production environments"
> >(see http://www.perl.com/pub/language/info/software.html), I've
> >encountered problems with it and Unicode that I had to work around.
>
> Going back to 5.005_03 will not fix a Unicode problem. :)
>
> Seriously, if there are any Unicode issues, let me know.
>
> --
> Oh my god! They killed Kennedy!
> -- edfromo
------------------------------
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 3174
**************************************