[16511] in Perl-Users-Digest
Perl-Users Digest, Issue: 3923 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 5 14:05:29 2000
Date: Sat, 5 Aug 2000 11:05:11 -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: <965498711-v9-i3923@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 5 Aug 2000 Volume: 9 Number: 3923
Today's topics:
ActivePerl and MS Access 2000 <jc_lorente@maptel.es>
Re: any ideas? (Clinton A. Pierce)
Apache virtualhosts with Perl module? <kaare@netcetera.dk>
Re: bitwise and decimal number... <bart.lateur@skynet.be>
Re: Confused (date question) (Keith Calvert Ivey)
Re: Cookie on the server side (David Efflandt)
Re: date manipulation (Keith Calvert Ivey)
Re: Difference between a .cgi file and a .pl file? (Abigail)
Re: Dreaded 500 message <kokuryu2@hotmail.com>
Re: file upload using perl (Abigail)
IP spoofing <nospam.tom@hotmail.com>
Learning Perl, 2nd Ed. Exercises. How can I do them on <tabs_paradise@yahoo.com>
Re: Learning Perl, 2nd Ed. Exercises. How can I do them <bean@agentkhaki.com>
looking for a certain bot <gary@rns1.earthlink.net>
Re: OT: "cute languages" Was: Gee, thanks for all the h (Abigail)
Re: OT: "cute languages" Was: Gee, thanks for all the h (Tim Hammerquist)
Re: passing spaces in URL <mragsdal@utk.edu>
Re: passing spaces in URL jthornton@my-deja.com
Re: reg expressions - protect html <indiziert@unabomber.de>
Re: reg expressions - protect html <callgirl@la.znet.com>
Regexp trouble <moliate@yahoo.se>
Someone please explain the 'my' declaration. <jaford@watford53.freeserve.co.uk>
Re: Someone please explain the 'my' declaration. ()
Tag attributes <beaumontsystems@netscapeonline.co.uk>
Re: Tag attributes <indiziert@unabomber.de>
Re: Tag attributes <tony_curtis32@yahoo.com>
Re: Tag attributes <callgirl@la.znet.com>
THANK YOU, one and all! (David)
Until this or that <six4eight@BLADIEBLAhotmail.com>
Re: Until this or that <tina@streetmail.com>
Win32::OLE and MS Excel Problem <mikelm@ameritech.net>
Re: WWWBoard.PL <bart.lateur@skynet.be>
Re: WWWBoard.PL <flavell@mail.cern.ch>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 5 Aug 2000 16:06:27 +0200
From: "Juan Carlos Lorente" <jc_lorente@maptel.es>
Subject: ActivePerl and MS Access 2000
Message-Id: <8mh6ne$2hu$1@talia.mad.ttd.net>
Hello,
I write a mini-application that uses a MS-Access DB via ODBC. When I update
or delete a record in the DB the DB is updated but the S.O. (W2000) return
an invalid access error and don't show the script output.
Do you have any idea about the problem?
JC
------------------------------
Date: Sat, 05 Aug 2000 15:16:27 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: any ideas?
Message-Id: <fdWi5.58726$fR2.595899@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <8met5c$u8$1@nnrp1.deja.com>,
hamed53@my-deja.com writes:
> hey, thanks for the reply but when i visited your website to check out
> the demo of the script i came acroos this error:
> Software error:
> Can't call method "datestamp" on an undefined value at
> /web/geeksalad/cgi-bin/icons/FooBBS.pl line 76.
This is what I get for keeping my test data in /tmp ! :)
Repaired.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours!
clintp@geeksalad.org for details see http://www.geeksalad.org
"If you rush a Miracle Man,
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Sat, 5 Aug 2000 16:32:28 +0200
From: Kaare Brandt Petersen <kaare@netcetera.dk>
Subject: Apache virtualhosts with Perl module?
Message-Id: <Pine.LNX.4.21.0008051624380.4277-100000@nidhug.netcetera.dk>
Hi there!
I would like to administer my webhosting on an Apache server through a SQL
database and perl, i.e. having all the virtualhosts in some database and
using Perl to incoorperate them into the httpd.conf.
I am probably not the first one to get that idear, but I cant find a
module for it on search.cpan.org ... am I missing something?
Does there exist a module to do that?
- kaare
______________________________________
Kaare Brandt Petersen
Netcetera tlf. 33147000
www.netcetera.dk mobil 28409998
------------------------------
Date: Sat, 05 Aug 2000 15:03:35 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: bitwise and decimal number...
Message-Id: <p2boosos9mkts9d38a8lgnc02l3kaeo9om@4ax.com>
JMarsan wrote:
>
>I tried your solution and instead of printing 3, which is the decimal
>value of $c that contains 11000000, it prints 192.
>
>I am missing something here?
Yes: bit order. 'b8' instead of 'B8' will fix that.
--
Bart.
------------------------------
Date: Sat, 05 Aug 2000 13:28:15 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: Confused (date question)
Message-Id: <3998157a.44976455@news.newsguy.com>
"martin" <none@yet.com> wrote:
>use Time::Local;
>eval
>
> $month = $month - 1;
> $year = int($year) - 1900;
> $timedate = timelocal(0, 0, 0, $day, $month, $year);
>};
>if ($@) { return undef; }
>return ($timedate);
>
>So I guess year 100 = 2000 and month 0 = januari.
>
>When I want to check e.g. 32-01-2000 in my html-form it returns "bad date"
>like it should
>but, when I check 31-02-2000 or 31-11-2000 is accepts these dates!!
You seem to be missing an opening brace after "eval", as Decklin
Foster has pointed out. The problem with using timelocal() to
check dates is that it doesn't care about days past the end of a
month -- just days over 31. It happily treats February 31 as
March 2 (this year) and November 31 as December 1, so you don't
get any error to trap in $@.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: Sat, 5 Aug 2000 18:00:48 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Cookie on the server side
Message-Id: <slrn8ooli4.pjm.efflandt@efflandt.xnet.com>
On Fri, 4 Aug 2000 23:37:21 +0200, Ed <bestwebmoney@themail.com> wrote:
>I am looking for a tutorial on how to write and use the cookies on the
>server side (login retrieve and add info etc) or a script that does this so
>I can learn it by examining the data(I have looked at cgi-resources but
>couldn't find it)
perldoc CGI
The CGI module (included with Perl 5) can set and read cookies and I heard
there is another module that does only that. However, if you are looking
for some non-CGI server side method to do something with cookies, you need
to consult your webserver docs or another newsgroup. In fact even for CGI
methods you should consult the *.authoring.cgi newsgroup if not Perl
specific.
--
David Efflandt efflandt@xnet.com http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://hammer.prohosting.com/~cgi-wiz/ http://cgi-help.virtualave.net/
------------------------------
Date: Sat, 05 Aug 2000 13:10:32 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: date manipulation
Message-Id: <3997115b.43920573@news.newsguy.com>
Larry Rosler <lr@hpl.hp.com> wrote:
>Following your sequence of steps, I would find this in perlfaq4: "How do
>I find yesterday's date?". It isn't hard to relate that to the original
>question: "I was wondering if there is a tried and tested way of
>calculating dates (day/month/year) in the future from a given date."
I'm still using 5.005_03 (ActiveState build 522), and my copy of
perlfaq4 has an answer for that question that doesn't take
daylight-savings time into account. I'm assuming since you're
recommending it that the answer has been revised for Perl 5.6
(though Bart Lateur's answer in this thread has the same
problem). Unfortunately, the question is missing from
http://www.perl.com/pub/doc/manual/html/pod/perlfaq4.html
which I had thought was a copy of the Perl 5.6 documentation.
I guess I ought to install 5.6.
--
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC
------------------------------
Date: 05 Aug 2000 13:51:16 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Difference between a .cgi file and a .pl file?
Message-Id: <slrn8oo6u2.st1.abigail@alexandra.foad.org>
Max Lybbert (safado@pe.net) wrote on MMDXXXI September MCMXCIII in
<URL:news:398BE175.F825AB2@pe.net>:
== Abigail wrote:
==
==
== > (snip)
==
== > IMO, a more reasonable approach to decide whether something is a CGI
== > program or a static document is to look at the execution bit. If set,
== > it's a program, else, it's a static document. But apparently, some idiots
== > decided that the execution bit was a neat trick to decide whether a
== > document should go through an SSI interpreter.
==
== Actually, while it does identify the file as a perl program, I think the
== original idea was simply to tell the machine where to go to understand the
== coding. This allowed for updates to the perl language. It also allows
== bare-bones browsers to take advantage of the newest perl release, for
== instance.
Djee, that was done by browsers from the first day they allowed execution
of programs. Every other program out there doesn't care in what kind of
language, or version of the language an external program is written. It
just executes the file, and it works perfectly.
Why your browser has taken some gigantic leaps back in time, I dunno.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Sat, 05 Aug 2000 10:26:19 -0400
From: Kokuryu <kokuryu2@hotmail.com>
Subject: Re: Dreaded 500 message
Message-Id: <398C240B.D45C02D1@hotmail.com>
Well, it's a good thing I didnt bother posting any code up here -
because the code works just fine!
I found out that the Personal Web Server does not run Perl 5 at all
unless you are using version 4.0 or above, which is only available with
I believe Windows 2000. I couldnt find any updates on Microsoft's site
to update the versions that come with Win95 and Win98.
I got myself out of this problem by switching to the OmniHTTPd software
and just changed the directories to point to the already set up WEBSHARE
directories and my own cgi-bin and datadir directories, and then copied
the perlcrt.dll file from the windows system directory and put it into
the /perl/bin directory.
Guess what? It all worked perfectly from then on.
Next time, please read the message that someone posts rather than jump
to the conclusion that there is something wrong with the code.
Thanks,
--Dave
Tony Curtis wrote:
>
> >> On Fri, 04 Aug 2000 18:26:21 -0400,
> >> David Somner <dave@htxtech.com> said:
>
> > Hello! I am getting the 500 Server Error message. I am
>
> Show us your code! Can't help without seeing the code.
>
> You're not outputting the right headers, but we don't know
> what you *are* outputting, so it's impossible to go
> anywhere...
>
> > I can run perl from a command prompt and get the correct
> > output from the .CGI files When I run a .CGI file in a
> > web browser, I get the 500 Server Error message
>
> Obviously you're *not* getting the right output from the
> command-line. But again, noone but you knows what the
> output is.
>
> hth
> t
> --
> "With $10,000, we'd be millionaires!"
> Homer Simpson
------------------------------
Date: 05 Aug 2000 14:13:02 GMT
From: abigail@foad.org (Abigail)
Subject: Re: file upload using perl
Message-Id: <slrn8oo86s.st1.abigail@alexandra.foad.org>
Johannes Stark (starktdh@gmx.de) wrote on MMDXXXI September MCMXCIII in
<URL:news:8mgodq$oev$1@merlin.rembrandtstr.bocholt.de>:
~~ I'm using neither cgi.pm nor cgi-lib. My script should read posted files
~~ coming via multipart-fomdata. The 25kB test file has been received in every
~~ trial. But - randomly - only the first 1000 up to 14000 Byte.
~~ Has anyone an idea?
Sure. Start using CGI.pm.
Abigail
--
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");
------------------------------
Date: Sat, 5 Aug 2000 23:58:29 +0800
From: DT <nospam.tom@hotmail.com>
Subject: IP spoofing
Message-Id: <MPG.13f6ba7b21ac650b989687@news.newsguy.com>
Hi,
I want to use "Ip spoofing" to do mass submission to search engines. How
can I do that.
Thank
------------------------------
Date: Sat, 5 Aug 2000 17:17:39 +0100
From: "Gonçalo" <tabs_paradise@yahoo.com>
Subject: Learning Perl, 2nd Ed. Exercises. How can I do them on win98?
Message-Id: <398c3e5c$1@212.18.160.197>
Hello.
I have bought the book Learning Perl by Oreilly, and it is great.
But, I have a major problem. At the end of each chapter there are some
exercises. Well, how can I do them with win98? I did a file called
exercise.pl and run it on apache trough a string like this
http://localhost/cgi-bin/exercise.pl but I got the 500 error.
Can you help me with this?
Thanks in advance.
------------------------------
Date: 05 Aug 2000 16:31:17 GMT
From: bean <bean@agentkhaki.com>
Subject: Re: Learning Perl, 2nd Ed. Exercises. How can I do them on win98?
Message-Id: <MPG.13f6091916fdc18f989690@news.concentric.net>
> exercises. Well, how can I do them with win98? I did a file called
> exercise.pl and run it on apache trough a string like this
Go to http://www.perl.com and click the link on the left side that says
"Is there a Windows version of Perl?" And then to "...our Downloads
section" and... ah screw it. Go here:
http://www.activestate.com/ActivePerl/
It's pretty self explanatory. Once you've got that downloaded and
installed, you can run perl scripts from the DOS prompt by typing
perl -w yourscripthere.pl
^
The w gives you warnings if you do dumb things.
> http://localhost/cgi-bin/exercise.pl but I got the 500 error.
Yeah, Apache was a pain to configure for Win32. I use Omnihttpd for
testing CGI if that's what you're doing. Get it at
http://www.omnicron.ab.ca
bean
------------------------------
Date: Sat, 05 Aug 2000 15:18:28 GMT
From: Gary Krupa <gary@rns1.earthlink.net>
Subject: looking for a certain bot
Message-Id: <Pine.LNX.4.21.0008050812150.410-100000@rns1.earthlink.net>
Does anyone know where I can find a bot program that'll extract an
e-mail address from a website, given search parameters? For example, I wish
to have a list of e-mail addresses found on websites that feature
automobile dealers.
I'd be grateful for any help offered.
Sincerely,
Gary Krupa
------------------------------
Date: 05 Aug 2000 13:54:47 GMT
From: abigail@foad.org (Abigail)
Subject: Re: OT: "cute languages" Was: Gee, thanks for all the help
Message-Id: <slrn8oo74m.st1.abigail@alexandra.foad.org>
Tim Hammerquist (tim@degree.ath.cx) wrote on MMDXXXI September MCMXCIII
in <URL:news:slrn8ont5g.l4.tim@degree.ath.cx>:
!!
!! I respect Java. Really. The syntax, anyway. It's a very straightforward
!! language. Nothing is assumed. It has a certain symmetry that I like. Its
!! implementation bothers me, though. (ie, execution time is seriously
!! lacking) But the only thing in which Java really stands out is that
!! it's (AFAIK) the only modern pseudo-interpreted language that supports actual
!! data-hiding (private class- and object-properties). If I'm wrong,
!! please let me know; I'd like to scope it out.
Yes, you are wrong. LPC for instance does that too.
Abigail
--
split // => '"';
${"@_"} = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: Sat, 05 Aug 2000 16:33:35 GMT
From: tim@degree.ath.cx (Tim Hammerquist)
Subject: Re: OT: "cute languages" Was: Gee, thanks for all the help
Message-Id: <slrn8ooh1i.4id.tim@degree.ath.cx>
On 05 Aug 2000 13:54:47 GMT, Abigail <abigail@foad.org> wrote:
> Tim Hammerquist (tim@degree.ath.cx) wrote on MMDXXXI September MCMXCIII
> in <URL:news:slrn8ont5g.l4.tim@degree.ath.cx>:
> !! But the only thing in which Java really stands out is that
> !! it's (AFAIK) the only modern pseudo-interpreted language that supports actual
> !! data-hiding (private class- and object-properties). If I'm wrong,
> !! please let me know; I'd like to scope it out.
>
> Yes, you are wrong. LPC for instance does that too.
Thanks. Is there a page where I can research this?
--
-Tim Hammerquist <timmy@cpan.org>
Diplomacy -- the art of saying "Nice doggie"
'til you can find a stick.
-- Wynn Catlin
------------------------------
Date: Sat, 05 Aug 2000 10:49:17 -0400
From: Michael Ragsdale <mragsdal@utk.edu>
Subject: Re: passing spaces in URL
Message-Id: <398C296C.F24B1984@utk.edu>
That's fine and dandy when the value of $x is declared in
the script, but what about when $x is being filled by
$q->param() or from a DBI call?
I think I'll try the URI::Escape module that Tony Curtis
mentioned and see what I can do with that. Thanks for the
help guys.
-Mike
jthornton@my-deja.com wrote:
>
> Why don't you just code your values with the seperator.
>
> Instead of: my $x = 'I need help';
> do: my $x = 'I%20need%20help';
> or even better: my $x = 'I+need+help';
>
> -James
>
> In article <398B63ED.5387C72B@utk.edu>,
> mragsdal@utk.edu wrote:
> > Up until this point, I've called all of my scripts when the
> > user clicks on the $q->submit(); button using the POST
> > method. Now I'd like to call one when the user simply
> > clicks on a href link. I figure I have two possible ways to
> > do that, but not sure about either:
> >
> > 1. Stick with the POST method (I prefer passing named
> > parameters) and somehow make the href link execute the form
> > submit command. I tried to find information on this and
> > found that href has an -OnClick() attribute, but it calls
> > JavaScript, not CGI. If I went this route, how do I make
> > the href link execute the form submit?
> >
> > 2. Use the GET method and simply put my parameter pairs in
> > the URL of the href link. I tried this and had a problem.
> > Some of my parameter strings have spaces and if they were
> > not the last parameter passed, they lost all characters
> > after the first space. I've seen URLs passed with some
> > character string, perhaps %20, that represents a space
> > before, but I've searched and searched and cannot find any
> > information on replacing the spaces with this character
> > string before I put the complete string in the URL. In
> > other words, how do I make this:
> >
> > my $x = 'I need help';
> > print $q->a({href=>"/this/that?something=$x"},"Test");
> >
> > comes out like:
> > <a href="/this/that?something=I%20need%20help>Test</a>
> >
> > instead of:
> > <a href="/this/that?something=I need help>Test</a>
> >
> > Again, I'd prefer to stick with the POST method, if there is
> > any way to do that.
> >
> > -Mike
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Sat, 05 Aug 2000 17:45:18 GMT
From: jthornton@my-deja.com
Subject: Re: passing spaces in URL
Message-Id: <8mhjrd$r6q$1@nnrp1.deja.com>
...just making sure you weren't neglecting the obvious ;-).
In article <398C296C.F24B1984@utk.edu>,
mragsdal@utk.edu wrote:
> That's fine and dandy when the value of $x is declared in
> the script, but what about when $x is being filled by
> $q->param() or from a DBI call?
>
> I think I'll try the URI::Escape module that Tony Curtis
> mentioned and see what I can do with that. Thanks for the
> help guys.
>
> -Mike
>
> jthornton@my-deja.com wrote:
> >
> > Why don't you just code your values with the seperator.
> >
> > Instead of: my $x = 'I need help';
> > do: my $x = 'I%20need%20help';
> > or even better: my $x = 'I+need+help';
> >
> > -James
> >
> > In article <398B63ED.5387C72B@utk.edu>,
> > mragsdal@utk.edu wrote:
> > > Up until this point, I've called all of my scripts when the
> > > user clicks on the $q->submit(); button using the POST
> > > method. Now I'd like to call one when the user simply
> > > clicks on a href link. I figure I have two possible ways to
> > > do that, but not sure about either:
> > >
> > > 1. Stick with the POST method (I prefer passing named
> > > parameters) and somehow make the href link execute the form
> > > submit command. I tried to find information on this and
> > > found that href has an -OnClick() attribute, but it calls
> > > JavaScript, not CGI. If I went this route, how do I make
> > > the href link execute the form submit?
> > >
> > > 2. Use the GET method and simply put my parameter pairs in
> > > the URL of the href link. I tried this and had a problem.
> > > Some of my parameter strings have spaces and if they were
> > > not the last parameter passed, they lost all characters
> > > after the first space. I've seen URLs passed with some
> > > character string, perhaps %20, that represents a space
> > > before, but I've searched and searched and cannot find any
> > > information on replacing the spaces with this character
> > > string before I put the complete string in the URL. In
> > > other words, how do I make this:
> > >
> > > my $x = 'I need help';
> > > print $q->a({href=>"/this/that?something=$x"},"Test");
> > >
> > > comes out like:
> > > <a href="/this/that?something=I%20need%20help>Test</a>
> > >
> > > instead of:
> > > <a href="/this/that?something=I need help>Test</a>
> > >
> > > Again, I'd prefer to stick with the POST method, if there is
> > > any way to do that.
> > >
> > > -Mike
> > >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 05 Aug 2000 18:13:06 +0200
From: indiziert <indiziert@unabomber.de>
Subject: Re: reg expressions - protect html
Message-Id: <398C3D11.4F140488@unabomber.de>
yeah
ok my script goes like this
# marks unfinished code or code which i am not able to deal with
here it goes:
1. get data input (from a form)
#2. check if file is kind of .txt or .html
#3. if html protect html code from being parsed
4. parse all the text and replace characters
(5. if not html do 4.)
6. print parsed file in a new html document
Godzilla:
could you please modify the script that i can make a selection from a for=
m,
which file i want to parse. i couldn=B4t get to it by myself.
if you like i can mail you my alpha script so you can check it out
thank in advance & 4 your time
indiziert
------------------------------
Date: Sat, 05 Aug 2000 09:52:08 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: reg expressions - protect html
Message-Id: <398C4638.418A5EB2@la.znet.com>
indiziert wrote:
(snippage)
> ok my script goes like this
My Corvette Mako Sharks go like this:
ZZZOOOOOOMMMMmmmmmmmm.....
> # marks unfinished code or code which i am not
> able to deal with here it goes:
> #2. check if file is kind of .txt or .html
Why does your program not know what type of
file it is opening? You are providing a file
path / file name for your program, right? If
a .txt reference is provided, it is a text file.
Similar logic for an html file. For what you
want to do, doesn't matter which file type.
Nonetheless, if your file input reference ends
with .txt, run your text parse routine. If a
file ends with .htm then run your html protect
routine. Not so difficult if you think a bit.
> #3. if html protect html code from being parsed
Two methods have been provided. I wrote a barebones
script for a beginning. Another suggested copy and
paste a module reference.
There are other techniques such as indexing your
input for html tags, saving index references,
remove and save your html, manipulate your data
then replace your html by substring using your
saved index references. Similar but backwards,
substring out text boundried by html, change it,
then toss it back in. Yet another method would
be to grab your html, push it into an array,
after replacing html position with a symbol.
Later, march back through your html array
replacing your symbols in your data text,
in numerical sequence. Lots of ways to do
this, lots and lots. Only one method requires
use of a module.
> 4. parse all the text and replace characters
> (5. if not html do 4.)
Method principles I wrote for you will do
either a plaintext file or an html file.
However, I suspect you will discover some
bugs if you try to parse a binary file.
> could you please modify the script that i can make
> a selection from a form,
Research and study Brenner's read and parse routine,
his cgi-lib libraries and especially cgi.pm for use
with Perl 5. Extensive documentation for these can
found literally everywhere on our net. I would remiss
to not insist you learn how to use form actions and
form action input parsing methods.
> which file i want to parse. i couldn´t get to it by myself.
Simple matter of providing a file path / file name.
* scratches noggin *
> if you like i can mail you my alpha script so you
> can check it out
I don't do email requests. Actually, I don't do any
email from a newsgroup. It is deleted unread.
Why not invest some time and effort into this? After
you have made a very reasonable effort at attaining
resolution and, still have some problems, return here
and post code snippets for which you need help. There
are some people here willing to help you, after you
have demonstrated you have invested time and effort.
I've yet to learn of an example of learning causing
a person harm.
Godzilla!
------------------------------
Date: Thu, 03 Aug 2000 16:32:13 +0200
From: Henrik Springfors <moliate@yahoo.se>
Subject: Regexp trouble
Message-Id: <3989826D.28F2B57C@yahoo.se>
I would like to remove all inane HTML-tags in a document - that's all
tags
that don't affect any text. For example:
<B> <CENTER> </B>
should return:
<CENTER>
but
<B> hello world <CENTER> </B>
should remain unaffected.
I've come up with the following code, where the back-reference $1 seems
to be wrong (suppose back-references can't be made inside an
expression?) :
1: while(<>)
2: {$html .= $_;}
3:
4: $html =~ s/<(\w)+>(\s*<\/?[\w]+>\s*)*(<\/$1>)/$2/gis;
5: print $html;
I'm rather new to perl and RE, so any suggestions would be appreciated.
thanks
/Henrik
------------------------------
Date: Sat, 05 Aug 2000 15:40:46 +0100
From: Jim Ford <jaford@watford53.freeserve.co.uk>
Subject: Someone please explain the 'my' declaration.
Message-Id: <398C276E.8D6BF55C@watford53.freeserve.co.uk>
I've been using Perl for a few months now and am pleased with the way I
can get quick (and dirtyish) results. One of the problems that's bugging
me is the use of the 'my' declaration, which the 'Camel' book and the
perldocs tell me 'lexically scopes' the variable. I'm not very clear on
what this means and would be grateful if somebody could explain it more
clearly, please!
Regards: Jim Ford
------------------------------
Date: Sat, 05 Aug 2000 14:50:55 GMT
From: sjs@yorku.ca ()
Subject: Re: Someone please explain the 'my' declaration.
Message-Id: <slrn8ooadj.cf7.sjs@john.sympatico.ca>
Jim Ford <jaford@watford53.freeserve.co.uk> wrote:
>I've been using Perl for a few months now and am pleased with the way I
>can get quick (and dirtyish) results. One of the problems that's bugging
>me is the use of the 'my' declaration, which the 'Camel' book and the
>perldocs tell me 'lexically scopes' the variable. I'm not very clear on
>what this means and would be grateful if somebody could explain it more
>clearly, please!
Have you read the explanation in perlfaq7? It seems pretty clear to me.
perldoc -q lexical will find it.
Steve
------------------------------
Date: Sat, 5 Aug 2000 17:41:39 +0100
From: "beaumontsystems" <beaumontsystems@netscapeonline.co.uk>
Subject: Tag attributes
Message-Id: <398c354c_1@plato.netscapeonline.co.uk>
Say I have an HTML-like tag of the form...
<aaa bbb="XyZ" Cc=3>qWerty</aaa>
I'm trying to write a small (Perl) routine which converts:
1. The tag types (aaa) to upper (or lower) case.
2. The attribute types (bbb, Cc) to upper (or lower) case
I've achieved 1, but not 2. Can anyone help ?
(The solution must not change tag values or data in between tags).
Thanks! (...in advance).
------------------------------
Date: Sat, 05 Aug 2000 18:42:16 +0200
From: indiziert <indiziert@unabomber.de>
Subject: Re: Tag attributes
Message-Id: <398C43E7.63C94F88@unabomber.de>
beaumontsystems schrieb:
> Say I have an HTML-like tag of the form...
> <aaa bbb="XyZ" Cc=3>qWerty</aaa>
> I'm trying to write a small (Perl) routine which converts:
> 1. The tag types (aaa) to upper (or lower) case.
> 2. The attribute types (bbb, Cc) to upper (or lower) case
> I've achieved 1, but not 2. Can anyone help ?
> (The solution must not change tag values or data in between tags).
>
> Thanks! (...in advance).
hi
could you tell me how you made upper (lower) case tags ?
thanx in advance
indiziert
------------------------------
Date: 05 Aug 2000 11:53:04 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Tag attributes
Message-Id: <87punnzm33.fsf@limey.hpcc.uh.edu>
>> On Sat, 5 Aug 2000 17:41:39 +0100,
>> "beaumontsystems" <beaumontsystems@netscapeonline.co.uk> said:
> Say I have an HTML-like tag of the form... <aaa
> bbb="XyZ" Cc=3>qWerty</aaa> I'm trying to write a small
> (Perl) routine which converts: 1. The tag types (aaa) to
> upper (or lower) case. 2. The attribute types (bbb, Cc)
> to upper (or lower) case I've achieved 1, but not 2. Can
> anyone help ? (The solution must not change tag values
> or data in between tags).
Check the thread in this group about stripping HTML tags
from documents. It's pretty much the same parsing
problem, and has the same solution (viz. an HTML parser
module).
hth
t
--
"With $10,000, we'd be millionaires!"
Homer Simpson
------------------------------
Date: Sat, 05 Aug 2000 10:34:28 -0700
From: "Godzilla!" <callgirl@la.znet.com>
Subject: Re: Tag attributes
Message-Id: <398C5024.4C89831D@la.znet.com>
beaumontsystems wrote:
Tell ya, co.uk is becoming as popular as
hotmail, deja and bigfoot.
> Say I have an HTML-like tag of the form...
> <aaa bbb="XyZ" Cc=3>qWerty</aaa>
> I'm trying to write a small (Perl) routine which converts:
> 1. The tag types (aaa) to upper (or lower) case.
> 2. The attribute types (bbb, Cc) to upper (or lower) case
> I've achieved 1, but not 2. Can anyone help ?
Why? A browser doesn't care if html tags are
upper case or lower case or mixed. Only counts
in an URL path and perhaps a few other very
specific tag types. Why fix it if it ain't broke?
> (The solution must not change tag values or data in between tags).
Why would a programmer write a script which modifies
input data to something it shouldn't be? Programming in
deliberate errors is not a usual standard in practice.
There are many here who act stupid at times, myself
included, but there are very few here stupid enough
to do something like this.
Godzilla!
------------------------------
Date: Sat, 05 Aug 2000 16:00:59 GMT
From: brooksd@interlog.com (David)
Subject: THANK YOU, one and all!
Message-Id: <wKWi5.8492$Lg1.149586@cac1.rdr.news.psi.ca>
Hello, all: Just a brief note to thank everyone who wrote to me with
suggestions as to how to amend my perl coding on my search results page in
order for a graphic to appear.
In the end, none of the suggestions worked, but I'm sure it's because the
overall coding of the page is so cannibalized and weak that really everything
should be redone.
In the end, I took the wimp's way out. I set up my search page within a
frame--graphic in top frame, search boxes in bottom. When the results appear
(still without a graphic) it doesn't matter because the top frame graphic is
still up there. Pretty much the same result.
I noted some guy posting a note saying "Thanks for NOTHING :-( " or
something like that. I don't know what he's talking about because you guys
were great to take the time and trouble out of your day to send along your
advice.
Very much appreciated! If you ever need some Van Gogh research done (you
never know), then let me know!
All the best,
David Brooks
Toronto, Canada
http://www.vangoghgallery.com
------------------------------
Date: Sat, 05 Aug 2000 14:42:34 GMT
From: "Eelke Kleijn" <six4eight@BLADIEBLAhotmail.com>
Subject: Until this or that
Message-Id: <uJVi5.9029$Gd1.76998@Typhoon.bART.nl>
I have the following line in a script of mine:
until ((my $line = <Socket_Handle>) =~ /<%!/) {}
I want to be able to filter on both <%! and <HTML>
How can I say 'stop on this OR that' ??
I came up with the following, but it doesn't work, Perl hangs on it:
until ((my $line = <Socket_Handle>) =~ /<%!/ || <HTML>) {}
Does anyone have a suggestion?
Thanks in advance
Eelke Kleijn
------------------------------
Date: 5 Aug 2000 15:07:44 GMT
From: Tina Mueller <tina@streetmail.com>
Subject: Re: Until this or that
Message-Id: <8mhajv$6fe1v$2@ID-24002.news.cis.dfn.de>
hi,
Eelke Kleijn <six4eight@bladieblahotmail.com> wrote:
> I have the following line in a script of mine:
> until ((my $line = <Socket_Handle>) =~ /<%!/) {}
> I want to be able to filter on both <%! and <HTML>
> How can I say 'stop on this OR that' ??
> I came up with the following, but it doesn't work, Perl hangs on it:
> until ((my $line = <Socket_Handle>) =~ /<%!/ || <HTML>) {}
close to it:
until ((my $line = <Socket_Handle>) =~ /<%!|<HTML>/) {}
should work.
read perldoc perlre
if you have two conditions you also can say
until (($x > $y) || ($t == $z)) {}
tina
--
http://tinita.de \ enter__| |__the___ _ _ ___
tina's moviedatabase \ / _` / _ \/ _ \ '_(_-< of
search & add comments \ \ _,_\ __/\ __/_| /__/ perception
please no answers via email unless followup is set to poster.
------------------------------
Date: Sat, 5 Aug 2000 10:57:31 -0500
From: "The Ancient" <mikelm@ameritech.net>
Subject: Win32::OLE and MS Excel Problem
Message-Id: <FNWi5.43$_x3.20637@nntp0.chicago.il.ameritech.net>
I need to sort columns in Microsoft Excel using Win32::OLE
Perl compiles the code OK but Excel throws this exception:
OLE exception from "Microsoft Excel":
Unable to get the Sort property of the Range class
Win32::OLE(0.13) error 0x80020009: "Exception occurred"
in METHOD/PROPERTYGET "Sort" at xl.pl line 43
Why does Excel view "Sort" as a property and not a method?
The code below shows how I setup the worksheet and does
work until the sort is executed.
#!perl -w
use Win32::OLE;
use Win32::OLE::Const 'Microsoft Excel';
use strict;
$ex = Win32::OLE->new('Excel.Application', 'Quit')
or die "Cannot start Excel";
$book = $ex->Workbooks->Open("d:\\vb\\test_perl_xl.xls");
$sheet = $book->Worksheets(1);
#clear two columns of the sheet
$sheet->columns("A:B")->Select;
$ex->Selection->Clear;
#insert something
$sheet->Range("A3:B5")->{Value} = [[ 'stuff', 'Xyzzy' ],
[ 42, 'Perl' ]
['more', 'stuff'];
#size the columns to fit the values inserted
$sheet->Columns("A:B")->AutoFit;
#try the sort - This is broken. Can someone offer a hint,
# solution or resource where I can look this stuff up? I am
# kind of stumbling around with this.
#BTW this method works in a VB macro
$sheet->Range("B3")->Sort ({ Key1 => $sheet->Range("B3"),
Order1 => xlDescending,
Key2 => $sheet->Range("A3"),
Order2 => xlAscending
});
$book->Save();
undef $book;
undef $ex;
------------------------------
Date: Sat, 05 Aug 2000 14:59:30 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: WWWBoard.PL
Message-Id: <0naooss48hjlajsthd8510dcc5v7rb1dni@4ax.com>
Alan J. Flavell wrote:
>Where a file needs to be updated, the idea is to construct an updated
>version in a temporary file, and (when everything else has been made
>ready for it) do an atomic renaming of the temporary file in place of
>the old one. The principle is to only take the system through
>intermediate states that are valid from the point of view of the
>server. That way, there's no need to lock the system against being
>read.
There are two problems with that, one more or less Perl related, one
not.
Not Perl related: file caching. I've noticed that even after a HTML file
is subsituted with a new version, the browser may still see the old
version, even after you pressed "reload".
More Perl related: file permissions and ownership. If you don't take
care of file permissions, you'll end up with files that are owned by
"nobody" or "www", that you cannot manually remove through FTP or
telnet!
So: what's the quickest way to copy the old file permissions and
preferably file ownership from the old file to the new?
--
Bart.
------------------------------
Date: Sat, 5 Aug 2000 18:50:09 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: WWWBoard.PL
Message-Id: <Pine.GHP.4.21.0008051802050.5183-100000@hpplus03.cern.ch>
On Sat, 5 Aug 2000, Bart Lateur wrote:
> > The principle is to only take the system through
> >intermediate states that are valid from the point of view of the
> >server. That way, there's no need to lock the system against being
> >read.
>
> file caching. I've noticed that even after a HTML file
> is subsituted with a new version, the browser may still see the old
> version, even after you pressed "reload".
Right: but if you design it right, they still get a consistent view
(albeit a slightly out of date view). It means not updating the index
to include a new pointer until the resource represented by that
pointer is already complete and in-place; and not immediately removing
a deleted resource - just removing its entry in the page that points
to it, and marking the deleted resource itself to be removed later by
some garbage-collection procedure.
> More Perl related: file permissions and ownership. If you don't take
> care of file permissions, you'll end up with files that are owned by
> "nobody" or "www", that you cannot manually remove through FTP or
> telnet!
That's why typical bulletin board systems include administration
scripts, that are run under the same environment as the b.b itself.
Take the faq-o-matic, for example: its maintenance tasks (i.e periodic
tasks not directly associated with a browser-submitted request from a
user or from an administrator) are initiated by a crontask that can in
principle be kicked off by anyone (typically by the maintainer). But
they work by having the crontask issue an HTTP request to cause _CGI_
invocation of an admin script (using credentials to avoid unauthorised
usage), so the actual _work_ is done in the name of the same user as
runs the actual browser-submitted requests on that server.
So, I don't actually own the faqomatic data files that I'm
administrating on the server, and with my normal webadmin hat on I
can't do anything to them directly, but I don't normally need to (I'd
have to put on root's wizard hat if things were to go really
pear-shaped).
> So: what's the quickest way to copy the old file permissions and
> preferably file ownership from the old file to the new?
I'm pretty sure "you can't do that", not portably. It depends on the
OS, but some OSes don't allow anyone other than root to transfer file
ownership. But (with respect, excuse me) this seems to be straying
too far off-topic from Perl itself.
Vis-a-vis OS dependence, I think I have to admit that my reference to
atomically renaming a temporary file into the place of an existing old
file might not be feasible under some OSes? perldoc for rename at
least has some rather drastic cautions about whether it would work at
all, and little discussion of whether the operation would be atomic.
Still, a one-off reading error for one WWW user isn't a tragedy in
this kind of context, whereas permanently overwriting the entire
bulletin board (as can happen with some shambolic schemes of updating
via CGI) would be a real hassle.
cheers
------------------------------
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 3923
**************************************