[11741] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5341 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 9 14:07:34 1999

Date: Fri, 9 Apr 99 11:01:34 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 9 Apr 1999     Volume: 8 Number: 5341

Today's topics:
    Re: Perl as a first programming language - suitability, (the jackal)
    Re: Perl conception (Sam Holden)
    Re: perl off-line browser for WINDOW ... <cassell@mail.cor.epa.gov>
        Perl/Solaris 7 Compilation Problems andrew@benevolent-tech.com
    Re: Pls help... regex to recognise a phone number. (Alan K. Jackson)
    Re: Privacy for slaves forced to use a proxy/firewall t <AdminP@relay.com>
    Re: Quantum Variable <aqumsieh@matrox.com>
        question about hash keys (Boson)
    Re: question about hash keys (Larry Rosler)
    Re: question about hash keys <nospam.kayec@gov.ns.ca>
    Re: removing the \n at the end of a variable <aqumsieh@matrox.com>
    Re: Returning "undef" from a subroutine. Appears broken (Larry Rosler)
    Re: Run Perl script from within Perl script? <langer@neu.sgi.com>
    Re: Run Perl script from within Perl script? <aqumsieh@matrox.com>
    Re: Run Perl script from within Perl script? <SpamMeNOT.3pound@iname.com>
        Stripping html tags within perl <nsandow@otnnet.com>
    Re: Stripping html tags within perl <nils@hotmail.com>
    Re: Stripping html tags within perl <nsandow@otnnet.com>
    Re: Sys::Syslog (Neil Cherry)
    Re: web-based newreader? (nospam)
    Re: why my map diff to a loop? <jdf@pobox.com>
    Re: Win-32 / Unix CGI question <cassell@mail.cor.epa.gov>
    Re: Y2K (yes, again - sorry!) <jonz@rmi.nospam.net>
    Re: Y2K (yes, again - sorry!) <cassell@mail.cor.epa.gov>
    Re: Yet another regexp question (Sam Holden)
    Re: Yet another regexp question <jdf@pobox.com>
    Re: Yet another regexp question <clwolfe@indiana.edu>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 9 Apr 1999 17:47:53 GMT
From: hdiwan@diwanh.stu.rpi.edu (the jackal)
Subject: Re: Perl as a first programming language - suitability, good books ?
Message-Id: <slrn7gsf7j.5n6.hdiwan@diwanh.stu.rpi.edu>

I like both python and perl. I think Python's Object implementation is cleaner
and the code comes out a lot easier to read than perl's. However, perl is a
better glue language [from what I can tell]. 
In article <7egnpv$nqm$1@news8.svr.pol.co.uk>, Jonathan wrote:
>
>That's certainly a lot of replies. I'm surprised that no one seems to have
>read the Perl For Dummies book or commented on it. I've had a good look at
>it myself and I think it's quite good for its market. I certainly wouldn't
>point a non-programmer at the Llama book - it takes far too much for granted
>about the basics (what an array is, etc.) Llama would be good for a student
>in the first year of university, or someone with a little exposure to any
>language. On the other hand, I don't think it goes as far as references ?
>And Dummies does.
>
>The Cookbook is an excellent book, but it's pretty scary looking for a
>beginner (and doesn't address the language at all.)
>
>Regarding suggestions to learn other languages - my own first programming
>language was Basic, the second was Awful - sorry I mean Eiffel. I wouldn't
>inflict a toy or an academically designed purist language on anyone.
>Programming is about all sorts of subtle linguistic textures, idioms, and
>cues that these languages generally don't provide, and Perl does. That's
>certainly why all the talented programmers I know who have worked with
>Eiffel - several of us before using C++ or C, so there was no question of
>rejecting it merely because we used to those very opposite languages
>irst  - shudder at its name. (I have a strict rule on condeming languages. I
>don't say that you should never do it, but you only have the right to
>criticise them if you had to use them for at least half a year and were good
>enough to correct the work of whoever made everyone else use the damn thing
>in the first place.)
>
>Maybe Python doesn't belong to that club. *Probably* it doesn't. But I do
>understand that it's "verbose" and that it has a high ratio of people
>writing research papers about it to people using it for solving real
>problems. These I take as bad signs. Oh, and I just junk email from some
>silly ass (no one who posted here) telling me that Perl is "good for
>nothing" and that my friend  should learn Python instead. This doesn't
>reflect badly on Python at all, but this sort of over defensiveness normally
>means a language is an economic dead goose, and hey, we've all got to eat.
>
>And I *know* Perl is good. And Larry Wall certainly meant it as a language
>for people like my friend - look at the intro to the Camel book.
>
>Perl can be used to write useful real world programs with only knowledge of
>the basic variable types and functions. It can encompass the idea of "many"
>effectively and simply with its powerful, simple to use arrays and hashes.
>It can provide data types (using hashes) too. There's no equivalent of the
>pointer or the copy constructor to learn (you know what I mean) and it has
>has an incredible expressive power - in Perl you say what you mean, not what
>the language forces you to say (unlike Eiffel - and Pascal looks like Eiffel
>to me.) It handles "unusual" conditions (eg trying to print undefs) with
>human-ish sense, in my book making it a far natural language than any other
>I've seen - the Perl computational model includes the computer behaving with
>common sense behaviour, the first time I've heard of such a thing. Normally
>it's this lack of "common-sense" from a PC that causes more problems for a
>non-programmer starting out than anything else. And come to think of it,
>that anti-"say what you mean" thing is often obstacle number two.
>
>( I'd even say that Perl might make an excellent children's language, if a
>book was written to use just a simple subset and it shipped with a nice
>turtle graphics package - my one worry here would be the lurking presence of
>the special variables. They are too confusing to explain to a 12 year old,
>but if you don't what happens when one of the kids decides to call a
>variable $_ ? )
>
>Thanks for all replies,
>Jonathan Coupe.
>
>
>
>


-- 
Hasan Diwan


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

Date: 9 Apr 1999 17:23:31 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl conception
Message-Id: <slrn7gsdsi.p31.sholden@pgrad.cs.usyd.edu.au>

On Fri, 9 Apr 1999 08:50:40 -0500 (CDT), Aaron <aaron@soltec.net> wrote:
>Hi
>
>I had someone tell me the other day that people don't use perl because of its large footprint
>
>He went on to say that Java had a smaller footprint because it loaded its classes dynamically by nature
>
>I was curious as to how much truth is here and how much is a misconception
>
>It would seem to me that Java would by far have a larger footprint since the JVM would take up memory on top of the code it was executing
>
>but Perl is in some ways the same way
>
>is there a document that points to memory consumption difference between the two languages?

Dynamic loading shouldn't matter, since once a class is loaded it is loaded...
You can manually do dynamic loading in perl in numerous ways. 

Perl does sacrifice memory for speed a lot though...

In a totally unscientific manner :

perl seems to have less overhead for a very very simple program which
doesn't use any extra classes/modules.

test.pl :
while(1) {}

test.java
public class test {
    public void main(String args[]){
        while(true){}
   }
}

After running them for a while (while I typed this) top told me :

  PID USER     PRI  NI  SIZE  RSS SHARE STAT  LIB %CPU %MEM   TIME COMMAND
24458 sholden   18   0  4768 4768  1616 R       0 44.0  3.7   1:21 Kaffe
24459 sholden   18   0   920  920   796 R       0 42.0  0.7   1:21 perl

Perl is using much less memory...

I don't have any big java things around that I could compare with big  perl
things...

-- 
Sam

There's no such thing as a simple cache bug.
	--Rob Pike


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

Date: Fri, 09 Apr 1999 10:56:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: perl off-line browser for WINDOW ...
Message-Id: <370E3F65.15AA21EB@mail.cor.epa.gov>

help-me-please@usa.net wrote:
> 
> Hi all,
> I am finding perl program FOR WINDOW,
> which can help me off-line download web pages.
> 
> Can you write me where can I download from?
> 
> I know that there is a proram called webcopy,
> but it is for unix...
> 
> Thank you very much.

Install ActiveState's Perl for win32.  It comes with the module
LWP::Simple.
That will do what you want.  Look in its documentation for an example.

HTH,
David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Fri, 09 Apr 1999 16:53:33 GMT
From: andrew@benevolent-tech.com
Subject: Perl/Solaris 7 Compilation Problems
Message-Id: <7elbaa$pl4$1@nnrp1.dejanews.com>

Looking for advice with my perl install! I've done it before, but am having
problems now, and would deeply appreciate any assistance.

The story this far:

Sun Enterprise 250 machine, dual 300 mhz processors, 2 9 GB disks.

Solaris 2.7 successfully installed, disks partitioned the way I want.

gcc 2.8.1 installed cleanly.

Various small things (bash, less, etc) and some large things (emacs, apache)
compiled and installed successfully.

The problem has been with Perl. I tried installing the latest stable release
(5.005_03) and while the configure and initial make looked clean, make test
delivered a bunch of errors where the thing would core dump seemingly -after-
all the tests were completed. Sometimes, it says 'bus error, core dumped'.
When I re-run the test, it fails on the same things.

Being an optomistic type, I installed it anyway, but whenever I run tests on
the various modules I need to do my job (DBI/DBD, LWP) it delivers the same
sort of errors, and ultimately gives seg. faults with little test scripts I
run.

Being a persistent type, I wiped out all previous perl installs and tried an
earlier Perl, 5.004_04 - same results.

Looking around on Usenet, I noticed some folks were using egcs to build perl.
I tried this but egcs of course failed to compile...

Any hints appreciated!

- Andrew Waegel

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Mon, 05 Apr 1999 13:15:29 GMT
From: ajackson+news@shellus.com (Alan K. Jackson)
Subject: Re: Pls help... regex to recognise a phone number.
Message-Id: <slrn7ghdqv.ng.ajackson+news@mactra.brc.shell.com>

In article <37061d1c.36111639@news.apex.net.au>, Kim Saunders wrote:
> Hiya again everyone...
> 
> Me again, same plea for regex help. Can someone please help with with
> a regex (and associated code) that will analyse a string, and every
> time a phone number is in it, match, and print it?
> 

I wrote some spam analysis software that (in part) looks for phone numbers.

Here is the bit of code that I tweaked until it seemed to mostly work (99%).

Only valid for U.S.-style numbers, though.
I don't remember all the subtleties anymore, but it was pretty tricky.
Basic idea is to look for the 3-digit,separator,4-digit motif, assume
that must be a phone number, clean out a lot of the extraneous stuff,
and then parse it. It gets tricky when you allow multiple numbers
on a single line.

	 my @p = ();
	 if (/\D\d{3}\s*-\s*\d{4}[^-\d]/) { # line contains a phone number
		s/(\(|\)|-|\]|\[|\/)/ /g;
		@p = /(\D|^|\G)((1\s*)?(\d\d\d\s+)?\d{3}\s+\d{4})\D/g;
	 }


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

Date: 9 Apr 1999 16:57:12 GMT
From: Proxy Admin <AdminP@relay.com>
Subject: Re: Privacy for slaves forced to use a proxy/firewall to access the net?
Message-Id: <8DA3837C0AdminPrelaycom@news.earthlink.net>

It's the same old story:

What we do not understand, we fear.

On the net that I administer, the users bitch and moan about setting up for 
the Web Proxy. Then they complain that they can't do realaudio or stock 
tickers, and "how do I set up my ICQ"?

When I explain about how the net should be used wisely (for work, 
education, and advancement), they look at me like I'm an pariah.

When we warned them repeatedly through E-Mail, Local News, meetings, and 
word of mouth about monitoring and what constituted it, the users snubbed 
us and said it was their "God given right" under the constitution to surf 
all day for porn and not to work.

After 30 examples were chosen from the populace, had hand-slaps, fines, 
loss of jobs, and in one instance; IMPRISONMENT (child pornographer), still 
to this day they insist of their "rights".

So what am I to do? Just say F---IT? No way! My job is to police the use of 
the internet by our users, and I will do it. It's thankless, hated and 
socially unacceptable. Big Deal! If half of the whiners who can't get to 
crochet dot com had ethics, I'd be out of a job. They don't. I'm not.



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

Date: Thu, 8 Apr 1999 13:11:13 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Quantum Variable
Message-Id: <x3yiub7rqa6.fsf@tigre.matrox.com>


erica@coffin.org writes:

> The variable containing this unusual string is called $country.
> It appears to have some mysterious escaped character on the end that does not
> allow me to concatenate other strings onto the end (they disappear), yet,
> executing things along the lines of:
>   $country =~ m/(.*\w)/;
>   $country = $1;

They disappear? hmm .. like:

$country .= 'something';
print $country;

whatever is printed out would not have 'something' at the end?
I doubt that. Show us some code.

> Does not force this character off. When I run quotemeta $country, I get (for
> example) 'United\ States\'. 

Did you try to 'chop($country);' ??

Maybe that's work.



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

Date: Fri, 09 Apr 1999 16:24:57 GMT
From: boson@earthlink.net (Boson)
Subject: question about hash keys
Message-Id: <370e284b.97821872@news.earthlink.net>

I have been experimenting with the hash keys...I don't understand why
this little code prints out "b c". I was expecting "a b c" or maybe
just "c". 

$h{123} = 'a';
$h{'0123'} = 'b';
$h{'123'} = 'c';
print "$h{$_} " foreach (keys %h);

I am sure there is a simply explanation. Help!

Boson




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

Date: Fri, 9 Apr 1999 10:41:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: question about hash keys
Message-Id: <MPG.1177dbac71e22c9c989879@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <370e284b.97821872@news.earthlink.net> on Fri, 09 Apr 1999 
16:24:57 GMT, Boson <boson@earthlink.net> says...
> I have been experimenting with the hash keys...I don't understand why
> this little code prints out "b c". I was expecting "a b c" or maybe
> just "c". 
> 
> $h{123} = 'a';
> $h{'0123'} = 'b';
> $h{'123'} = 'c';
> print "$h{$_} " foreach (keys %h);
> 
> I am sure there is a simply explanation. Help!

Sure there is.  The key of a hash is a string.  Anything that is not a 
string (such as a number or a reference) is converted to a string.  Thus 
the assignment to $h{'123'} overwrites the assignment to $h{123}.  
Needless to say, the string '0123' is not the same as the string '123'.

 -- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 9 Apr 1999 14:54:59 -0300
From: "kayec" <nospam.kayec@gov.ns.ca>
Subject: Re: question about hash keys
Message-Id: <S6rP2.213$Up1.2749@sapphire.mtt.net>

A hash can't have a numeric key...  It must convert 123 to a string, and two
lines below you make ${'123'} = 'c'.

$h{12} = 'a';
$h{'0123'} = 'b';
$h{'123'} = 'c';
print "$h{$_} " foreach (keys %h);     #result a b c


kayec

Boson wrote in message <370e284b.97821872@news.earthlink.net>...
>I have been experimenting with the hash keys...I don't understand why
>this little code prints out "b c". I was expecting "a b c" or maybe
>just "c".
>
>$h{123} = 'a';
>$h{'0123'} = 'b';
>$h{'123'} = 'c';
>print "$h{$_} " foreach (keys %h);
>
>I am sure there is a simply explanation. Help!
>
>Boson
>
>




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

Date: Thu, 8 Apr 1999 14:11:03 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: removing the \n at the end of a variable
Message-Id: <x3yemlvrnii.fsf@tigre.matrox.com>


rjshank@postoffice.swbell.net writes:

> > chop  -- trim off the very last character no matter what.
> >          if $m always has an \n on the end, then chop works fine
> > chomp -- trim whatever $/ is set to off of the end of the
> >          variable.  by default this happens to be "\n", so chomp
> >          would also work fine
> >
> > Hope This Helps!
> 
> Interesting, I never heard of it and it's in neither of my Unix Perl programming
> books (the one with the camel on the front and the one with the llama).  Is
> Perl different for Linux or are my books just outdated?

Did you by any chance have a look at page 149 of the Camel book?
Maybe you missed that page.



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

Date: Fri, 9 Apr 1999 09:19:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Returning "undef" from a subroutine. Appears broken in my latest version.
Message-Id: <MPG.1177c884c1b2b353989878@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <ixkogkxx3y1.fsf@kinetic.atria.com> on Fri, 9 Apr 1999 
14:29:26 GMT, Tim Butler <tbutler@rational.com> says...
 ...
> $ /usr/local/bin/perl5.002 -w ./s1
> undefined
> $ /usr/local/bin/perl5.003 -w ./s1
> undefined
> $ /usr/local/bin/perl5.00502 -w ./s1
> Odd number of elements in hash assignment at ./s1 line 7.
> Use of uninitialized value at ./s1 line 7.
> defined
 ... 
>   Is the warning new in version 5.005, or are my older builds broken?

My versions 5.002 and 5.003 behave the same as yours do -- no warnings.  
Version 5.004_03 gives the first warning but not the second; 5.005_02 
gives both, as you show.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 09 Apr 1999 18:44:27 +0200
From: "Stephane-R. Langer" <langer@neu.sgi.com>
Subject: Re: Run Perl script from within Perl script?
Message-Id: <370E2E6B.A05C07B8@neu.sgi.com>

One way you can do this is by using the 'system' function.

Example:

#!/usr/bin/perl -w

system "perlscript.pl";

SR

Diego Barros wrote:
> 
> How can I run a Perl script from within a running Perl script?
> 
> Regards,
> Diego Barros

-- 
 ---- Stephane-R. Langer
------------------------------------------------	
      Silicon Graphics, Inc.		EMC High-End Master Scheduling      	
				        phone +41.32.843.3747 / fax.3900	
 - Today isn't going to be as good as you'll think it was in the
future.-


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

Date: Thu, 8 Apr 1999 14:22:12 -0400 
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Run Perl script from within Perl script?
Message-Id: <x3yd81frmzw.fsf@tigre.matrox.com>


alien@netspace.net.au (Diego Barros) writes:

> How can I run a Perl script from within a running Perl script? 

TIMTOWTDI.

1) perldoc -f do
2) perldoc -f system
3) perldoc -f open
4) `STRING` entry in perlop

I would use either (1) or (3) depending on what the script does.



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

Date: Fri, 9 Apr 1999 12:26:45 -0500
From: "Jay J" <SpamMeNOT.3pound@iname.com>
Subject: Re: Run Perl script from within Perl script?
Message-Id: <pHqP2.41$Ji.540802@rsnws01.mn.mediaone.net>

do('myscript.pl');

 ... works too (but differently)

Stephane-R. Langer <langer@neu.sgi.com> wrote in message
news:370E2E6B.A05C07B8@neu.sgi.com...
> One way you can do this is by using the 'system' function.
>
> Example:
>
> #!/usr/bin/perl -w
>
> system "perlscript.pl";
>
> SR
>
> Diego Barros wrote:
> >
> > How can I run a Perl script from within a running Perl script?
> >
> > Regards,
> > Diego Barros
>
> --
>  ---- Stephane-R. Langer
> ------------------------------------------------
>       Silicon Graphics, Inc. EMC High-End Master Scheduling
>         phone +41.32.843.3747 / fax.3900
>  - Today isn't going to be as good as you'll think it was in the
> future.-




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

Date: Fri, 09 Apr 1999 09:22:15 -0700
From: Neil Sandow <nsandow@otnnet.com>
Subject: Stripping html tags within perl
Message-Id: <370E2936.3355CE0A@otnnet.com>

In a perl script I have a variable, $NAME assigned to the first field in
each line of an ascii text file.
Some of these fields contain html tags <a
href="http://blahblahbalh>name</a> surrounding the name.

I would like to create another variable which would be the same as $NAME
but with the html tags stripped, leaving
just the name=$NAME.

Can somebody supply me with the correct syntax to accomplish this?

Thanks! -Neil
rx@rxlist.com   http://www.rxlist.com



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

Date: Fri, 9 Apr 1999 19:19:14 +0200
From: "Fredrik Larsson" <nils@hotmail.com>
Subject: Re: Stripping html tags within perl
Message-Id: <VEqP2.6114$x43.10691@nntpserver.swip.net>

$NAME2 = $NAME;
$NAME2 ~= s/<.*?>//g;    # erases all html-tags in the string

$NAME2 now contains the same as $NAME but without all html-tags

/Larzon

>In a perl script I have a variable, $NAME assigned to the first field in
>each line of an ascii text file.
>Some of these fields contain html tags <a
>href="http://blahblahbalh>name</a> surrounding the name.
>
>I would like to create another variable which would be the same as $NAME
>but with the html tags stripped, leaving
>just the name=$NAME.
>
>Can somebody supply me with the correct syntax to accomplish this?
>
>Thanks! -Neil
>rx@rxlist.com   http://www.rxlist.com
>




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

Date: Fri, 09 Apr 1999 10:52:36 -0700
From: Neil Sandow <nsandow@otnnet.com>
To: Fredrik Larsson <nils@hotmail.com>
Subject: Re: Stripping html tags within perl
Message-Id: <370E3E63.E6B13FE8@otnnet.com>

Thanks, Fredrik,

When I tried this I got the following error:

syntax error in file action.cgi at line 79, next 2 tokens "$NAME2 ~"
/<.*?>/: nested *?+ in regexp at action.cgi line 79>

-Neil

Fredrik Larsson wrote:

> $NAME2 = $NAME;
> $NAME2 ~= s/<.*?>//g;    # erases all html-tags in the string
>
> $NAME2 now contains the same as $NAME but without all html-tags
>
> /Larzon
>
> >In a perl script I have a variable, $NAME assigned to the first field in
> >each line of an ascii text file.
> >Some of these fields contain html tags <a
> >href="http://blahblahbalh>name</a> surrounding the name.
> >
> >I would like to create another variable which would be the same as $NAME
> >but with the html tags stripped, leaving
> >just the name=$NAME.
> >
> >Can somebody supply me with the correct syntax to accomplish this?
> >
> >Thanks! -Neil
> >rx@rxlist.com   http://www.rxlist.com
> >



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

Date: Fri, 09 Apr 1999 16:15:28 GMT
From: njc@dmc.uucp (Neil Cherry)
Subject: Re: Sys::Syslog
Message-Id: <slrn7gsa0s.o5.njc@dmc.uucp>

On Fri, 09 Apr 1999 13:52:29 GMT, Marc Haber wrote:
>Kozo <kozo@pobox.sk> wrote:
>>perl is This is perl, version 5.004_04 built for i386-linux
>>from perl-5.004m4-1 on RH 5.2
>
>There are some rumours of a broken perl with certain RedHat versions.
>This is known to affect majordomo.

That would explain why it doesn't work on my RH system. Sounds like it
may not be perl though as I rebuilt (fresh compile) and got the same
thing. I tried adding the missing files (p2h and a web search) but I
had no luck getting syslog working. For now I need to work on other
things so I've given up on syslog for now.

-- 
Linux Home Automation           Neil Cherry             ncherry@home.net
http://members.home.net/ncherry                         (Text only)
http://meltingpot.fortunecity.com/lightsey/52           (Graphics GB)
http://www2.cybercities.com/~linuxha/			(Graphics US)


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

Date: Fri, 09 Apr 1999 13:03:43 -0400
From: Jason <"jwelsh"@(nospam)qrtp.quintiles.com>
Subject: Re: web-based newreader?
Message-Id: <7elbtd$kbm$1@oak.prod.itd.earthlink.net>

The problem with DejaNews is that it wont let me read/post
from MY news server.

regards,
Jason

Philip Newton wrote:
> 
> Jason wrote:
> >
> > anyone know of a *web-based* perl/cgi script (even Java)
> > thats free to use that can read/post to news servers?
> > any help appreciated
> 
> Anything wrong with DejaNews?
> 
> Cheers,
> Philip
> 
> P.S. Don't bother posting to comp.lang.perl

-- 
=======================================================================
|  Jason Welsh   jason@welsh.dynip.com   |   If you think there's     |
|                                        |   good in everybody, you   |
|      http://welsh.dynip.com/           |   haven't met everybody.   |
=======================================================================



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

Date: 09 Apr 1999 11:47:32 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Richard H <rhrh@hotmail.com>
Subject: Re: why my map diff to a loop?
Message-Id: <m37lrl4wyz.fsf@joshua.panix.com>

Richard H <rhrh@hotmail.com> writes:

> print "@nums3 \n";

I suggest that, instead of printing the aggregates, you dump them,
like so:

  use Data::Dumper;
  print "\@nums3:\n", Dumper(\@nums3);

You will see the light.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Fri, 09 Apr 1999 10:14:48 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Win-32 / Unix CGI question
Message-Id: <370E3588.ED5A3B45@mail.cor.epa.gov>

Peter Jukel wrote:
> 
> Hi there
> 
> can anyone tell me if it is possible to develop a CGI perl script on a
> Windows 95 machine and run it on a UNIX web server?
> 
> Regards
> 
> Peter

Yes, you can.  But there are a few caveats.  You'll have to make sure
that any paths hard-coded into your program are changed for the unix
box.  You'll have to make sure you ftp the file in ASCII rather than
binary mode, or it will have weird ^M characters at the end of every
line.  Those kinds of things.  

Other than that, it's a breeze.  Perl is a *very* portable language.

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: 9 Apr 1999 16:21:35 GMT
From: Jonesy <jonz@rmi.nospam.net>
Subject: Re: Y2K (yes, again - sorry!)
Message-Id: <7el9ef$ff0$2@news1.rmi.net>

Matt Sergeant <matthew.sergeant@eml.ericsson.se> wrote:
:  - or alternatively I can just ignore this person...

You have my permission to ignore anything 
you receive over the internet.
I do it all the time.

Jonesy

-- 
Marvin L. Jones  jonz<AT>rmi.net
Gunnison, Colorado
266 days to go until the Year 2000 -- So what!
632 days to go until the 3rd Millennium of the C.E.


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

Date: Fri, 09 Apr 1999 10:11:26 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Y2K (yes, again - sorry!)
Message-Id: <370E34BE.7E825814@mail.cor.epa.gov>

Bart Lateur wrote:
> 
> Bill Jones wrote:
> 
> >Tell them you didn't create their script therefore you cannot make
> >claims as to whether their code is truly Y2k compliant.
> 
> Right on. Although Perl itself is fully Y2K compliant, that doesn't mean
> that it's not possiblke to write non-Y2K compliant scripts.
> 
> You cannot possibly accept responsibility to what their people do in
> Perl. They should not even expect that.
> 
> Which brings back the question: where is the garantee, black on white
> (or similar), that Perl itself is Y2K compliant? I can't even imagine
> what part of Perl could even possibly not be Y2K compliant. It doesn't
> use dates, does it? But Y2K compliance has become such a buzzword, that
> people can't even seem to think straight about it any more.
> 
>         Bart.

But it was only last month in this very newsgroup that we saw someone
post code that included something like:

"Year: 19".$year

Remember?  I'm sure a *lot* of people have written non-compliant code.
[oops, typed 'coed' before re-reading this - that's a different sort of
non-compliance.]  And when their code blows up, it certainly won't be
*their* fault.

About 12 years ago, a Florida construction company used Lotus 1-2-3
to do their calcs for submitting a bid.  They used the sum() function
wrong and missed some of the big expenses.  They won the bid but 
couldn't afford to build at the price they had submitted.  So, of
course, they sued Lotus.

Welcome to big-time business.  :-)

David
-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: 9 Apr 1999 16:52:22 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Yet another regexp question
Message-Id: <slrn7gsc26.p31.sholden@pgrad.cs.usyd.edu.au>

On Fri, 09 Apr 1999 10:21:43 -0500, Clinton Wolfe <clwolfe@indiana.edu> wrote:
>I'd like to find all occurences of the string "<img" that don't have
>"alt" before the ">".  (Hmmm... what am I up to, one wonders? :)
>
>$content is the entire contents of an HTML file.
>$linenum is the current line number ( I track this so I can record at
>which line I got a match).
>$current is the contents of the file from $linenum to the end of the
>file.
>(ineffiecent, but see the footnote at the end).
>I keep my regexp's in an PostgreSQL database, so we would typically have
>something like
>
>$reg = "(?is)^[^\n]*<img.*?>"
>
>which should find each img tag.
>
>It works like this:
>	# $reg magically springs forth from the database
>	$linenum = 0;
>	while ($content =~ /^.*$/gm) {
>		$curr = $& . $';             #ghastly performace hit here

You could probably just do a /g match for your final regex and have it
find all the <img...> parts of the whole string, instead of doing so much
copying. You can get line numbers by seeing where the newlines in the 
string are - and just look it up for each match... 

>		$linenum += 1;
>		if ($curr =~ /$reg/) {
>			#record the fact that I got a match on $linenum
>		}
>	}
>
>To at all img's without alt's, I tried 
>
>$reg = "(?is)^[^\n]*<img.*?[^(alt)].*?>"

The solution is not to use a regex since you are in effect parsing HTML...
So use HTML::Parser or similar...

If you must use a regex...

Why not just use a regex to capture the entire <img ...> tag and then
do some further texting to see if it contains the text alt? Doing 
everything in one regex is all well and good, but often it makes the
regex a little hard to read.

Anyway I'll have a quick crack at this anyway (some sample text would have
been nice... just a couple of +ve and -ve cases...)

A first guess would be :

(?i)^.*<img(?:(?!alt)[^>])*>
                ^^^^^^^^^^^^^
Match any number of characters as long as the string alt is not in there.

This gets some false negatives though...  <img src="salty"> for example since
there is an 'alt' present.

So we get around the quotes by ignoring quoted text, by making an alternation
with "[^"]" and '[^']' but that doesn't allow escapes (I don't know if HTML
does either... but assuming it does...). So to allow those we to be even 
more complex...

Then you have the problem of catching <img...> tags that aren't really tags,
because they are in comments, or inside the quotes of another tag...

Of oucrse if you know the HTML is simple enough. Or don't mind having lots
of false positives and negatives when people do things you haven't thought of
you could try something like :

(?i)^.*<img((?!alt)[^>"']|"[^"]*"|'[^']*')*>

Which is what I had above with the alternatives for catching the quotes added,
so <img src="salty"> is no longer a match. However, it doesn't allow escapes
inside the quotes so you can't have "salt\"y" for example.

But seeing it's almost 3am over here,I'm not going to add that...

Note: The regex might not work properly, as I said it's pretty late and
I only did some simple tests...

-- 
Sam

It has been discovered that C++ provides a remarkable facility for
concealing the trival details of a program--such as where its bugs are.
	--David Keppel


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

Date: 09 Apr 1999 12:05:37 -0400
From: Jonathan Feinberg <jdf@pobox.com>
To: Clinton Wolfe <clwolfe@indiana.edu>
Subject: Re: Yet another regexp question
Message-Id: <m3yak13hke.fsf@joshua.panix.com>

Clinton Wolfe <clwolfe@indiana.edu> writes:

> I'd like to find all occurences of the string "<img" that don't have
> "alt" before the ">".  (Hmmm... what am I up to, one wonders? :)

You therefore do not want to use a regex, but rather a parser.

   #!/usr/bin/perl -w
   require 5.004;
   use strict;
   BEGIN {
     package myparser;
     use base 'HTML::Parser';
     sub start {
       my ($self, $tag, $attr, $attrseq, $origtext) = @_;
       return unless $tag =~ /img/i;
       print qq"$origtext does not have an alt tag\n"
	 unless $attr->{alt};
     }
   }

   package main;
   my $p = new myparser;
   $p->parse(<<FOO);
     <html><head></head><body>
	<img src="bar"> <img alt="yadda" src="dada">
     </body></html>
   FOO
   __END__

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


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

Date: Fri, 09 Apr 1999 12:31:23 -0500
From: Clinton Wolfe <clwolfe@indiana.edu>
Subject: Re: Yet another regexp question
Message-Id: <370E396B.2A3B5AB9@indiana.edu>

Thanks for the help, everyone.
Using your suggestions for the regexp, something like
$reg = "(?is)^[\n]*<img(?!([^>])*alt)";
works just fine.

Yes, it is perverse to do this using regexp's.  I do use a Parser to
find links in the HTML (and then to check them).
	I choose to stick with regexp's because I'd like to be able to let the
robot run "forever", looping over itself.  With a delay of 2 minutes
between GET's, it will take the robot about 4 days to traverse my site
(of about 2500 html files), at which point it starts over.  Using a
parser would require me to alter the script, stop the robot, and restart
it every time I change my mind about what I'm looking for in the files. 
True, this time I'm looking for properties of an HTML tag.  But I may
also want to look for all occurences of the word Ultrix throughout the
website, regardless of where it appears in the file.
	By storing regexps as strings in a PostgreSQL database, I can alter
what I'm looking for on the fly.  The downside is that I will have some
truly horrific regexp's in the database.  
	HTML::Parser would be a much more elegant solution, but I don't see how
I could get the same "on the fly" functionality.  Plus, this way I get
to exercise my regexp writing ability.  A good thing.

	The robot stores what it finds back in the database.  So my next step
is to write a script that _uses_ this information to alter the HTML
files.  For example, the script could use the "missing alt" information
to insert alt attributes into img tags, using a table that says what alt
tag should go with which image file.  


Clinton Wolfe wrote:
> 
> I'd like to find all occurences of the string "<img" that don't have
> "alt" before the ">".  (Hmmm... what am I up to, one wonders? :)
> 
> $content is the entire contents of an HTML file.
> $linenum is the current line number ( I track this so I can record at
> which line I got a match).
> $current is the contents of the file from $linenum to the end of the
> file.
> (ineffiecent, but see the footnote at the end).
> I keep my regexp's in an PostgreSQL database, so we would typically have
> something like
> 
> $reg = "(?is)^[^\n]*<img.*?>"
> 
> which should find each img tag.
> 
> It works like this:
>         # $reg magically springs forth from the database
>         $linenum = 0;
>         while ($content =~ /^.*$/gm) {
>                 $curr = $& . $';             #ghastly performace hit here
>                 $linenum += 1;
>                 if ($curr =~ /$reg/) {
>                         #record the fact that I got a match on $linenum
>                 }
>         }
> 
> To at all img's without alt's, I tried
> 
> $reg = "(?is)^[^\n]*<img.*?[^(alt)].*?>"
> 
> which of course didn't work, it matched every img.  (which it should, on
> further reflection!)
> I'm thinking I may need to use (?!...) but my understnading of this is
> foggy at best.
> 
> Any advice about how to do this regexp?
> I have the ram, the llama, and the camel books.
> 
> Thanks,
> Clinton Wolfe
> 
> FOOTNOTE:  I'm not concerned about performance.  Here's why: this will
> be run inside a web robot script (using, of course LWP::RobotUA) with
> the delay set to at least 2 minutes.  Just before it does an HTTP GET,
> the script forks, with one child waiting 2 minutes to do the GET and the
> other child processing the last html file.  So I'll have a good 2
> minutes to run this!
>         Memory, CPU aren't issues either - I'm running this script on my Sun
> workstation, which really doesn't have anything else to do.
>         Yes, I know using $' even once will slow down the whole script.  Advice
> on how to avoid its use would be welcome.
> 
>         Advice on how to make the script in general more effecient is welcome,
> but it's just not a high priority.


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5341
**************************************

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