[13749] in Perl-Users-Digest
Perl-Users Digest, Issue: 1159 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 23 15:05:26 1999
Date: Sat, 23 Oct 1999 12: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: <940705510-v9-i1159@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 23 Oct 1999 Volume: 9 Number: 1159
Today's topics:
Re: (PERL/XML):Subroutine access by Reference. (Arved Sandstrom)
Re: authentification with perl/cgi? <gellyfish@gellyfish.com>
Re: Can't do "make" on perl module <dutch@mindspring.com>
Re: CPAN modules in RPM format. <carville@cpl.net>
Re: CPAN modules in RPM format. (Brett W. McCoy)
Re: CPAN modules in RPM format. <elaine@chaos.wustl.edu>
Re: CPAN modules in RPM format. <elaine@chaos.wustl.edu>
file accessing problem <rc3csb@usa.net>
Re: file accessing problem (Brett W. McCoy)
Re: file sorting <lr@hpl.hp.com>
Re: finding date and time <lr@hpl.hp.com>
Re: How can I join two hashes? <ltl@rgsun40.viasystems.com>
Re: How can I join two hashes? <gellyfish@gellyfish.com>
Re: How can I make to print the times that I input wor <gellyfish@gellyfish.com>
Re: How to read from Game Port in Win32 <carvdawg@patriot.net>
Re: how to use flock right? <gellyfish@gellyfish.com>
Re: I'd like to know what are those CGIs and ASPs <prophile@netvision.net.il>
Re: I'd like to know what are those CGIs and ASPs (Brett W. McCoy)
Re: I'd like to know what are those CGIs and ASPs <gellyfish@gellyfish.com>
Is it the list or the re? (Andy Smith)
Re: Is there a module to parse a HTML-file like this? <gellyfish@gellyfish.com>
Re: Mac text files vs PC text files -- How are they dif (Arved Sandstrom)
Re: Module won't make on linux? <dutch@mindspring.com>
Re: not Perl, but please read! <gellyfish@gellyfish.com>
Re: Parsing botanical descriptions <elaine@chaos.wustl.edu>
Re: perl on windows ? <schapel@cs.uiowa.edu>
Random Number Fungus@hello.net
Re: Random Number <jeffp@crusoe.net>
Re: Random Number Fungus@hello.net
Re: Random Number <jeffp@crusoe.net>
Retrieving directory contents (newbie) <acacia@online.no>
Re: Retrieving directory contents (newbie) (Brett W. McCoy)
Returning a hashref <dwb1@home.com>
Re: SGML/HTML parsing tool (Tad McClellan)
Re: SIMPLE scripts to help me learn??? (Brett W. McCoy)
Re: SIMPLE scripts to help me learn??? (Tad McClellan)
Re: Want to CGI for checking Domain name at Internic <michael@cermak.com>
Re: what is SHTML ? (Brett W. McCoy)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 23 Oct 1999 15:41:35 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: (PERL/XML):Subroutine access by Reference.
Message-Id: <Arved_37-2310991541360001@dyip-18.chebucto.ns.ca>
In article <38102EF1.2CC4FE2D@cisco.com>, Subalakshmi GanapathiRaman
<sganapat@cisco.com> wrote:
> Thanks a lot for the information.
> Where can I get latest version of XML::Parser (XML-Parser-2.27) ?
>
> Can I integrate this with the Perl 5.004_04 library that I am using ,
> or should I be necessarily using 5.005_xx ?
>
> This module would only be an add-on to the existing
> Perl library (that by default does not come with the XML related libraries
> ?!?), isn't it ?
> Please correct me if I am wrong.
>
This is a system-dependent question. For Unixes you get it from the CPAN
(just follow the CPAN link off the www.perl.com homepage) under modules.
For Windows ActiveState Perl use the PPM (Perl Package Manager). For MacOS
refer to http://pudge.net/mmp/.
The module, like any other XS module, can be statically linked into a new
Perl executable or built as a shared library (.so). The latter is usual.
The guts of the 'use' statement take care of loading up the shared
library.
As of right now Perl 5.004 is still OK for XML-Parser. Of course, it's not
a bad idea to move up to 5.005_3 anyway.
Arved
------------------------------
Date: 23 Oct 1999 11:04:19 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: authentification with perl/cgi?
Message-Id: <7us4nj$ee1$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 18:32:02 +0200 Alexander Knack wrote:
> hi,
> i want a perl-CGI application to send an authorisationrequest to the
> client.
> i don't want to create a .htaccess file or something like this - the
> perlscript
> should handle the authentification. my problem is: i don't actually know
> how
> to do this.
Please read the CGI FAQ at <http://www.webthing.com/tutorials/cgifaq.html>
wherein there is a section that deals with this particular question. If
after you have read that and you still have questions you will almost
certainly want to ask in the group comp.infosystems.www.authoring.cgi as
most of this is general to CGI rather than Perl specific.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 23 Oct 1999 14:06:51 -0400
From: "Dutch McElvy" <dutch@mindspring.com>
Subject: Re: Can't do "make" on perl module
Message-Id: <7ust0q$39s$2@nntp1.atl.mindspring.net>
Thanks,
Make was not installed on my system
----------
In article <7uqrpa$ipj$1@nntp2.atl.mindspring.net>, "Dutch McElvy"
<dutch@mindspring.com> wrote:
> Subject: Can't do "make" on perl module
>
> I can run perl programs on my linuxppc distribution but for some reason when
> I try to install a perl module, I can do a "Makefile.PL" but when I try to
> do a make for the perl module I get a bash "make" command not recognized.
>
> I can install the same module fine on an SGI box. The linux is running perl
> 5.005
>
> Can anyone tell me what I can do to get this module installed?
>
> An email reply is apppreciated,
>
> Thanks,
>
> dutch@mindspring.com
------------------------------
Date: Sat, 23 Oct 1999 16:04:43 +0000
From: Stephen Carville <carville@cpl.net>
Subject: Re: CPAN modules in RPM format.
Message-Id: <3811DC9B.2A8BB84A@cpl.net>
Jonathan Stowe wrote:
>
> On Sat, 23 Oct 1999 08:59:11 +0000 Stephen Carville wrote:
> > Last night I was trying to locate a perl module on rufus.w3.org but
> > the CPAN archives seem to have vanished. These modules were all in
> > RPM format and so were very convenient. Does anyone know what
> > happened?
> >
>
> I would not recommend using RPM to install Perl modules as it cannot take
> into account local differences in configuration and must by definition
> be distributing binaries of any XS components which would be sensitive
> to small differences in the runtime environment. Unless you made
> some very bad choices while installing Linux you should have everything you
> need to build the module from scratch - and quite honestly I dont see
> what is difficult in
I always build from the source RPMs so I avoid the problem of
incompatible binaries. As you say, is not difficult to build from the
tar.gz files but rpm gives me better and easier revision control.
That is a very big advantage if I am supporting perl scripts on
several similarly configured machines spread over the entire world.
The dependency check alone can save me multiple visits to the same
machine during an upgrade.
Besides, RPM -- for better or worse -- is becoming the Linux
"standard" for package distribution.
> perl Makefile.PL
> make
> make test
> make install
Take a look in a .spec file. This is what an RPM build does.
> or even
>
> perl -MCPAN -e'install "Some::Module"'
>
> /J\
>
> --
> Jonathan Stowe <jns@gellyfish.com>
> <http://www.gellyfish.com>
> Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
Anyway, I found the CPAN rpm archives at:
ftp://ftp.cdrom.com/pub/linux/redhat/powertools/CPAN/
--
Stephen Carville
carville@cpl.net
----------------------------------------------------
There are two kinds of people: those who do the work and those
who take the credit. Try to be in the first group; there is less
competition there.
Indira Gandhi
------------------------------
Date: Sat, 23 Oct 1999 16:15:11 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: CPAN modules in RPM format.
Message-Id: <slrn813o16.sf9.bmccoy@moebius.foiservices.com>
Also Sprach Stephen Carville <carville@cpl.net>:
>I always build from the source RPMs so I avoid the problem of
>incompatible binaries. As you say, is not difficult to build from the
>tar.gz files but rpm gives me better and easier revision control.
>That is a very big advantage if I am supporting perl scripts on
>several similarly configured machines spread over the entire world.
>The dependency check alone can save me multiple visits to the same
>machine during an upgrade.
Don't the latest versions of CPAN do dependency checks, if you select it
to do followups automatically when installing software? Not only that, it
will automatically install any missing modules for you.
>Besides, RPM -- for better or worse -- is becoming the Linux
>"standard" for package distribution.
That remains to be seen. I used to like RPM at first, but it got be a
royal PITA for me, and I realized that you need to do *everything* as an
RPM, or else subsequent installs will fail even if the correct software is
in place but not installed via RPM. I've installed many RPMs that failed
because it thought /usr/bin/perl didn't exist, despite the fact it did --
it just wasn't in the RPM database. Hence, I've dropped out of the Red
Hat upgrade cycles and just do everything as tarballs or CPAN
installations.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Sat, 23 Oct 1999 13:47:01 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: CPAN modules in RPM format.
Message-Id: <3811F408.FFCCA322@chaos.wustl.edu>
Stephen Carville wrote:
> Last night I was trying to locate a perl module on rufus.w3.org but
> the CPAN archives seem to have vanished. These modules were all in
> RPM format and so were very convenient. Does anyone know what
> happened?
RPM is a RedHat linux package format much like Solaris' pkgadd format.
These are not part of CPAN, but something else entirely. Perhaps send
mail to the webmaster of that site and enquire as to what happened.
e.
------------------------------
Date: Sat, 23 Oct 1999 13:51:08 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: CPAN modules in RPM format.
Message-Id: <3811F4FF.2FC6747D@chaos.wustl.edu>
Jonathan Stowe wrote:
> I would not recommend using RPM to install Perl modules as it cannot take
> into account local differences in configuration and must by definition
Oh, I don't know, there aren't many modules where actual site name and
such are important as long as the platform and OS are the same.
> perl -MCPAN -e'install "Some::Module"'
I love the CPAN shell too, but try it on 500+ machines for a
distribution...sometimes it is very convenient to have a package that
will dist and install overnight. :)
e.
------------------------------
Date: Sun, 24 Oct 1999 00:38:04 +0800
From: "csb" <rc3csb@usa.net>
Subject: file accessing problem
Message-Id: <3811e46f.0@news.highway1.com.au>
hi,
I have a file stores users information and that file might access by
different users at the same time..so when both users trying to open that
file at the same time.... error occur on either side. Is there any method in
perl that can block another user to access the file while some1 using it?
thx for help
------------------------------
Date: Sat, 23 Oct 1999 17:06:03 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: file accessing problem
Message-Id: <slrn813r0j.sft.bmccoy@moebius.foiservices.com>
Also Sprach csb <rc3csb@usa.net>:
> I have a file stores users information and that file might access by
>different users at the same time..so when both users trying to open that
>file at the same time.... error occur on either side. Is there any method in
>perl that can block another user to access the file while some1 using it?
Yes, the flock function can help you here. See perldoc -f flock AND the
manpage for the C function flock also.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Sat, 23 Oct 1999 08:51:31 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: file sorting
Message-Id: <MPG.127b795ebcb9b68d98a10a@nntp.hpl.hp.com>
In article <7us8u8$eh7$1@gellyfish.btinternet.com> on 23 Oct 1999
12:16:08 -0000, Jonathan Stowe <gellyfish@gellyfish.com> says...
+ On Fri, 22 Oct 1999 21:41:51 -0400 Bob Walton wrote:
+ > "V.B." wrote:
+ > ...
+ >> i have a file,,, myfile.ext, it contains multiple single line
+ >> entries, each entry contains 7 ";" delimited values,,, id like to
+ >> sort the file by the 5th value of each entry,,,. if read the sort
+ >> faq and perlman , but it only confused me ,,, if anyone
+ >> can point me in the direction of a good example, id be overjoyed!
+ > ...
+ > Try:
+ >
+ > open IN,"myfile.ext" or die "Oops, open trouble, $!\n";
+ > print for(sort {(split /;/,$a)[4] cmp (split /;/,$b)[4]} <IN>);
+ > close IN or die "Oops, close trouble, $!\n";
+
+ There is that of course but for a larger file the overhead of calling
+ the splits in the comparison sub is going to drive the execution
+ time of this way up :
+
+ print for ( map { $_->[1] }
+ sort { $a->[0] cmp $b->[0] }
+ map { [(split /;/)[4],$_ ] }
+ <IN> );
Well, I've hung back watching you guys develop the sorting algorithm,
probably past the needs of this poster (who said he couldn't grok the
FAQ). But now that the Schwartz has appeared, I might as well show
everyone else a GRP (Guttman-Rosler Packed) sort also. For the ultimate
in performance at a reasonable price:
print # for??? -- 'print' can handle the list directly!
map substr($_, 1 + rindex $_, "\0") =>
sort
map +(split /;/)[4] . "\0$_" =>
<IN>;
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 23 Oct 1999 09:18:03 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: finding date and time
Message-Id: <MPG.127b7f94215215a898a10b@nntp.hpl.hp.com>
In article <3811C4B2.275129B6@gate.net> on Sat, 23 Oct 1999 10:22:42 -
0400, Aaron Walker <amwalker@gate.net> says...
> I would think that this question would be a FAQ, but I did not come
> across it in the comp.lang.perl.misc FAQ. I am trying to find the date
> and time. I read somewhere to use the localtime() function. I found
> out that this is not formatted for about, since it is just a series of
> numbers. How would I format the output of localtime()? Is there a
> better way to discover the data and time?
1. Read the documentation for localtime() [what a revolutionary
thought!]. You will discover what it produces in scalar context.
2. Read the documentation for sprintf. You will discover how to format
'a series of numbers' into something you want.
3. Read the documentation for POSIX::strftime. You will discover how
to create directly any formatted date/time string.
Now let's factor the above.
Read the documentation for ...
You will discover ...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 23 Oct 1999 16:12:56 GMT
From: lt lindley <ltl@rgsun40.viasystems.com>
Subject: Re: How can I join two hashes?
Message-Id: <7usmq8$bce$1@rguxd.viasystems.com>
Dan Sugalski <dan@tuatha.sidhe.org> wrote:
:>Erik van Roode <newsposter@cthulhu.demon.nl> wrote:
:>> Tom Phoenix <rootbeer@redcat.com> wrote:
:>>> On 22 Oct 1999, Erik van Roode wrote:
:>>>> my %hash = (%hash1, %hash2);
:>>> For larger hashes, this should be equivalent, but (potentially much)
:>>> faster.
:>>> my %hash = %hash1;
:>>> @hash{ keys %hash2 } = values %hash2;
:>> timethese(100, {
:>> add1 => sub { my %hash = (%hash1, %hash2); },
:>> add2 => sub { my %hash = %hash1; @hash{ keys %hash2 } = values %hash2; },
:>> });
:>> ----------------------------------------------------------------
:>> dantest0, perl5.00404
:>> Benchmark: timing 100 iterations of add1, add2...
:>> add1: 16 secs (16.91 usr 0.03 sys = 16.94 cpu)
:>> add2: 21 secs (20.02 usr 0.01 sys = 20.03 cpu)
:>Now that's interesting. The second method should take up significantly less
:>memory at runtime (about half, if the hashes are of equivalent size) which
:>could make a difference if they were big enough to cause some paging
:>activity.
keys %hash2; #iterates over the keys to create list
values %hash2; # iterates over the keys and gets the values to create list
Two separate loops to iterate through the hash and create 2 lists as
opposed to a straight assignment which would only iterate once to
create one list. So add2 would only be faster if it avoided
thrashing.
I'm only guessing. I haven't looked. A dangerous gamble in c.l.p.m,
but I like my chances. :-)
--
// Lee.Lindley /// I used to think that being right was everything.
// @bigfoot.com /// Then I matured into the realization that getting
//////////////////// along was more important. Except on usenet.
------------------------------
Date: 23 Oct 1999 13:00:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How can I join two hashes?
Message-Id: <7usbgo$es3$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 14:14:39 -0700 Tom Phoenix wrote:
> On 22 Oct 1999, Erik van Roode wrote:
>
>> my %hash = (%hash1, %hash2);
>
> For larger hashes, this should be equivalent, but (potentially much)
> faster.
>
> my %hash = %hash1;
> @hash{ keys %hash2 } = values %hash2;
>
Whilst the original poster didnt mention it - none of these solutions
explicitly takes into account what to do if there are duplicate keys - Ilya I
think alluded to it that the order of the hashes in the simple
assignment is significant here, in this method one could swap over the
two hashes (i.e. copy %hash2 to %hash first ), if some more intelligent
handle was required other than this simple precedence then a foreach
loop might be required - the poster may have other criteria for which
values should be overwritten.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 23 Oct 1999 12:36:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: How can I make to print the times that I input word ?
Message-Id: <7usa3i$eqp$1@gellyfish.btinternet.com>
On Sat, 23 Oct 1999 20:15:31 +0900 Yeong Mo/Director Hana co. wrote:
>
>>This seems illogical. In any input, there's an infinite number of
>>words that don't occur. Or maybe you only have a set of words that are
>>valid input?
>>
>>For counting the number of words (for some definition of "word"), try:
>>
>> #!/usr/bin/perl -w
>>
>> use strict;
>> my %count;
>>
>> while (<DATA>) {
>> $count{$_}++ foreach split;
>> }
>>
>> print "$_|$count{$_}\n" foreach sort keys %count;
>>
>> __DATA__
>> aaa bbb eee
>> bbb bbb
>> ccc aaa
>> bbb aaa
>> aaa
>>
>>prints:
>>
>> aaa|4
>> bbb|4
>> ccc|1
>> eee|1
>>
>>--
>>Marcel, Perl Padawan
>>sub AUTOLOAD{$_=$AUTOLOAD;s;.*::;;;y;_; ;;print}&Just_Another_Perl_Hacker;
>
>
> Thank you Marcel
>
> There is little of your misunderstanding;
> I want print only one aaa and bbb....
> and when I try aaa or bbb again from the from method
> I don't want it to be printed again like;
> aaa
> bbb
> bbb
> aaa
>
> I hope it to be printed
> aaa|2
> bbb|2
>
But this is *exactly what Marcels code does - did you actually try it ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 23 Oct 1999 12:21:51 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: How to read from Game Port in Win32
Message-Id: <3811E09F.828EE21F@patriot.net>
You want the Win32::SerialPort module
dawgeatdawg@my-deja.com wrote:
> Hope this is the right place for a rookie question: Can someone show me
> code that reads from the game port or joystick with Activeperl?
>
> thanks in advance,
> dwg
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 23 Oct 1999 12:45:44 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to use flock right?
Message-Id: <7usalo$erq$1@gellyfish.btinternet.com>
On Sat, 23 Oct 1999 12:49:28 +0200 Yuval wrote:
> Is this pieace of code is the correct way to use flock?
>
> open(FILE,"$file.txt");
> flock(FILE,2);
> $count = <FILE>;
> close(FILE);
>
> is it the same for writing to a file?
Except of course you will want to open the file for writing:
perldoc -f open
You also will want to ensure that the filehandle is valid before you
use it :
open(FILE,"$file.txt") || die "Couldn't open $file.txt - $!\n";
I am assuming that the '.txt' is a string to be appended to the variable
$file - if it isnt then you will need to fix $file.txt to be a valid
identifier and then drop the quotes. Of course you *do* need the quotes
when you are opening the file for writing for instance ...
> BTW what is the "2" after the FILEHANDLE?
perldoc -f flock will give you the answer.
most modern code will use:
use Fcntl qw(:flock);
to import the correct constants for flock() operations.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 23 Oct 1999 15:30:27 GMT
From: Profisios <prophile@netvision.net.il>
Subject: Re: I'd like to know what are those CGIs and ASPs
Message-Id: <s13l4je585928@corp.supernews.com>
James Peregrino wrote:
>
>
> Profisios <prophile@netvision.net.il> writes:
>
> > I'd like to know what are those CGI and ASP scirpts and what languages
it
> > concerns.
>
> First of all these *independent* of Perl.
>
> A CGI is a program run on web server in a special environment. It
> can be written in any language. Find the newsgroup on CGI programming
for
> more about this.
>
> ASP is Active Server Pages, a technology developed by Microsoft for
> Microsoft's web sever.
> Go to Microsoft's web site for more on this.
Which means I cannot use ASPs on a linux server, Right?
>
> -James
> --
> James Peregrino
> Harvard Div. Continuing Education
Thanks james,
Nice to have one decent response.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Sat, 23 Oct 1999 15:59:50 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: I'd like to know what are those CGIs and ASPs
Message-Id: <slrn813n4e.sf2.bmccoy@moebius.foiservices.com>
Also Sprach Profisios <prophile@netvision.net.il>:
>> ASP is Active Server Pages, a technology developed by Microsoft for
>> Microsoft's web sever.
>> Go to Microsoft's web site for more on this.
>
> Which means I cannot use ASPs on a linux server, Right?
There's a perl module called Apache::ASP which uses perl as the scripting
language, and this is intended to run under mod_perl (perl.apache.org)
Check out http://www.nodeworks.com/asp/ for more details.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: 23 Oct 1999 11:12:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: I'd like to know what are those CGIs and ASPs
Message-Id: <7us577$ee4$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 18:30:19 GMT Profisios wrote:
> I'd like to know what are those CGI and ASP scirpts and what languages it
> concerns.
>
Programs that use the Commom Gateway Interface can be written in any
language that supports the input and output requirements - please see:
<http://hoohoo.ncsa.uiuc.edu/cgi>
Questions about CGI in general are best asked in the newsgroup:
comp.infosystems.www.authoring.cgi
Active Server Pages are a Microsoft thing - in principle they can use
any language that is available as an OLE Scripting Engine (or whatever)
currently these include Javascript,VBScript and Perl - you can find out
more about this from the microsoft website, There are newsgroups in
the microsoft.* hierarchy where you can ask questions about ASP.
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 23 Oct 1999 18:04:15 GMT
From: asmith@hsonline.net (Andy Smith)
Subject: Is it the list or the re?
Message-Id: <3811f89f$0$70842@news.hsonline.net>
All I really want to do is pull some info from syslog.
I'm sure there are scripts out there to do this, but
I need the practice (badly as you can see). MYFILE is the
sytem log, and NEWFILE a log that the info will go into.
I am pretty sure the re is what is screwy. Perl -w tells me
there is an error near "\s+\d+)\s+(".
while(my $linage = <MYFILE>)
{
if (s/^\w+\s+\d+\S+\s+?/);
list($date, $time, $service) = ($linage =~
s/^(S+\s+\d+)\s+(\d{2}:\d{2}:\d{2})\s+(S+:).*?/);
print(NEWFILE "$date $time $service\n");
};
--
----Andy Smith ------ reply to: ----------------
-KB9KQD- (asmith@hsonline.net)
" Everybody knows that the dice are loaded,
Everybody rolls with their fingers crossed;
Everybody knows that the war is over,
Everybody knows that the good guys lost..."
-Leonard Cohen-
------------------------------
Date: 23 Oct 1999 10:59:42 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Is there a module to parse a HTML-file like this?
Message-Id: <7us4eu$eds$1@gellyfish.btinternet.com>
On Fri, 22 Oct 1999 18:53:28 +0200 Markus Hasenöhrl" wrote:
> Jonathan Stowe wrote in message <38107a83_1@newsread3.dircon.co.uk>...
>>Markus Hasenöhrl <MHasenoehrl@de.lhsgroup.de> wrote:
>>>
>>> I'am looking for a simple way to extract links from a HTML-file in such a
>>> way that a Text/HREF- hash is build, i.e. from a HTML file containing
> links
>>> like
>>
>>HTML::LinkExtor ....
>>
> As far as I understand it, HTML::LinkExtor does not do exactly what I want.
> Ok - it finds the links but how do I set up a callback to assciate the TEXT
> of the link with the HREF?
> I mean, whenever HTML::LinkExtor sees a construct like
>
> <A HREF=/location1>text1</A>
>
> it calls a callback having seen the <A ...> but BEFORE it has seen the
> "text1" or am I wrong?
>
> Could you please provide me with a concrete example of how to achive that
> with HTML::LinkExtor ?
>
No I cant do that because it doesnt work like that - however here is a
simple example using HTML::Parser that does do that - it could be
improved however as it stands it will only store the URL once because
it uses a hash :
#!/usr/bin/perl -w
use strict;
package GetUrls;
use vars qw(@ISA);
@ISA = qw(HTML::Parser);
require HTML::Parser;
use strict;
my ($got_href,$cur_url, %urls);
my $parser = new GetUrls;
$parser->parse_file($ARGV[0]);
for (keys %urls)
{
print "$_ $urls{$_}\n";
}
sub start
{
my($self,$tag,$attr,$attrseq,$orig) = @_;
if ( $tag eq 'a')
{
if ($cur_url = $attr->{href})
{
$got_href++;
}
}
}
sub end
{
my ($self,$tag) = @_;
$got_href-- if ($tag eq 'a' && $got_href )
}
sub text
{
my ($self,$text ) = @_;
if ($got_href )
{
$text =~ s/^\s+//;
$text =~ s/\s+$//;
$urls{$cur_url} .= $text;
}
}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 23 Oct 1999 15:58:56 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: Mac text files vs PC text files -- How are they different?
Message-Id: <Arved_37-2310991558560001@dyip-18.chebucto.ns.ca>
In article <38118006.31989478@news.supernews.com>, musicstack@hotmail.com wrote:
> I am stumped here. I have two text files. Both are the same ASCII
> text file, but one was saved on a MAC and the other on a PC.
>
> I have FTP'ed these two files to my unix server and I now I am trying
> to parse each file and print the first line of each file using the
> following code:
>
> #!/usr/bin/perl
>
> open (F,"PC_file.txt");
> $a=<F>;
> print "$a\n\n";
>
> open (D,"MAC_file.txt");
> $e=<D>;
> print $e;
>
> when I run the above program, I get one line of Text with the PC
> version of the file, but with reading the MAC text file, I get the
> whole file printed out and not one line of text. I figured this all
> had something to do with MACs and PCs using different end of line
> characters, so I checked with my favorite hex editor and it ends up
> the end of line characters are both the same for each of the two
> different files. They are both '0D 0A'. So this leaves me
> stumped.
>
> Could someone kindly tell me how to read one line text at a time with
> a MAC text file with out reading in the whole file in? Is it
> possible?
>
If both files have 0xD 0xA (CR LF) line-ends, on whatever platform you're
looking at them on, they are PC. Unix has 0xA (LF), and Mac text files
have 0xD (CR) line-endings.
The Perl convention is that '\n' represents OS specific newline. So, if
you haven't caught line-end conversions when saving in your favourite text
editor (and certainly on both MacOS and Windows, the better text editors
like Ultraedit and Alpha read and write DOS, MAC and UNIX), or when
FTP'ing, just use something like
perl -i.bak -pe 's/\015\012?/\n/g;' file > newfile
to convert MAC or DOS to Unix.
You can always fiddle $/ also, but I find it easier just to make sure that
your text files arrive in the system in the proper format to start with.
Arved Sandstrom
------------------------------
Date: Sat, 23 Oct 1999 14:06:04 -0400
From: "Dutch McElvy" <dutch@mindspring.com>
Subject: Re: Module won't make on linux?
Message-Id: <7ussvb$39s$1@nntp1.atl.mindspring.net>
Thanks for the replies,
For some reason make was not installed.
----------
In article <slrn813j76.sdh.bmccoy@moebius.foiservices.com>,
bmccoy@foiservices.com (Brett W. McCoy) wrote:
> Also Sprach Dutch McElvy <dutch@mindspring.com>:
>
>>Anyone have any idea why I can't do a make for a module I am trying to
>>install on my linux box?
>>
>>This same module installs fine on my other unix boxes.
>>
>>The Makefile.PL script seems to work but I can't get make to work.
>
> Do you have make installed on your system?
>
> --
> Brett W. McCoy bmccoy@foiservices.com
> Computer Operations Manager (Alpha Geek) http://www.foiservices.com
> FOI Services, Inc./DIOGENES 301-975-0110
> ---------------------------------------------------------------------------
------------------------------
Date: 23 Oct 1999 11:52:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: not Perl, but please read!
Message-Id: <7us7i7$efn$1@gellyfish.btinternet.com>
On Sat, 23 Oct 1999 05:20:26 GMT yoga9900@my-deja.com wrote:
> This is a breaking story: http://www.msnbc.com/news/xxxxxx.asp?cp1=1
>
> Also: http://www.xxxxxxxx.com/groups/yogaville.html
>
> I've been researching this group since I first got a flyer from the
> group of demonstators outside the Integral Yoga Institute in New York
> City last week.
<snip sundry bollocks>
I feel an abuse complaint to Deja news coming on ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 23 Oct 1999 14:04:44 -0400
From: Elaine -HFB- Ashton <elaine@chaos.wustl.edu>
Subject: Re: Parsing botanical descriptions
Message-Id: <3811F82F.88EACD9C@chaos.wustl.edu>
[courtesy cc sent to original author]
jmvanel@my-deja.com wrote:
> I want to parse botanical descriptions to obtain an XML file.
> I think of using PERL version of lex and yacc, with a simple grammar
> for sentences with ,;. delimitors, plus some rules about nouns and
> adjectives.
>
> Has someone done something approaching?
Are you familiar at all with Tropicos? We used to do it with gopher but
now they have made a nice web interface for it at
http://mobot.mobot.org/Pick/Search/pick.html (yes, for all the old farts
in the audience, pick means what you fear it might :)
I am sure that there is some standard for the representation of
botanical information these days. Mobot is a good place to enquire about
this since they are the largest research institution of its kind in the
US. The Harvard Herbarium is smaller, but also offers some of its
resources on-line http://www.herbaria.harvard.edu/Libraries/gray.html
Perl is perfectly suited for the job. Enjoy.
e.
------------------------------
Date: Sat, 23 Oct 1999 12:12:33 -0500
From: Steve Chapel <schapel@cs.uiowa.edu>
Subject: Re: perl on windows ?
Message-Id: <3811EC81.FF600777@cs.uiowa.edu>
Fred Chan wrote:
>
> How can I install module into perl ?
> I can not make from windows ?
>
> perl makefile.pl <-----OK
> make <------ file is not find ...
> make test < ---- file is not find
>
> Thanks
A DOS/Windows port of make is available from http://www.delorie.com/
------------------------------
Date: Sat, 23 Oct 1999 14:10:27 -0400
From: Fungus@hello.net
Subject: Random Number
Message-Id: <nPgROBZqJFgLqpX9I3BKOMl9tway@4ax.com>
Hi,
I need a good algorithm that generates a random integer
between 1 and 14 (inclusive). This needs to run inside a "for" loop.
So the new random number needs to be different than the previous
number.
Thanks,
Leonard
------------------------------
Date: Sat, 23 Oct 1999 14:24:21 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Random Number
Message-Id: <Pine.GSO.4.10.9910231424050.15158-100000@crusoe.crusoe.net>
> I need a good algorithm that generates a random integer
perldoc -f srand
perldoc -f rand
perldoc -f int
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Sat, 23 Oct 1999 14:35:24 -0400
From: Fungus@hello.net
Subject: Re: Random Number
Message-Id: <gv8ROO5bQZaeXa7xyIMhr8HjqZaE@4ax.com>
The problem with this is it generates the same random number over and
over. I need to generate a different one each time through the loop.
Jeff Pinyan <jeffp@crusoe.net> wrote:
>> I need a good algorithm that generates a random integer
>
>perldoc -f srand
>perldoc -f rand
>perldoc -f int
------------------------------
Date: Sat, 23 Oct 1999 15:04:14 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Random Number
Message-Id: <Pine.GSO.4.10.9910231457410.15158-100000@crusoe.crusoe.net>
> The problem with this is it generates the same random number over and
> over. I need to generate a different one each time through the loop.
Well, the first thing you should do is read the documentation I pointed
to.
> >perldoc -f srand
> >perldoc -f rand
> >perldoc -f int
I'm guessing you're doing something silly like:
for (1..14){
srand time;
$random = 1 + int rand 14;
print "$random\n";
}
For me, that prints the same number each time. Hmm, WHY is that? Because
it's happening so fast that time() doesn't change, so you're
reinitializing the random seed with the same value.
Modern versions of Perl needn't use srand(). If you really want to use
it, read the docs for it.
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
------------------------------
Date: Sat, 23 Oct 1999 18:35:52 +0100
From: "Morris" <acacia@online.no>
Subject: Retrieving directory contents (newbie)
Message-Id: <ArlQ3.9945$7G2.56525@news1.online.no>
I'm wondering if anyone here knows how to make a script that retrieves all
the filenames (just the names + extension)
in a given directory...
Any help would be greatly appreaciated.
Ed.M
------------------------------
Date: Sat, 23 Oct 1999 17:10:16 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: Retrieving directory contents (newbie)
Message-Id: <slrn813r8g.sft.bmccoy@moebius.foiservices.com>
Also Sprach Morris <acacia@online.no>:
>I'm wondering if anyone here knows how to make a script that retrieves all
>the filenames (just the names + extension)
>in a given directory...
There are a couple different ways. The saftest and most portable way
of doing it use to use directory handles with opendir, readdir,
rewind, etc. There is also a module called DirHandle which is an
object-oriented interface to the above named functions. Use perldoc
to get information on all of these.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Sat, 23 Oct 1999 16:17:19 GMT
From: "Daniel W. Burke" <dwb1@home.com>
Subject: Returning a hashref
Message-Id: <Pine.LNX.4.10.9910231106020.18220-100000@cc569157-a.warn1.mi.home.com>
Hello,
I seem to be having a problem with the function below. It is not acting
consistantly between versions of perl. I wrote it, and a few scripts that
use it pretty heavily on my home pc, which hash perl version 5.005_03. I
took the scripts to a PC at work (redhat 5.2, which I think has 5.003 on it),
and it behaves differently.
This function is just to return the hashref from an open cursor to a mysql
database.
On my pc, I have to do the call like this (which passes "use strict" and "-w":
$ret = &my_fetchash($csr);
%data = %$ret;
On the redhat pc, for some reason, it returns the string "1/7". I had to
change it to this (which I actually like better),
%data = &my_fetchhash($csr);
Is there anything that would cause this difference? It seems pretty odd that
an older version operates simpler. If this is normal, is there any way I
can test for something like this an act accordingly? This is the function.
I think I copied it from another module and changed the name.
sub my_fetchhash
{
my($self) = shift;
my($ref) = $self->fetchrow_hashref;
if ($ref) {
%$ref;
} else {
();
}
}
Dan.
------------------------------
Date: Sat, 23 Oct 1999 09:14:58 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: SGML/HTML parsing tool
Message-Id: <iccsu7.0d3.ln@magna.metronet.com>
Bart Lateur (bart.lateur@skynet.be) wrote:
: Tad McClellan wrote:
: > Some of the bits of SGML that got axed to create XML are
: > exceedingly useful to publishers of large, long-lived,
: > complex documents.
: We're off topic for this newsgroup,
Right.
So this is my last followup to this sub-thread.
If you want to move it (or start a new thread) in comp.text.sgml
we can continue there.
: but... while we're at it: what
: features?
exceptions, for one, which I already mentioned.
several others: short-ref, tag minimization, ...
: All I know about SGML is that it is sooo horribly permissive in the
: syntax it must accept,
It is a meta-language, and so allows lots (perhaps too much) of
flexibilty in its support for the "real" language (that is, the
language that you are specifying with SGML).
As I mentioned before, there are lots of things in the "SGML
Declaration" that can be configured.
The "default" SGML Declaration has many features turned on.
The SGML Declaration for XML has many features turned off.
The w3c left many features turned on in their SGML Declaration
for the language they defined, HTML.
: that it is impossible to write a generic SGML
: parser from scratch.
A full-up ISO-8879 conforming parser is indeed a Big Job.
With care in defining _your_ particular language (what you put
in your SGML Declaration and DTD), you can arrange for it
to be more easily parsed.
Much easier to parse the language being described that it is
to parse the meta-language that you use to do the describing.
I wrote a parser for a milstd markup language defined in SGML
in about a week several years ago.
: So the whole world is stuck with just one SGML
: parser, written by one guy: James Clark. A very unhealthy "monopoly", in
: my opinion.
There are others, but James' is by far the most popular
(and it is open, several of the others are commercial).
: (Tell me, honestly: who ever but J. CLark has ever looked
: into the source for his parser family?)
Probably 1/2 to 3/4 of all of the companies that make SGML tools,
as SP is embedded in a bunch of them.
So I figure at least 100-200 people perhaps?
:-)
: At least, it is very well possible to write a complete XML parser from
: scratch in just a few days.
And, since XML is a subset of SGML, a parser _can be_ easy
to write for a language defined in SGML too.
You just avoid using features that are Too Hard compared
to the Perceived Benefit (cost/benefit analysis).
<plug>
A Consultant can help you make that trade-off intelligently.
</plug>
heh, heh (I gotta live, you know :-)
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 23 Oct 1999 15:00:21 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: SIMPLE scripts to help me learn???
Message-Id: <slrn813jkt.sdh.bmccoy@moebius.foiservices.com>
Also Sprach Max S. <intbyte@aol.com>:
>Can I get some very simple scripts to help me understand perl...like a really
>simple guestbook, or anything I could understand easily, thanks.
Try www.perl.com for Perl tutorials, or get the excellent _Learning Perl_
at your local bookseller.
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Sat, 23 Oct 1999 09:30:23 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: SIMPLE scripts to help me learn???
Message-Id: <f9dsu7.1i3.ln@magna.metronet.com>
Max S. (intbyte@aol.com) wrote:
: Can I get some very simple scripts to help me understand perl
Yes.
Read this newsgroup.
Save off some code you see here.
See what it does.
Change it.
See what it does.
Change it.
See what it does...
: E-Mail me,
If you post one more time asking for that, you're gonna get
a permanent killfile entry.
If we email it to you, then nobody else here gets to see it.
We aren't here to help _you_.
We are here to help the _community_.
If we help you where the community can also get the help,
then you win too.
If not, then you are on your own.
Good luck!
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 23 Oct 1999 11:48:41 -0400
From: "TechGuy" <michael@cermak.com>
Subject: Re: Want to CGI for checking Domain name at Internic
Message-Id: <eNkQ3.4072$l05.85798@typ11a.deja.bcandid.com>
See the first script listed at:
http://www.scripts.com/CGI/Utilities/
--
TechGuy
Akkadate Siripongwattana wrote in message ...
>I creating my homepage.
>I want have from for checking Domain name.
>How can I do it?
>Please,Help
------------------------------
Date: Sat, 23 Oct 1999 16:04:08 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: what is SHTML ?
Message-Id: <slrn813ncf.sf2.bmccoy@moebius.foiservices.com>
Also Sprach Mark W. Schumann <catfood@apk.net>:
>>The point is, many of the simple questions have already been answered in
>>the FAQs and PODs. Why the need to keep re-inventing the wheel?
>
>Also think self-interest.
>
>The FAQs and PODs have been in refinement for years. Their answers
>are virtually always the "best thinking" on a topic.
>
>The one-time responses you get to a post are going to vary widely in
>quality.
>
>If an answer is in the FAQ, it's likely to be the _best_ answer.
Right... the FAQs and PODs are developed, essentially, under the same
spirit as open source software, are they not?
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
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 1159
**************************************