[16512] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3924 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 5 18:05:27 2000

Date: Sat, 5 Aug 2000 15:05:09 -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: <965513109-v9-i3924@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 5 Aug 2000     Volume: 9 Number: 3924

Today's topics:
        can i test cgi scripts on my own pc without a host? drdementor@my-deja.com
    Re: can i test cgi scripts on my own pc without a host? jthornton@my-deja.com
        Download from Web Site w/ Username/Password Solution Dennis@NOSpam.com>
    Re: Form to Email on NT (David Efflandt)
    Re: Help with Apache & Perl (David Efflandt)
    Re: How to automate a secure login (David Efflandt)
    Re: IP spoofing <godzilla@stomp.stomp.tokyo>
    Re: IP spoofing drdementor@my-deja.com
    Re: IP spoofing <godzilla@stomp.stomp.tokyo>
    Re: looking for a certain bot (Abigail)
    Re: OT: "cute languages" Was: Gee, thanks for all the h (Abigail)
    Re: Regexp trouble (Decklin Foster)
    Re: Sendmail problem (David Efflandt)
    Re: SSI across servers (David Efflandt)
        Stumped Again! (Pete Holsberg)
    Re: suidperl - /bin/ps is not secure for setuid operati (David Efflandt)
    Re: Tag attributes samurai@metallicafan.com
    Re: Tag attributes <gisle@ActiveState.com>
    Re: Tag attributes <godzilla@stomp.stomp.tokyo>
    Re: Tag attributes <beaumontsystems@netscapeonline.co.uk>
    Re: Tag attributes <beaumontsystems@netscapeonline.co.uk>
    Re: time output not showing leading 0's ? How do I... (David Efflandt)
    Re: Until this or that (Mark-Jason Dominus)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 05 Aug 2000 19:01:19 GMT
From: drdementor@my-deja.com
Subject: can i test cgi scripts on my own pc without a host?
Message-Id: <8mho9t$u2f$1@nnrp1.deja.com>

I want to test scripts on my own pc without a host. I find it time
consuming to have to resave scrips online at, well im using hypermart,
then the site is slow or doesnt work half the time, and im not ready to
pay for a host yet..

I know that certain things may work different since im on a win98
machine and im writing the perl for a unix box but im not doing
anything to cmplicated, im just making a sofisticated string parseing
program, and would like to save tiles to database too .

I know i might have to have a host online to save files etc, and
definatly need a host to send emails..

but at least for the parsing just testing out simple form submits to
test my parsing routines..

can this be done with out needing the scripts online?

when i used to just know html i would prefer writing html in notepad
and keep a browser open, way faster than havign to upload to a host
then test...(ya i know writing html by hand is silly anymore with dream
weaver and what not but i wanted to learn it and have control.)


i downloaded something for perl from perl.com or soemthing, i cant
remember, i was like cool

but there was no executable and i didnt have a clue how to install it.

can anyone help?

Jim



Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sat, 05 Aug 2000 20:38:44 GMT
From: jthornton@my-deja.com
Subject: Re: can i test cgi scripts on my own pc without a host?
Message-Id: <8mhu0l$1ss$1@nnrp1.deja.com>

The answer is to run a web server on your system.

MS Personal Web Server (PWS) comes with Win98. Add it through
Add/Remove Programs -> MS Apps. Then go to Advanced, and set up an
executable cgi-bin folder.

Then install ActiveState's Perl for Win32, and make .plx a recognized
extension -- I believe instructions on how to do this are on
ActiveState's website (http://www.activestate.com).

-James

In article <8mho9t$u2f$1@nnrp1.deja.com>,
  drdementor@my-deja.com wrote:
> I want to test scripts on my own pc without a host. I find it time
> consuming to have to resave scrips online at, well im using hypermart,
> then the site is slow or doesnt work half the time, and im not ready
to
> pay for a host yet..
>
> I know that certain things may work different since im on a win98
> machine and im writing the perl for a unix box but im not doing
> anything to cmplicated, im just making a sofisticated string parseing
> program, and would like to save tiles to database too .
>
> I know i might have to have a host online to save files etc, and
> definatly need a host to send emails..
>
> but at least for the parsing just testing out simple form submits to
> test my parsing routines..
>
> can this be done with out needing the scripts online?
>
> when i used to just know html i would prefer writing html in notepad
> and keep a browser open, way faster than havign to upload to a host
> then test...(ya i know writing html by hand is silly anymore with
dream
> weaver and what not but i wanted to learn it and have control.)
>
> i downloaded something for perl from perl.com or soemthing, i cant
> remember, i was like cool
>
> but there was no executable and i didnt have a clue how to install it.
>
> can anyone help?
>
> Jim
>
> 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 14:46:12 -0500
From: Dennis@NOSpam.com>
Subject: Download from Web Site w/ Username/Password Solution
Message-Id: <jnroosgbkvtq17imsor7mq14ap7js5qin4@4ax.com>

There have been many questions on this ng in the last week on how to use perl to
download from a web site that requires a username and password for entry before
allowing access.

Here is a snippet of my solution.  It allows me to download a Stock Option chain
from a pay/for/info web site.

BTW Embarrassing enough after spending hours and hours(and failing) using the 
  $ua->credentials($URL,$realm,$username,$password); code I got the below
snippet from perldoc lwpcook under "Access To Protected Documents".  I had tried
the lwpcook routine before but I guess I must have had a typo so I moved on to
the "credentials" code.


use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Response;


my $urlbase ='http://www.moneynet.com/...........' #very long string
my $reg;
my $content;
print "Asking for ibm options\n";
#Authenticate Username and Password
  my $ua = new LWP::UserAgent;
  $ua->agent("Mozilla/5.0");
  $req = new HTTP::Request GET => $urlbase;
  $req->authorization_basic($username, $password);
  $content = $ua->request($req)->as_string;
  print $content;
#note this just prints out to the screen what you got..good for fast error
checking

Dennis


------------------------------

Date: Sat, 5 Aug 2000 18:36:46 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Form to Email on NT
Message-Id: <slrn8oonli.pjm.efflandt@efflandt.xnet.com>

On Sat, 5 Aug 2000, James Borden <james@jborden.freeserve.co.uk> wrote:
>Can someone kindly point me to a free Form to Email CGI that works on NT.

For Perl form handling instructions type 'perldoc CGI' on a system with
Perl.

But beyond that, there are too many unknowns.  For example what web server
or mail service does it have?  There is no native NT smtp server unless
they happened to install that option from NT Option Pack 4.  And I have
only used ASP to send form data with that service, because I do not even
know if the donated IIS server has Perl or is set up to do CGI scripts (no
login access, just ftp and FrontPage).

First you should see if your web host has a FAQ about e-mailing form data,
or info about any e-mail service or e-mail from CGI.  Then you should
consult a 'cgi' or 'asp' newsgroup with any questions.

-- 
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, 5 Aug 2000 18:39:52 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Help with Apache & Perl
Message-Id: <slrn8oonrd.pjm.efflandt@efflandt.xnet.com>

On 04 Aug 2000 18:08:40 -0500, Tony Curtis <tony_curtis32@yahoo.com> wrote:
>>> On Fri, 4 Aug 2000 17:48:02 -0500,
>>> "Ryan Blundon" <rblundon@ameritech.net> said:
>
>> Help please!  I have a web server running Apache on
>> Solaris.
>
>> I need to be able to pass the user name from Apache
>> authentication to my Perl cgi script.
>
>    use CGI ':standard';
>    my $realm_name = remote_name();
>
>"perldoc CGI"
>
>(I assume you're talking about basic authentication.)

And of course for that to work (or #ENV{REMOTE_NAME}) the CGI has to be in
a directory using the same authentication.

-- 
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, 5 Aug 2000 18:55:20 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: How to automate a secure login
Message-Id: <slrn8ooooc.pjm.efflandt@efflandt.xnet.com>

On Fri, 4 Aug 2000 12:02:15 +1000, CYW <cyw@yahoo.com> wrote:
>I have a online service provider which I can login from the web and download
>some data.
>I wanted to automate the process using perl. It's a secured login requires
>the browser to support 128 bit encryption.
>
>From Internet Exploer I can use the following as URL to login:
>"http://www.myprovider.com/cgi-bin/login.pl?client_no=my_client_no&pin=my_pl
>ain_text_pin".
>Then use the following as URL to get data:
>"http://www.myprovider.com/cgi-bin/getdata.pl?datadate=01/01/00&datacode=the
>_code"

That is not secure (SSL), it is just plain text.  Did you mean https://?

>I downloaded some modules from CPAN and tried the following code but didn't
>succeed.
>
>use HTTP::Request::Common qw(POST);
>use LWP::UserAgent;
>
>$ua = LWP::UserAgent->new();
>my $req = POST 'http://www.myprovidercom/cgi-bin/123.pl',
>               [ client_no => 'my_client_no', pin => 'my_pin' ];
>$content = $ua->request($req)->as_string;
>print $content; # for debugging purpose
>
>$req = POST 'http://www.myprovidercom/cgi-bin/getdata.pl',
>               [ data_date => '01/01/00', data_code => 'abc' ];
>$content = $ua->request($req)->as_string;
>print $content;
>
>
>It appeared that the login didn't succeed. I viewed my provider's login page
>source from IE, there's a section contains something like:
>action="http://www.myprovider.com/cgi-bin/login.pl"
>method=POST
>name=client_no, type=text,
>name=pin, type=password
>
>What can I do in perl to automate the login? Was it the 128 bit encryption
>causing problems?

Like I said, it does not appear to be using any encryptation.  SSL uses
https or port 443.  Maybe it uses cookies to keep track of your login.
What response headers to you get back from the login attempt?

-- 
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 11:16:09 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: IP spoofing
Message-Id: <398C59E9.6957556@stomp.stomp.tokyo>

DT wrote:

> I want to use "Ip spoofing" to do mass submission to 
> search engines. How can I do that.

There is a little known trick to accomplish this.

Nearly a decade back, a couple of teenagers wrote
a Visual Basic script used to raise Hades within
America Online. This script is known as "AOHell."

Locate and download this AOHell script. Grab one
of those numerous Free AOL CDs from your mailbox.
Once you have both, extract the AOL browser from
their CD and install it in your internet directory
where you have Mozilla or MSIE. Install AOHell in
the same directory.

Make your internet connection, start up AOHell, then
start your fake AOL browser. Guaranteed your IP address
will show as one of numerous AOL IP addresses.

Godzilla!

--
In Evil Ways, I will rock you.
  http://la.znet.com/~callgirl3/evilways.mid


------------------------------

Date: Sat, 05 Aug 2000 19:11:26 GMT
From: drdementor@my-deja.com
Subject: Re: IP spoofing
Message-Id: <8mhosr$uet$1@nnrp1.deja.com>

In article <398C59E9.6957556@stomp.stomp.tokyo>,
  "Godzilla!" <godzilla@stomp.stomp.tokyo> wrote:
> DT wrote:
>
> > I want to use "Ip spoofing" to do mass submission to
> > search engines. How can I do that.
>
> There is a little known trick to accomplish this.
>
> Nearly a decade back, a couple of teenagers wrote
> a Visual Basic script used to raise Hades within
> America Online. This script is known as "AOHell."
>
> Locate and download this AOHell script. Grab one
> of those numerous Free AOL CDs from your mailbox.
> Once you have both, extract the AOL browser from
> their CD and install it in your internet directory
> where you have Mozilla or MSIE. Install AOHell in
> the same directory.
>
> Make your internet connection, start up AOHell, then
> start your fake AOL browser. Guaranteed your IP address
> will show as one of numerous AOL IP addresses.
>
> Godzilla!
>
> --
> In Evil Ways, I will rock you.
>   http://la.znet.com/~callgirl3/evilways.mid
>

where can you get aohell ? i was looking for it a long time ago and
never found it...

is there an underground hacker page soemwhere or soemthing?

i originally wanted it to bump people offline when they bothered me too
much. lol

Jim


Sent via Deja.com http://www.deja.com/
Before you buy.


------------------------------

Date: Sat, 05 Aug 2000 12:40:35 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: IP spoofing
Message-Id: <398C6DB3.1D8CA128@stomp.stomp.tokyo>

drdementor@my-deja.com wrote:

> Godzilla! wrote:
> > DT wrote:

(snippage)

> > > I want to use "Ip spoofing" to do mass submission to
> > > search engines. How can I do that.

> > There is a little known trick to accomplish this.

> > ...This script is known as "AOHell."

> where can you get aohell ? i was looking for it a long 
> time ago and never found it...

Oddly, I think I have a copy of AOHell on a hard drive
in one of my old 286 machines. I am curious now.

Godzilla!


------------------------------

Date: 05 Aug 2000 21:44:55 GMT
From: abigail@foad.org (Abigail)
Subject: Re: looking for a certain bot
Message-Id: <slrn8op2m6.st1.abigail@alexandra.foad.org>

Gary Krupa (gary@rns1.earthlink.net) wrote on MMDXXXI September MCMXCIII
in <URL:news: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 don't think you find many people here that want to promote spamming
by helping spammers.

%% I'd be grateful for any help offered.

Can we get $0.10 for each email address you find this way?


Abigail
-- 
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'


------------------------------

Date: 05 Aug 2000 21:39:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: OT: "cute languages" Was: Gee, thanks for all the help
Message-Id: <slrn8op2c8.st1.abigail@alexandra.foad.org>

Tim Hammerquist (tim@degree.ath.cx) wrote on MMDXXXI September MCMXCIII
in <URL:news: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?


Eh, if you can stand George Reese, you might want to look at
www.imaginary.com. He wrote some articles about LPC. They aren't the
best writings though.


Abigail
-- 
print v74.117.115.116.32;
print v97.110.111.116.104.101.114.32;
print v80.101.114.108.32;
print v72.97.99.107.101.114.10;


------------------------------

Date: Sat, 05 Aug 2000 19:07:07 GMT
From: decklin+usenet@red-bean.com (Decklin Foster)
Subject: Re: Regexp trouble
Message-Id: <vBZi5.11113$f_5.59950@news1.rdc1.ct.home.com>

Henrik Springfors <moliate@yahoo.se> writes:

> but
>     <B> hello world <CENTER> </B>
> should remain unaffected.

Why? That's clearly wrong.

> inane HTML-tags in a document - that's all tags that don't affect
> any text. For example:

Lots of valid tags don't "affect any text".

I think what you want is here:

        http://www.w3.org/People/Raggett/tidy/

Save yourself re-inventing another wheel.

-- 
There is no TRUTH. There is no REALITY. There is no CONSISTENCY. There
are no ABSOLUTE STATEMENTS. I'm very probably wrong. -- BSD fortune(6)


------------------------------

Date: Sat, 5 Aug 2000 20:40:55 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: Sendmail problem
Message-Id: <slrn8oouub.pjm.efflandt@efflandt.xnet.com>

On Thu, 3 Aug 2000, Mitzei <mitterer.alexander@steinbacher.at> wrote:
>I am using a script for a mailinglist. But with some mail addresses the
>following error occurs: The mails donīt arrive at the destination POP. It
>seems like the error is in the sendmail-proggy. My provider told me, that
>sendmail uses different smpt-servers (destination domain) and some/most deny
>"us".

It sounds like your provider has been flagged by some organizations as a
possible spam relay, due to either an open mail relay, lack of anti-spam
policies or DNS problems.  It is also possible that you are overloading
sendmail or your system with too many processes.  You might consider some
program made for mailing lists like 'majordomo'.

>Are there any parameters I can use to make a workaround? i.e:
>"usr/sbin/sendmail -t" (donīt know what "-t" stands for)

See 'man sendmail' and other docs at www.sendmail.org.  Your provider
might be using some other smtp server like 'postfix' or 'qmail' which is
just symlinked to 'sendmail'.

There is a verbose switch (-v) for real sendmail that can be used with
open3() in Perl to see the error returned from the remote server.  See
http://cgi-help.virtualave.net/pub/mailtest.txt

-- 
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, 5 Aug 2000 20:47:20 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: SSI across servers
Message-Id: <slrn8oovac.pjm.efflandt@efflandt.xnet.com>

On Fri, 04 Aug 2000 11:13:10 -0400, Drew Simonis <care227@attglobal.net> wrote:
>jkirsch@kirschnet.com wrote:
>> 
>> Is there a way to do SSI across servers.  I get an 'error processing
>> directive' error when I use either 'include virtual' or 'exec cgi'.  I
>> know that the 'include virtual' works locally.
>> 
>
>No, and this has nothing to do with Perl.

Even though the question has nothing to do with Perl, there is a Perl
solution.  Use the LWP module or IO::Socket in a local CGI to get the
remote file.  'perldoc perlipc' has a simple webget example, but you
probably need to add a Host: header to the request for virtual servers.

-- 
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: 5 Aug 2000 20:40:27 GMT
From: pjh@mccc.edu (Pete Holsberg)
Subject: Stumped Again!
Message-Id: <8mhu3r$cbe$1@lawrenceville.mccc.edu>

This should be SOOO easy, but I just can't get it,

I have a file that looks like this (SSNs and phone numers are bogus):

   1 143-80-0908 BARGER-FOX, PAT BOB 04/08/00       (609) 466-1821  YES         
   2 140-65-0756 FORD DOG, B J       06/23/00       (609) 587-2726  YES         
   3 138-99-9890 BENJAMIN JR, EMILY  04/06/00       (609) 799-8130  YES         
   5 124-58-0237 BROCK III, DANA M   03/29/00       (609) 371-5073  YES         
   6 220-66-2813 BURRELL, DORETHA M  04/07/00       (609) 530-0308  YES         

I want to produce two values for each line, as follows

BARGERFOX and PAT
FORDDOG and B
BENJAMIN and EMILY
BROCK and DANA
BURRELL and DORETHA

but I just can't get the right regular expressions. Can
someone please take pity and send me some suggsted ones?

Thanks,
Pete


------------------------------

Date: Sat, 5 Aug 2000 21:30:47 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: suidperl - /bin/ps is not secure for setuid operation
Message-Id: <slrn8op1rq.pjm.efflandt@efflandt.xnet.com>

On Fri, 04 Aug 2000, gary_griffith@hotmail.com <gary_griffith@hotmail.com>
wrote:
>Can anyone tell me why this gives the error: "This /bin/ps is not
>secure for setuid operation."?  How do I get /bin/ps to run with
>suidperl?

'bash' uses $ENV{BASH_RC} which is tainted because the file it points to
could contain arbitrary commands.  See my working condensed version of
your script below.

>Also - if anyone knows of a good source of documentation on suidperl
>(other than the repeated notes that simply say "Use It"):

perldoc perlsec

>#!/usr/bin/suidperl
>
>use Shell;
>
>$ENV{'PATH'} = '/bin:/usr/bin';
>$ENV{'BASH_ENV'} = '/home/joe/.bashrc';
>
>print "Content-type: text/html\n\n";
>print "<html>\n";
>print "<body>Hello<P>\n";
>print "<PRE>\n";
>
>system "echo `/bin/ps -C httpd -opid`";
>
>print "</PRE>\n";
>print "</body>\n";
>print "</html>\n";


This works for me (or perl -Tw if not really runing suid):

#!/usr/bin/suidperl -w
use strict;
$ENV{'PATH'} = '/bin:/usr/bin';
$ENV{BASH_ENV} = '';
print "Content-type: text/html\n\n<html>\n<body>Hello<P>\n<PRE>\n";
print `/bin/ps -C httpd -opid`, "</PRE>\n</body>\n</html>\n";


-- 
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 12:14:49 -0700
From: samurai@metallicafan.com
Subject: Re: Tag attributes
Message-Id: <398C67A9.817D561D@metallicafan.com>

"Godzilla!" wrote:

> beaumontsystems wrote:
> > 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?

    Readability for one reason.  Conformity for another.  Wouldn't
expect you to understand either of those...
    http://www.w3.org/TR/html4/about.html#h-1.2.1

> 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?

    Why write broken code if a module exists?
    ///
--
I would wish to learn the bases of the cracking.
Ps: saddened for my English but it goes out of an automatic translator.




------------------------------

Date: 05 Aug 2000 21:26:33 +0200
From: Gisle Aas <gisle@ActiveState.com>
Subject: Re: Tag attributes
Message-Id: <m3zomrv79y.fsf@eik.g.aas.no>

"beaumontsystems" <beaumontsystems@netscapeonline.co.uk> writes:

> 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).

#!/usr/bin/perl

use strict;
use HTML::Parser ();

sub upcase_tag
{
    my($text, $tpos) = @_;
    while (@$tpos) {
	substr($text, shift @$tpos, shift @$tpos) =~ tr/a-z/A-Z/;
	shift @$tpos until @$tpos % 4 == 0;
    }
    print $text;
}

my $p = HTML::Parser->new(api_version => 3);
$p->handler(default => sub { print @_ }, "text");

for (qw/start end/) {
    $p->handler($_ => \&upcase_tag, "text, tokenpos");
}

my $file = shift || usage();
$p->parse_file($file) || die "Can't open file $file: $!\n";

sub usage
{
    my $progname = $0;
    $progname =~ s,^.*/,,;
    die "Usage: $progname <filename>\n";
}


------------------------------

Date: Sat, 05 Aug 2000 12:36:51 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Tag attributes
Message-Id: <398C6CD3.2A2DADBC@stomp.stomp.tokyo>

samurai@metallicafan.com wrote:
 
> "Godzilla!" wrote:
 
> > beaumontsystems wrote:
> > > 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?
 
> Readability for one reason.

Yes, I understand. This difference between upper
case and lower case letters confuses many people,
especially those who sit, sip tea while spending
idle time reading html code in document sources.


> Conformity for another.

Agreed. Conformity is critical in life. We must
conform. We must live in little pink houses,
with a little pink BMW in the drive, wear pink
tennis shoes, pink rolled down socks, pink jogging
outfits accessorized with pink hair bow ties. We 
must conform. We are Borg.

> Wouldn't expect you to understand either of those...

You are right. Those darn upper case and lower case
letters confuse the F-word out of me.


>     http://www.w3.org/TR/html4/about.html#h-1.2.1

Thank you. I have added this link to my circular filing cabinet.

 
> > 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?
 
>  Why write broken code if a module exists?

Most likely because a person is a Perl 5 Cargo Cultist
Copy and Paste Sissified Geek who doesn't have a clue
how to write good code and good programs???? Ya think?

Why write a program when you can copy and paste 
a module reference? No skill required, yes?


Godzilla!


------------------------------

Date: Sat, 5 Aug 2000 21:57:45 +0100
From: "beaumontsystems" <beaumontsystems@netscapeonline.co.uk>
Subject: Re: Tag attributes
Message-Id: <398c736b_3@plato.netscapeonline.co.uk>

"Godzilla!" <callgirl@la.znet.com> wrote in message
news:398C5024.4C89831D@la.znet.com...
> beaumontsystems wrote:
>
> > 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?

Yes, I *know* the browser doesnt' care, but we have a client who
is paying us loads of money to churn out pages, and I happen to think
they look neater and a wee bit more "professional" if we adopt a
consistent style. No big deal.

> > (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.

I simply dont understand what you are getting at here. I am not proposing to
change the data that is displayed on the page. And I am not proposing to
introduce "deliberate errors". Sheesh!.....

>
> Godzilla!




------------------------------

Date: Sat, 5 Aug 2000 22:06:39 +0100
From: "beaumontsystems" <beaumontsystems@netscapeonline.co.uk>
Subject: Re: Tag attributes
Message-Id: <398c736c$1_3@plato.netscapeonline.co.uk>

"Godzilla!" <callgirl@la.znet.com> wrote in message
news:398C5024.4C89831D@la.znet.com...
> beaumontsystems wrote:
>
> > 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?

Yes, I *know* the browser doesnt' care, but we are churning out lots
of pages, and they're looking a bit messy (having been produced initially
via Dreamweaver and then modified by hand by several people), and it's
just to tidy up the HTML a little. It's no big deal, and I'm not claiming
that
anything is "broke". OK, so they'll look a bit neater and perhaps a bit more
"professional" ... so what's wrong with that ? It's a nicety for a client
who is
paying us lots of money.

> > (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.

I simply dont understand what you are getting at here. I am not proposing to
change the data that is displayed on the page, and I am not proposing to
introduce "deliberate errors". Sheesh!.....

>
> Godzilla!






------------------------------

Date: Sat, 5 Aug 2000 22:01:31 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: time output not showing leading 0's ? How do I...
Message-Id: <slrn8op3le.pjm.efflandt@efflandt.xnet.com>

On Fri, 4 Aug 2000, Robert Chalmers <robert@chalmers.com.au> wrote:
>The follwing code, produces the time fine, but the first printout drops the
>leading 0 from the minute display?
>
>like this.            So how do I convince it to display it as 15:01, and
>not 15:1 ??????
>thanks
>Bob
>............................................................................
>..........
>Sydney Friday-15:1
>And the fully formatted version - Time is Fri Aug 4 15:01:41 2000
>
>............................................................................
>...........
>#!/usr/bin/perl
>use CGI qw(:all);
>$tz = 10;
>#my $tz = param('tz') || "Timezone Not Specified";
>$timehere = scalar(gmtime($tz * 3600 + time));
>#................................................
>#======================================================
>@MoY =
>('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
>@DoW =
>('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
>($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($tz * 3600 +
>time);
>$year += 1900;
>$Month = $MoY[$mon];
>$Day = $DoW[$wday];
>$TimeString = "$Day-$hour:$min";
># ==========================================================================
>
>print  "Content-type: text/plain\n\n";
>print " $TimeString\n";
>print "<br>And the fully formatted version - Time is $timehere<br>\n";
>
>#
>===========================================================================
>~

Why do you play with month strings and year that you never use?  On
Unix-like systems, that whole time block could be simplified to:

use POSIX;
$TimeString = POSIX::strftime("%A-%H:%M",gmtime($tz * 3600 + time));

Look up the strftime function in 'perldoc POSIX' and the strftime time
codes in 'man strftime' (probably same as in 'man date').

-- 
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 21:14:36 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: Until this or that
Message-Id: <398c83bb.435f$1c9@news.op.net>

In article <uJVi5.9029$Gd1.76998@Typhoon.bART.nl>,
Eelke Kleijn <six4eight@BLADIEBLAhotmail.com> wrote:

>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' ??

until ((my $line = <Socket_Handle>) =~ /<%!/ || $line =~ /<HTML>/) {}



------------------------------

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 3924
**************************************


home help back first fref pref prev next nref lref last post