[15804] in Perl-Users-Digest
Perl-Users Digest, Issue: 3217 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 31 06:05:32 2000
Date: Wed, 31 May 2000 03:05:13 -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: <959767512-v9-i3217@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 31 May 2000 Volume: 9 Number: 3217
Today's topics:
Re: Algorythm needed for copying subdirectory hierarchi <thunderbear@bigfoot.com>
Re: Bout mailhandling <gellyfish@gellyfish.com>
Re: casting? <gellyfish@gellyfish.com>
Re: casting? (jason)
Re: DB_File on Unix vs. Windows <thoren@southern-division.com>
Disregard: capturing password via Basic Auth <kkrieger@erols.com>
Re: Disregard: capturing password via Basic Auth (Bart Lateur)
Re: Disregard: capturing password via Basic Auth (Neil Kandalgaonkar)
Re: Embedded new lines in a comma delimited file <debjit@oyeindia.com>
Re: Extracting info from variable <gellyfish@gellyfish.com>
Re: Extracting info from variable (jason)
Re: Finding repeating patterns inside arrays (M.J.T. Guy)
Re: First (implicit) argument passed to a method? <JC@MelroseCenter.com>
Re: Help - I've been spammed with PERL <gellyfish@gellyfish.com>
Re: help newbie : how to count line into a txt file <debjit@oyeindia.com>
How do I make perl flush? <philip@my-deja.com>
Re: How do I make perl flush? (Craig Berry)
How to convert LaTeX tables to html <nader@math.chalmers.se>
Re: modify the environment variables permanently via Pe <a.voerg@ieee.org>
Re: newbie question - dbi:mysql <gellyfish@gellyfish.com>
Re: Perl and OLE <gellyfish@gellyfish.com>
Re: Perl Tabular -> XML <thunderbear@bigfoot.com>
Re: Problem passing URLS <gellyfish@gellyfish.com>
Re: Reading XML documents <gellyfish@gellyfish.com>
Re: Regex prime numbers (Was Re: seeking method to enco (Sam Holden)
Re: Regex prime numbers (Was Re: seeking method to enco <godzilla@stomp.stomp.tokyo>
Re: Regex prime numbers (Was Re: seeking method to enco (Neil Kandalgaonkar)
Re: runtime errors - Q how to do this <gellyfish@gellyfish.com>
Re: Secure (enough) dayta encryption and decryption <nospam@no.spam>
Re: Secure (enough) dayta encryption and decryption (jason)
Re: Secure (enough) dayta encryption and decryption (jason)
Re: select() function does not work (M.J.T. Guy)
Re: system using parameters with spaces (jason)
Re: Translate foreign characters to English (Philip 'Yes, that's my address' Newton)
Re: Visual Studio Integration <gellyfish@gellyfish.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 31 May 2000 09:36:00 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Algorythm needed for copying subdirectory hierarchies
Message-Id: <3934C0E0.833006D7@bigfoot.com>
Abigail wrote:
> I won't do this in Perl, but if I had to, I would do:
>
> perl -e 'system "cd /; tar cfp - * | (cd /dest; tar xf -)"'
For generality you might want a Bp on the last tar.
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: 30 May 2000 10:27:56 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Bout mailhandling
Message-Id: <8h01is$l5i$1@orpheus.gellyfish.com>
On Mon, 29 May 2000 15:30:22 -0700 Fake51 wrote:
> Cheers
>
> But the prob's a bit bigger than that (I realized) and this
> could be the wrong news group (with my luck prolly is). It has
> to be automated, so letting a perl script feed thru incoming
> mails is mighty fine, but how do i trigger the script when a new
> mail has arrived in the box? System is unix. Any help be
> appreciated.
>
Most mail server programs allow you to define aliases that are actually
programs where the text of the message if passed in STDIN - you will want
to ask in the appropriate newsgroup for your mail server about how to do
this.
/J\
--
Your lives are in the hands of men no smarter than you or I, many of
them incompetent boobs. I know this because I worked alongside them,
gone bowling with them, watched them pass me over for promotions time
and again. And I say... This stinks!
--
fortune oscar homer
------------------------------
Date: 30 May 2000 10:54:40 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: casting?
Message-Id: <8h0350$qab$1@orpheus.gellyfish.com>
On Tue, 30 May 2000 00:05:47 -0700 Neil Macneale wrote:
> Hi all!
>
> I am new to the world of PERL, and I seem to have missed something in the
> Camel book. How do I cast something? I want to read in a character from
> a file, then print the decimal value of the byte written. I know how to
> do it in C, so I figured I would just cast the scalar as an (int) but
> PERL didn't like that at all. I tryed printf with no luck, and I tryed
> the int() function which didn't work either. What am I missing?
>
> The problem I am trying to solve is this: When I read MacOS text files on
> a Linux machine the new line characters are not recognized. I want to use
> perl to modify the file so it works like a standard text file in linux. I
> could do it in C, but I figured this would be an easy way to start
> putting perl to use.
>
As Rafael pointed out you will use ord() to get the decimal value
associated with a character, however your probably want to do a simple
substitution on the file - in the case of MacOS to Unix conversion you
will need to convert the single 0D character to an 0A :
s/\cM/\cJ/
or
$/ = "\cM";
$\ = "\cJ";
chomp;
print;
/J\
--
You'll have to speak up, I'm wearing a towel.
--
fortune oscar homer
------------------------------
Date: Wed, 31 May 2000 09:47:04 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: casting?
Message-Id: <MPG.139f7cbcb29bd7f99896fb@news>
Jonathan Stowe writes ..
>On Tue, 30 May 2000 00:05:47 -0700 Neil Macneale wrote:
>> Hi all!
>>
>> I am new to the world of PERL, and I seem to have missed something in the
>> Camel book. How do I cast something? I want to read in a character from
>> a file, then print the decimal value of the byte written. I know how to
>> do it in C, so I figured I would just cast the scalar as an (int) but
>> PERL didn't like that at all. I tryed printf with no luck, and I tryed
>> the int() function which didn't work either. What am I missing?
>>
>> The problem I am trying to solve is this: When I read MacOS text files on
>> a Linux machine the new line characters are not recognized. I want to use
>> perl to modify the file so it works like a standard text file in linux. I
>> could do it in C, but I figured this would be an easy way to start
>> putting perl to use.
>>
>
>As Rafael pointed out you will use ord() to get the decimal value
>associated with a character, however your probably want to do a simple
>substitution on the file - in the case of MacOS to Unix conversion you
>will need to convert the single 0D character to an 0A :
>
> s/\cM/\cJ/
now it's my turn .. for the above operator you're missing a global
modifier
s/\cM/\cJ/g
but I'm guessing you really meant
tr/\cM/\cJ/
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Wed, 31 May 2000 11:17:56 +0200
From: "Thoren Johne" <thoren@southern-division.com>
Subject: Re: DB_File on Unix vs. Windows
Message-Id: <8h2lfk$cbp$13$1@news.t-online.com>
Roel Zylstra <zyl@yahoo.com> wrote in message
news:39344E13.D5033B0B@yahoo.com...
> I am using Windows to develop a Perl script (with DB_File) and Unix
> to run it. I would like the database file to be able to be
> read by both OS's, but when I use lines like:
>
> tie(my %hash, "DB_File", $file_name, O_RDWR|O_CREAT|O_TRUNC, 0755,
> $DB_TREE);
> ...
> untie %hash;
>
> the operating systems cannot read the other's database file. (When I
> use binary to ftp array databases they work, so I know I'm transferring
> them correctly.) What can I use so that the databases are transferable?
Unix and Windows DB_File are not binary compatible.
i suggest you to write a programm that exports the DB_File records to ASCII
and vice versa.
gruß
thoren
8#X
--
----------------------------------------------------------------------
Thoren Johne - 8#X - thoren@southern-division.com
Southern Division Classic Bikes - www.southern-division.com
------------------------------
Date: Wed, 31 May 2000 00:10:11 -0400
From: Kurt Krieger <kkrieger@erols.com>
Subject: Disregard: capturing password via Basic Auth
Message-Id: <393490A2.60953CE5@erols.com>
Thanks to all who responded - I learned some good and bad things, and found
some useful links.
I've been asked to abandon Basic Authentication in favor of encrypted
cookies. That way we'll have control over the login screen (instead of the
yucky standard login popup), and we can store additional information, such
as personalization data, and even username/password. We'll then add some
type of NSAPI filter (perhaps a commercial product) to read the cookie on
the fly, perform authentication to protect restricted pages, and even pass
the username/password to CGI scripts wanting to connect to remote servers.
Now I get to read all of the reasons not to use cookies! 8^)
Kurt
Kurt Krieger wrote:
> Hi,
> I'm using Basic Authentication to provide access control to my web
> pages, and that all works fine. However, I need to provide single
> sign-on capability such that I can connect to additional servers as the
> logged in user. To connect to the additional servers via perl, I need
> both the username and the password of the logged in user.
>
> Getting the username is trivial ($ENV{'REMOTE_USER'}, or CGI.pm's
> user_name() sub), but I can't figure out how to get the password. I'm
> very familiar with CGI.pm, but it doesn't provide a 'convenience'
> function for password like it does user_name() for username. It also
> doesn't seem to provide raw access to the received request header so
> that I can manually parse it, pull out the base64 encoded
> username:password string, then decode it.
>
> I looked at HTTP::Headers, but was unable to get the info I needed, as
> if its basic_authentication() sub could be used only to *set* the
> values, not *get* them.
>
> Any suggestions?
>
> Platform: Solaris 2.7, iPlanet (Netscape) Webserver, iPlanet Directory
> Server (LDAP), CGI.pm
>
> Thanks a lot, Kurt
------------------------------
Date: Wed, 31 May 2000 09:25:06 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Disregard: capturing password via Basic Auth
Message-Id: <3935da4e.5885048@news.skynet.be>
Kurt Krieger wrote:
>Now I get to read all of the reasons not to use cookies! 8^)
$user ne $cookie
--
Bart.
------------------------------
Date: 31 May 2000 09:50:02 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Disregard: capturing password via Basic Auth
Message-Id: <8h2n8a$i9g$1@newsflash.concordia.ca>
In article <393490A2.60953CE5@erols.com>,
Kurt Krieger <kkrieger@erols.com> wrote:
>
>I've been asked to abandon Basic Authentication in favor of encrypted
>cookies. That way we'll have control over the login screen (instead of the
>yucky standard login popup), and we can store additional information, such
>as personalization data, and even username/password. We'll then add some
>type of NSAPI filter (perhaps a commercial product) to read the cookie on
>the fly, perform authentication to protect restricted pages, and even pass
>the username/password to CGI scripts wanting to connect to remote servers.
>
>Now I get to read all of the reasons not to use cookies! 8^)
Coding up your own authentication / authorization scheme in the
webserver's API, using encrypted or digested cookies, sucks much
less IMO. You listed all the right reasons.
Of course you have to be pretty careful not to screw up, but since
the alternative has zero security anyway you can't get worse than
that.
Anyway this is offtopic for perl newsgroups.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: Wed, 31 May 2000 10:22:30 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: Embedded new lines in a comma delimited file
Message-Id: <8h3arv$j80$1@news.vsnl.net.in>
Try this:
#!/usr/bin/perl -w
my $str = qq`1,2,"abcdef
ghij",3,4,"hello"
1,2,"abcdef
ghij",3,4,"hello"
`;
$str =~s/(\"\w*?)\n(\w*?\")/$1$2/gs;
print $str;
Kragen Sitaker wrote in message ...
>In article <8h0mhs$h3r$1@nnrp2.deja.com>, <joseph_stiehm@my-deja.com>
wrote:
>>Here's a regexp question that's giving me fits:
>>
>>I've got a comma-delimited text file with embedded (carriage return+new
>>line)'s -
>>
>>ex.
>>1,2,"abcdef
>>ghij",3,4,"hello"
>>
>>Anybody know of a regular expression to strip the embedded carriage
>>return+new line?
>
>I have done this before; it is not a trivial thing. I think there are
>CSV Perl modules to handle it. Look on CPAN.
>--
><kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
>The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
><URL:http://www.pobox.com/~kragen/bubble.html>
>The power didn't go out on 2000-01-01 either. :)
------------------------------
Date: 30 May 2000 10:56:38 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Extracting info from variable
Message-Id: <8h038m$qmi$1@orpheus.gellyfish.com>
On Tue, 30 May 2000 08:19:33 GMT jason wrote:
> Robert Voesten writes ..
>>How do extract info from this variable in a file:
>>"DTM07137199810121215203 "
>>(so it is DTM07137199810121215203 + 20 spaces"
>>
>>the info output must be:
>>
>>"Date of creation: 12th octobre 1998 at 12:15"
> -
>>I first tried it my own offcourese, and the result was this (which didn't
>>work. because of the logical errors):
>>
>>open (FILE, "file.txt"); #check all lines 1 by 1
>>for
>> FILE
>>
>>if (/DTM[0-9]{5}([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})[0-9]{3}
>>{20}/) {
>> # DTM 12345 (1998) (10) (12) (12)
>>(15) 203 spaties
>> print "Aanmaak datum: $3-$2-$1 om $4:$5";
>> } else {
>> print "Error, doesn't work";
>> }
>>}
>>close FILE;
>
> you basically did it .. I'm sure others will point out some stylistic
> improvements in your code .. but basically all you need to do is
> structure the 'for' statement correctly to read from a file handle
>
> instead of
>
> for
> FILE
>
> you should have
>
> for(<FILE>)
> {
>
Or most probably
while(<FILE>)
{
}
/J\
--
This is absolutely the last funeral we ever take you kids to.
--
fortune oscar homer
------------------------------
Date: Wed, 31 May 2000 09:37:33 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Extracting info from variable
Message-Id: <MPG.139f7a85458940459896fa@news>
Jonathan Stowe writes ..
>On Tue, 30 May 2000 08:19:33 GMT jason wrote:
-
>> instead of
>>
>> for
>> FILE
>>
>> you should have
>>
>> for(<FILE>)
>> {
>>
>
>Or most probably
>
> while(<FILE>)
> {
> }
oops .. yes .. thanks
for the originator - the advantage of using the while() construct as
Jonathan (almost too) politely suggests is that it processes the input
file one line at a time .. whereas the for() construct first builds a
list of every line in the file - and then begins processing
obviously the line by line method will consume less resources
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: 31 May 2000 09:44:51 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Finding repeating patterns inside arrays
Message-Id: <8h2muj$jm9$1@pegasus.csx.cam.ac.uk>
Makarand Kulkarni <makarand_kulkarni@My-Deja.com> wrote:
>The array I am using is an array of function names from a
>stack trace. The repeating pattern is a situation of a recursive
>call in a loop
>
>eg. f1->f2->f3->f5->f6->f7->f5->f6->f7->f5->f6->f7... etc
>
>The pattern f5, f6 and then f7 is what I want. The number
>of times the function was called is irrelevant.
If what you want is to find cycles in an iterated function, the
standard algorithm is the "step 1, step 2" process:
my @a = qw/hello hello1 hello2 hello3 hello1 hello2 hello3 hello1/;
my ($p1, $p2) = (0, 1);
$p1++, $p2+=2 while $a[$p1] ne $a[$p2];
# next line only need if you want *first* appearance of loop
$p1--, $p2-- while $a[$p1] eq $a[$p2];
print "Loop is @a[$p1+1..$p2]\n";
This only applies if your sequence has been obtained by iterating
some function, i.e. if you can guarantee that if f6 ever follows f5, then
f6 *always* follows f5. This algorithm is really designed to operate
"on-line", i.e. you generate the array elements only as you need them.
Thus it will only work if the loop occupies more than half of the array.
Mike Guy
------------------------------
Date: Wed, 31 May 2000 00:53:09 -0700
From: "Justin Case" <JC@MelroseCenter.com>
Subject: Re: First (implicit) argument passed to a method?
Message-Id: <8h2g8v$1g9$1@news.bayarea.net>
Andrew,
In 'Programming Perl', chapter 5, see 'A Method Is Simply a Subroutine'.
I also found Damian Conway's 'Object Oriented Perl' to be very helpful.
------------------------------
Date: 30 May 2000 10:21:20 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help - I've been spammed with PERL
Message-Id: <8h016g$jt8$1@orpheus.gellyfish.com>
On Mon, 29 May 2000 21:50:07 GMT Monte wrote:
> On 29 May 2000 15:19:05 -0500, Tony Curtis <tony_curtis32@yahoo.com>
> wrote:
>>>> On Mon, 29 May 2000 15:43:06 -0400,
>>>> "new" <booksellersunion@booksellersunion.org> said:
>>> Than, all of a sudden, the page started getting blasted
>>> with about a zillion new links -- all sent through
>>> AGENT: CGI
>
>>And the relevance to perl is...?
>>perl != CGI
>>Try in comp.infosystems.www.authoring.cgi
>
>
> DUH! Tony, can you enlighten all of us as to another program or
> language that uses an AGENT::CGI module?
Perhaps you can. There doesnt appear to be a module of this name on CPAN.
Anyhow whatever language it might be written in it is still general to the
CGI domain rather than specific to Perl.
/J\
--
The code of the schoolyard, Marge! The rules that teach a boy to be a
man. Let's see. Don't tattle. Always make fun of those different from
you. Never say anything, unless you're sure everyone feels exactly the
same way you do.
--
fortune oscar homer
------------------------------
Date: Wed, 31 May 2000 10:28:56 +0530
From: "Debjit" <debjit@oyeindia.com>
Subject: Re: help newbie : how to count line into a txt file
Message-Id: <8h3b8n$jdm$1@news.vsnl.net.in>
This will help:
#!/usr/bin/perl -w
open(FILE, 'showthread.pl') or die "cannot open file: $!\n";
my $count = (my @file=<FILE>);
print $count;
close FILE;
Olivier laurent wrote in message <39339D92.A9379252@archangelis.com>...
>Hi,
>
>I usually work with javascript/HTML (I'm a webdesigner) and I don't know
>nothing at all about perl.
>
>I've got to make a script that count the number of lines of a txt file.
>and publish the result into a static HTML page.
>
>Is there anybody who can tell me how to start ?
>
>Any examples will be warmly welcome.
>
>thx
>
>Olivier
>
>
------------------------------
Date: Wed, 31 May 2000 04:00:51 GMT
From: Fearless <philip@my-deja.com>
Subject: How do I make perl flush?
Message-Id: <8h22pc$f9c$1@nnrp1.deja.com>
Hi,
My basic problem is that when diff runs (see the continue block below),
the new file hasn't been fully written to disc, so differences are
found when there are none. My understanding is that close(ARGV) closes
the input file but the output file (which has the name the input file
used to have) has not been closed so diff sees the unflushed new file.
So, how do I flush the output file (or do whatever) so diff sees a
fully written file?
This is my first perl script, so perhaps I have constructed it
inappropriately for my purpose (which is to make the same change to a
large number of files, and where no change was made, retain the
filestamp of the old file).
If you're wondering about all the $MODIFYs, the real script can also
show all the changes it intends to make without actually making them.
Thanks,
Philip
systime
com
au
politics: many blood-sucking parasites
----
The script is started thus (essentially):
ls |xargs perl -i.bak /usr/bin/mod.pl
The script looks like this (except more complex):
while(<>)
{
if(/s1/i)
{
if($MODIFY eq "yes")
{
s/s1/s2/i;
}
}
}
continue
{
if($MODIFY eq "yes")
{
print;
}
if(eof)
{
close(ARGV); #reset $.
$new=$ARGV;
$old="$new".".bak";
if($MODIFY eq "yes")
{
# system "wc $old $new >owc";
system "diff $old $new >odiff 2>&1";
$ret=$?/256;
if($ret==0)
{
system "mv $old $new";
}
}
}
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 31 May 2000 06:21:37 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: How do I make perl flush?
Message-Id: <sj9brhcu5pj156@corp.supernews.com>
Tell it something really embarrassing? :)
Seriously speaking, your whole approach seems rather convoluted, but $|
might be worth investigating -- see perlvar.
--
| 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: 31 May 2000 06:16:40 +0200
From: Nader Tajvidi <nader@math.chalmers.se>
Subject: How to convert LaTeX tables to html
Message-Id: <yiru2fftkuv.fsf@krein.math.chalmers.se>
Hi,
I have about 40 latex tables and I'm trying to convert them to
html tables. These tables are not directly related so I want to
have 40 different html files each containing a corresponding
latex table without any reference to each other. I tried "the
command "latex2html table*.tex" but it didn't work. I wonder if
there is any package in perl which can be used for this? I'm
running this under SunOS 5.6. I appreciate any pointer to where
I can find more info on this. Many thanks in advance for your
time.
Best regards,
Nader Tajvidi
------------------------------
Date: Wed, 31 May 2000 09:07:59 +0200
From: Andreas =?iso-8859-1?Q?V=F6rg?= <a.voerg@ieee.org>
Subject: Re: modify the environment variables permanently via Perl
Message-Id: <3934BA4E.3C8ACCA3@ieee.org>
Abigail schrieb:
> On Tue, 30 May 2000 14:07:55 +0200, Andreas Vörg <a.voerg@ieee.org> wrote:
> ++ Hello,
> ++
> ++ I am looking for a way to modify the environment variables permanently
> ++ via Perl.
>
> Easy. Just install VMS.
What is VMS?
--
Tschüs
Andreas Vörg
EMail: mailto:a.voerg@ieee.org
------------------------------
Date: 31 May 2000 08:07:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie question - dbi:mysql
Message-Id: <8h2dnp$osq$1@orpheus.gellyfish.com>
On 26 May 2000 15:15:21 GMT The WebDragon wrote:
> In article <392CDCB3.3E0AB73B@ford.com>, Richard Hardicre
> <rhardicr@ford.com> wrote:
>
> | just check the value of the return code on the way out:
> | try:
> | $sth->prepare(blah);
> | my $rc = $sth->execute;
> | if ($rc eq '0E0') {
> | print "failed\n";
> | }
>
> how many people, upon reading this, suddenly heard voices from "Wizard
> of Oz" chanting in the background?
>
> aside from the fact that you knew the error code was '0E0', how would
> one discover this obscure code .. reading the pod manual in DBI::MYSQL ?
>
From the DBI manpage :
For a non-select statement, execute returns the number
of rows affected (if known). If no rows were affected
then execute returns "0E0" which Perl will treat as 0
but will regard as true. Note that it is not an error
for no rows to be affected by a statement. If the num
ber of rows affected is not known then execute returns
-1.
/J\
--
Oh, Marge. I thought I had an appetite for destruction, but all I wanted
was a club sandwich.
--
fortune oscar homer
------------------------------
Date: 31 May 2000 06:55:07 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Perl and OLE
Message-Id: <8h29fr$atg$1@orpheus.gellyfish.com>
On Thu, 25 May 2000 09:38:34 GMT postmaster@bill.co.uk wrote:
> Hi, I'm using perl under linux and I use sybperl to access
> an MS SQL server database. The Tables in the SQL database
> are linked into MS Access. A new table has just been created
> which has image data. It is an OLE object when viewed in Access
> and the users can drop a gif or jpg in the field. When I get the image
> out, it has a bunch of OLE stuff (I presume) in front of the image.
> I'm not familiar with OLE structures and after looking at them
> this morning, I don't think I'm going to be an expert anytime
> soon. I also found an OLE perl mod, but it more or less just
> seems to deal with the document itself and I've only got a bit
> of it out of the database that I really just want to strip the
> garbage off of... spose I can try and find some way of searching
> for the start of the image, but if there's any better methods
> out there, I'd like to know....
>
You might look at the OLE::Storage module which may be able to get at the
image date, on the other hand it might not - I have never had occasion
to try and do this.
/J\
--
I think Mr. Smithers picked me for my motivational skills. Everyone
always says they have to work twice as hard when I'm around!
--
fortune oscar homer
------------------------------
Date: Wed, 31 May 2000 10:20:15 +0200
From: =?iso-8859-1?Q?Thorbj=F8rn?= Ravn Andersen <thunderbear@bigfoot.com>
Subject: Re: Perl Tabular -> XML
Message-Id: <3934CB3F.DCE76EE2@bigfoot.com>
Dougas Garstang wrote:
>
> Randy,
>
> Thanks for that. I had tried that one a few days ago. It generates very
> simple XML in the form:
>
> <ROW>
> <FIELD1>Data1</FIELD1>
> </ROW>
>
> The docs that come with it mention using XML::Parser to further enhance the
> output.I can't quite seem to fathom though how XML::Parser will allow me to
> make the XML adhere to a certain DTD.
Consider using an XSLT tool like Saxon to translate your XML-document
into the final form you require.
--
Thorbjørn Ravn Andersen "...plus...Tubular Bells!"
http://bigfoot.com/~thunderbear
------------------------------
Date: 31 May 2000 07:52:20 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Problem passing URLS
Message-Id: <8h2cr4$lur$1@orpheus.gellyfish.com>
On Thu, 25 May 2000 10:07:00 GMT sync24@my-deja.com wrote:
> Hi all,
>
> Whilst passing a URL to a perl script (that obtains img tags). I get
> the following error :
>
> Path components contain '/' (you must call epath) at
> C:/Perl/site/lib/URI/_generic.pm line 147
Well did you call epath ? You will need to read the documentation for
whatever module it is that you are using in your program - the URI
module is being used somewhere but you dont supply any other context
so I dont know whether you are using it directly or it is being used
by some LWP::* module or whatever.
/J\
--
Someone's trying to kill me! Oh, wait, it's for Bart.
--
fortune oscar homer
------------------------------
Date: 30 May 2000 19:10:26 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Reading XML documents
Message-Id: <8h106i$q0f$1@orpheus.gellyfish.com>
On Thu, 25 May 2000 10:45:22 +0200 Martin Askestad wrote:
>
> I'm trying to parse a XML document with Perl on a WindowsNT machine. Do
> I have to download some kind of module to do that. I'm having trouble
> with splitting the tags and getting the contents of them.
>
Everyone has been telling you to use XML::Parser (which is right),
however if you are using Activeperl then you will not need to install
it as it is installed part of the recent distributions because it is
needed by PPM ...
/J\
--
A boy without mischief is like a bowling ball without a liquid center.
--
fortune oscar homer
------------------------------
Date: 31 May 2000 04:09:40 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Regex prime numbers (Was Re: seeking method to encode email addresses in web page forms)
Message-Id: <slrn8j9444.2g3.sholden@pgrad.cs.usyd.edu.au>
On Tue, 30 May 2000 19:51:11 -0700,
Godzilla! <godzilla@stomp.stomp.tokyo> wrote:
>Sam Holden wrote:
>
>> Copying the prime generator you quoted in you post
>> (I snipped) will impress you?
>
>> no Content-Type crap
>
>> You'll notice there are 14 numbers there, so your answer was wrong.
>
>
>
>Well gosh, now don't you just take the fun out
>of everything in a schoolyard bully fashion.
I didn't notice any bullish behaviour... just a different approach. There
is after all more than one way to do it.
>
>Your code is not portable.
The code is portable enough... it will need to be changed to reflect
the current shell being used, which is not less portable than having to
change the #! line to point to the place where perl is installed on
the new machine.
It will work fine under bourne style shells. It will work fine under rc style
shells. The quotes will need to be changed for command.exe...
Of course it's just a shorthand way of writing things. Take the part in quotes
and put it in a file. Make the first line of the file
#!<perl location> <options on command line without the -e obviously>
I choose the shorter version since this is usenet and posting the longer
version seemed silly, since everyone who reads the documentation knows how to
convert between the two...
--
Sam
i am not grouchy. i have a personality deficiency.
-- Uri Guttman in <x7k8tshmn9.fsf@home.sysarch.com>
------------------------------
Date: Tue, 30 May 2000 21:13:01 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Regex prime numbers (Was Re: seeking method to encode email addresses in web page forms)
Message-Id: <3934914D.DE04796A@stomp.stomp.tokyo>
Alex Gough wrote:
> "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
> > There are twelve composite numbers in these
> > results you will see.
> > Write a cutesy program
> > to find those twelve composite numbers. This
> > will impress me, sorta.
> Well, those of us that can count found 14, this worked for me:
> @¬ =(41); # the key to the kingdom
>
> for (1..100) {
> my $candidate = ($_**2 + $_ + 41);
> LOOP: foreach (@¬) {
> if (($candidate/$_)== int($candidate/$_)) {
> print "$candidate is not a prime, factor $_\n";
> push @¬, $¬[-1]+2*@¬;
> last LOOP;
> }
> }
> }
Ok, I ran your code. Appears to work with perfection,
although I only factored the first few numbers. Here
are the results I obtained:
1681 is not a prime, factor 41
1763 is not a prime, factor 41
2021 is not a prime, factor 43
2491 is not a prime, factor 47
3233 is not a prime, factor 53
4331 is not a prime, factor 61
5893 is not a prime, factor 71
6683 is not a prime, factor 41
6847 is not a prime, factor 41
7181 is not a prime, factor 43
7697 is not a prime, factor 43
8051 is not a prime, factor 83
8413 is not a prime, factor 47
9353 is not a prime, factor 47
There is a subtle repeating pattern...
Suppose few are interested in this stuff.
> > will impress me, sorta.
See my "sorta" in there? This is a big clue,
a word speaking of "trick, be careful." As
you know, it is my habit, reflected by my
articles, to often toss in a twist, a surprise,
a challenge, a subtle something. My "sorta"
is just that; a hopeful surprise.
You know what is sad about this. I directed this
at my long time friend, Web Dragon, although
all are invited to participate. My use of sorta,
my use of twelve, these are an Easter Egg.
A subtle something nobody will probably realize;
an offer of an olive branch.
My hopes were people would be delighted to learn
of a deliberate word trick and enjoy this more.
Seems something what Mr. McGuire said recently,
"What I hate...."
this seems a general rule of thumb these days,
here and everywhere.
My intent is good, adding a surprise like this
is an age old custom to bring delight. Seems
all this brought, is something Mr. McGuire has
stated.
I am sorry some of you missed this and responded
in a less than pleasant manner. This was not my
intent, at all.
Godzilla!
------------------------------
Date: 31 May 2000 09:58:51 GMT
From: nj_kanda@alcor.concordia.ca (Neil Kandalgaonkar)
Subject: Re: Regex prime numbers (Was Re: seeking method to encode email addresses in web page forms)
Message-Id: <8h2nor$gju$1@newsflash.concordia.ca>
>On Sat, 27 May 2000, Gwyn Judd wrote:
>
>Do you mean this one?
>
>perl -wle '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_ ++'
We were tossing around obfuscated perl in the last Montreal Perl
Mongers (Missionaires Perl). By coincidence, I sprung this
Abigalism on the group.
Since I was requested for an explanation I posted one a few days
later. Abigail has not seen it, if there are any errors please
notify me.
<http://montreal.pm.org/technique/neil_kandalgaonkar.html>
I am not responsible for the "by Neil Kandalgaonkar" part, it
looks like I had something more to do with it than explaining it.
--
Neil Kandalgaonkar
neil@brevity.org
------------------------------
Date: 31 May 2000 07:27:49 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: runtime errors - Q how to do this
Message-Id: <8h2bd5$h7i$1@orpheus.gellyfish.com>
On 29 May 2000 17:52:01 GMT Dick Nickalls dicknickallscompuservecom wrote:
> Q How can I trap runtime errors in PERL without using
> eval() ??
> I want to be able to pick up the $! errormessage,
> but using something like the usual BASIC method as follows:
>
> ON ERROR gosub errorhandler
> ..
> ..
> SUB errorhandler
> $error = $!
> print <outputfile> "runtime error: ", $error
> RETURN
>
> So, what is the equivalent in PERL???
>
There isnt an equivalent in Perl - one uses eval. You can infact do
something like :
sub handler
{
print @_,"\n";
}
$SIG{__WARN__} = \&handler;
open (FOO,'/etc/shadow') || warn $!;
print "This continues\n";
Though I dont see many people using this kind of thing in favour of the
eval().
/J\
--
Yeah, you know, boys, a nuclear reactor is a lot like a woman. You just
have to read the manual and press the right buttons.
--
fortune oscar homer
------------------------------
Date: Wed, 31 May 2000 04:58:32 GMT
From: "Dave Winfred" <nospam@no.spam>
Subject: Re: Secure (enough) dayta encryption and decryption
Message-Id: <YZ0Z4.3135$MY6.67157@newsread2.prod.itd.earthlink.net>
Luis E. Rodriguez wrote in message ...
>
>I am looking for a reasonably secure way to store encrytped data so
that it
>can be decrytped back to its original form when needed. The data to be
>encrypted will be credit card numbers.
HAHAHAHAAAAAA!!! ROTFLMAO!!!
Nothing personal, but that's hilarious. Encrypted data that your can't
decode isn't of any value...except in tales from the crypt.
>Is there any Perl script or module or whatever that can do this job? I
know
>there is a "crypt" function in Perl but it only works one way. I use
it for
>password authentication but is not quite what I need to store credit
card
>numbers securely.
PGP is the most common encryption method and widely available. There are
some modules in CPAN that do the GNU PGP implementation. There are also
modules that use other encryption methods. However, PGP is your best
choice if you plan to move the encrypted data off the server -
especially if the server and the other machine are not the same
platform; for example, a DEC ALPHA server and a Win9x platform as the
other machine. The reason for this is that PGP is available for many
platforms. Other encryption methods are not as widely supported on
multiple platforms.
You can also get source code for PGP and compile if for your server, and
other machines that decrypt server data. Just pipe the data to/from the
PGP executable from Perl depending on whether you're encoding or
decoding.
DW
------------------------------
Date: Wed, 31 May 2000 07:16:40 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Secure (enough) dayta encryption and decryption
Message-Id: <MPG.139f597dffedec039896f8@news>
Dave Winfred writes ..
>Luis E. Rodriguez wrote in message ...
>>I am looking for a reasonably secure way to store encrytped data so
>>that it can be decrytped back to its original form when needed. The
>>data to be encrypted will be credit card numbers.
>
>HAHAHAHAAAAAA!!! ROTFLMAO!!!
>
>Nothing personal, but that's hilarious. Encrypted data that your can't
>decode isn't of any value...except in tales from the crypt.
oh how wrong you are .. credit card numbers are a perfect example of
where a one-way encryption algorithm is useful
as are passwords .. think about it for a minute or two and you should
trip over how one-way encryption is used .. it's fairly obvious
>PGP is the most common encryption method and widely available.
ahh .. it's becoming clearer now .. "the most common" ? .. care to site
references ?
>However, PGP is your best
>choice if you plan to move the encrypted data off the server -
>especially if the server and the other machine are not the same
>platform; for example, a DEC ALPHA server and a Win9x platform as the
>other machine. The reason for this is that PGP is available for many
>platforms. Other encryption methods are not as widely supported on
>multiple platforms.
indeed !! .. get back inside - you fountain of misinformation .. I'd
love to know these platform specific encryption methods of which you
spout ?
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Wed, 31 May 2000 07:22:21 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: Secure (enough) dayta encryption and decryption
Message-Id: <MPG.139f5ace9a14e2139896f9@news>
Luis E. Rodriguez writes ..
>I am looking for a reasonably secure way to store encrytped data so that it
>can be decrytped back to its original form when needed. The data to be
>encrypted will be credit card numbers.
you're much better off asking this question elsewhere .. as the one
response that I can see so far demonstrates -> this is the wrong
newsgroup entirely to seek advice on encryption methods
(but hint: 90% of credit card number encryption for the purpose of
storing the numbers should be done using one-way algorithms)
>Is there any Perl script or module or whatever that can do this job? I know
>there is a "crypt" function in Perl but it only works one way. I use it for
>password authentication but is not quite what I need to store credit card
>numbers securely.
if you really do need a two-way algorithm - once you've worked out what
encryption algorithm you want to use go to CPAN (www.cpan.org) and
search for the algorithm name in the modules list .. most common
algorithms have excellent modules with simple interfaces
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: 31 May 2000 10:01:59 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: select() function does not work
Message-Id: <8h2nun$kjo$1@pegasus.csx.cam.ac.uk>
Andreas Birkholz <A.Birkholz@alcatel.de> wrote:
>I tried the select function and it worked not in that way as described
>in the perldoc.
>
>Referring to perldoc the select function should set the process to
>status "sleeping" but if I look it up with "top" then this script
>occupies nearly all cpu time (about 97%). That's wrong, isn't it?
On UNIX, a disc file is always "available for reading" even if what is
available is an EOF or other error, so select isn't useful here.
Mike Guy
------------------------------
Date: Wed, 31 May 2000 07:05:00 GMT
From: elephant@squirrelgroup.com (jason)
Subject: Re: system using parameters with spaces
Message-Id: <MPG.139f56bd332855c99896f7@news>
Chuck May writes ..
>I am trying to use a system call, but one of my parameters has a space in
>it. Here is what I cam doing:
>
># run the java command to check user
>@args = ("program", $port, $db, $user, $password, $rpt, $search);
>system(@args) == 0 or print "program failed: $?";
>
>The $rpt and $system variables contain spaces, and when the program gets
>the arguement, they are parsed out into multiple arguements. I've tried
>using single or double quotes to surround the argument, but it doesn't
>help. Does anyone know if this can be done? Otherwise the only thing I
>can think of is to replace the spaces with some special character and
>convert it back on the other side.
as someone else wrote in another very similar thread - what would you
write in the shell ?
system() essentially just passes what you've got to the shell for
execution
if the quotes don't work in the shell .. then they're not going to work
in a system() command .. so drop to your shell .. write the command out
so it works .. copy and paste what you wrote into the system() call and
surround it with the q() operator
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: Wed, 31 May 2000 07:37:52 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: Translate foreign characters to English
Message-Id: <3934b418.223940710@news.nikoma.de>
On Tue, 30 May 2000 10:38:08 -0700, Larry Rosler <lr@hpl.hp.com> wrote:
> A better tip: use translation instead of substitution.
>
> $ascii =~ tr/ÁÂÀ...ä/a/;
Even better idea. Thanks, Larry.
This leaves you with substitution only for cases such as s/ß/ss/g; ,
where one letter turns into two.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: 30 May 2000 19:01:29 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Visual Studio Integration
Message-Id: <8h0vlp$o8a$1@orpheus.gellyfish.com>
On Thu, 25 May 2000 01:04:46 -0700 Justin wrote:
>
> Also, on a completely unrelated thought(and irrelevant for that matter)-
> does anyone know what is up with activestate's new communist-web-theme? :)
>
I cant comment on this because all I get right now is :
[gellyfish@orpheus radius]$ telnet www.activestate.com 80
GET /
Trying 199.60.48.64...
Connected to www.activestate.com.
Escape character is '^]'.
<HEAD><TITLE>Connection refused</TITLE></HEAD>
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Connection refused</H1><HR>
<FONT FACE="Helvetica,Arial"><B>
Description: Connection refused</B></FONT>
<HR>
<!-- default "Connection refused" response (502) -->
</BODY>
Connection closed by foreign host.
There had better be a good explanation ...
/J\
--
Relax. What is mind? No matter. What is matter? Never mind!
--
fortune oscar homer
------------------------------
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 3217
**************************************