[11490] in Perl-Users-Digest
Perl-Users Digest, Issue: 5090 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 8 20:07:21 1999
Date: Mon, 8 Mar 99 17:00:19 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Mon, 8 Mar 1999 Volume: 8 Number: 5090
Today's topics:
A Question? (Mega-thrasher)
Re: constant in Perl? <zenin@bawdycaste.org>
Re: constant in Perl? <zenin@bawdycaste.org>
FAQ 3.7: Is there a pretty-printer (formatter) for Perl <perlfaq-suggestions@perl.com>
Re: FAQ 3.7: Is there a pretty-printer (formatter) for (Ilya Zakharevich)
Re: Fast DNS lookups? (Jon Drukman)
foreach question <amwalker@gate.net>
Re: foreach question (Sam Holden)
Re: foreach question (Mark P.)
Re: How to do Spell Check <gellyfish@btinternet.com>
Re: How to run Perl program as NT service? <--- perl.ex <gellyfish@btinternet.com>
Re: How to use and ActiveX (Jan Dubois)
Re: Limit string length <gellyfish@btinternet.com>
MULTI SEACRH SCRIPT (HELP PLEASE) bababozorg@aol.com
Re: MULTI SEACRH SCRIPT (HELP PLEASE) <varnavas@iname.com>
Re: Newbie: String manipulation. <cassell@mail.cor.epa.gov>
Re: OLE, DBI-ODBC conflicts? (Jan Dubois)
Re: open() sing Perl for Win32 <gellyfish@btinternet.com>
perl Development tools <eroden1@uic.edu>
Re: perl Development tools (Alastair)
Re: perl Development tools <jeromeo@atrieva.com>
Re: perl Development tools <zenin@bawdycaste.org>
Re: problem with CGI::append() on win95??? <gellyfish@btinternet.com>
Quick way to get Perl for Win32 <eytans@eniac.seas.upenn.edu>
Re: Quick way to get Perl for Win32 (Mark P.)
Re: s/\n\s// don't work <jglascoe@giss.nasa.gov>
Re: Sub calls: how can I do this? <gellyfish@btinternet.com>
Re: Using Regex to exclude a domain name, can't seem to (Tad McClellan)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 08 Mar 1999 23:36:05 GMT
From: thrashem@fuckspam_swbell.net (Mega-thrasher)
Subject: A Question?
Message-Id: <36e55dd0.6429765@news.swbell.net>
I hope I'm not asking in the wrong place, and if I am I apologize, and
could someone tell me where to inquire?
My question is, I have someone who sent me several e-mail attachments
of .PL file type, does _anyone_ know where I could locate a
plug-in type application/x-perl?
Any help would be MOST appreciated.
Thank you,
Mega
------------------------------
Date: 09 Mar 1999 00:31:07 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: constant in Perl?
Message-Id: <920939734.176938@thrush.omix.com>
[posted & mailed]
Yu Fang <yfang@gte.com> wrote:
: Basicly, I want to define a constant in Perl. The value can't be changed
: at anytime.
This isn't possible in perl, at all, sorry. Perl just isn't that
anal-retentive of a language.
: If I simply
: $CONSTANT = 1;
: I will be able to
: $CONSTANT = 2;
: later, which is not safe.
: Is there a way like 'const' or macro in c/c++?
As already suggested, you can do either:
*CONSTANT = \1;
print "The value is $CONSTANT\n";
or
use constant CONSTANT => 1;
print "The value is ", CONSTANT, "\n";
The second form you'll have to explicitly export or call, by either
using a module instead of a library (.pm instead of .pl) or calling
them as CONSTANT().
Both forms however, can always be modified if the user really wants
to:
*CONSTANT = \"new value";
and
sub CONSTANT () { "new value" };
If you really must have values that users can't change, make them
lexically scoped (my $CONSTANT) and don't give the user any
references to it.
If you really want this much barbed wire however, perl *really*
isn't the language you should be useing. See Java.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 09 Mar 1999 00:46:01 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: constant in Perl?
Message-Id: <920940625.601487@thrush.omix.com>
[posted & mailed]
Mark-Jason Dominus <mjd@op.net> wrote:
>snip<
: Another approach is illustrated by my `Locked' module aet
: http://www.plover.com/~mjd/perl/Locked/
What advantage does this module have over the normal
*CONSTANT = \"value";
I don't understand? It pulls in about the same amount of code as
the constant module (remember that thread?:-) and offers much slower
access then a normal global.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 8 Mar 1999 17:13:36 -0700
From: Tom Christiansen <perlfaq-suggestions@perl.com>
Subject: FAQ 3.7: Is there a pretty-printer (formatter) for Perl?
Message-Id: <36e467b0@csnews>
(This excerpt from perlfaq3 - Programming Tools
($Revision: 1.33 $, $Date: 1998/12/29 20:12:12 $)
part of the standard set of documentation included with every
valid Perl distribution, like the one on your system.
See also http://language.perl.com/newdocs/pod/perlfaq3.html
if your negligent system adminstrator has been remiss in his duties.)
Is there a pretty-printer (formatter) for Perl?
There is no program that will reformat Perl as much as indent(1)
does for C. The complex feedback between the scanner and the
parser (this feedback is what confuses the vgrind and emacs
programs) makes it challenging at best to write a stand-alone
Perl parser.
Of course, if you simply follow the guidelines in the perlstyle
manpage, you shouldn't need to reformat. The habit of formatting
your code as you write it will help prevent bugs. Your editor can
and should help you with this. The perl-mode for emacs can
provide a remarkable amount of help with most (but not all) code,
and even less programmable editors can provide significant
assistance. Tom swears by the following settings in vi and its
clones:
set ai sw=4
map ^O {^M}^[O^T
Now put that in your .exrc file (replacing the caret characters
with control characters) and away you go. In insert mode, ^T is
for indenting, ^D is for undenting, and ^O is for blockdenting --
as it were. If you haven't used the last one, you're missing a
lot. A more complete example, with comments, can be found at
http://www.perl.com/CPAN-
local/authors/id/TOMC/scripts/toms.exrc.gz
If you are used to using the *vgrind* program for printing out
nice code to a laser printer, you can take a stab at this using
http://www.perl.com/CPAN/doc/misc/tips/working.vgrind.entry, but
the results are not particularly satisfying for sophisticated
code.
The a2ps at http://www.infres.enst.fr/~demaille/a2ps/ does lots
of things related to generating nicely printed output of
documents.
--
"It is easier to port UNIX to a new machine, than an application to a new
operating system." -- Dennis Ritchie
------------------------------
Date: 9 Mar 1999 00:59:10 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: FAQ 3.7: Is there a pretty-printer (formatter) for Perl?
Message-Id: <7c1rou$obc$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Tom Christiansen
<perlfaq-suggestions@perl.com>],
who wrote in article <36e467b0@csnews>:
> (This excerpt from perlfaq3 - Programming Tools
> ($Revision: 1.33 $, $Date: 1998/12/29 20:12:12 $)
> part of the standard set of documentation included with every
> valid Perl distribution, like the one on your system.
> See also http://language.perl.com/newdocs/pod/perlfaq3.html
> if your negligent system adminstrator has been remiss in his duties.)
>
> Is there a pretty-printer (formatter) for Perl?
>
> There is no program that will reformat Perl as much as indent(1)
> does for C. The complex feedback between the scanner and the
> parser (this feedback is what confuses the vgrind and emacs
> programs) makes it challenging at best to write a stand-alone
> Perl parser.
Of course, this does not mention that CPerl mode allows both
reformatting and pretty-print.
Ilya
------------------------------
Date: 8 Mar 1999 23:17:21 GMT
From: jsd@hudsucker.gamespot.com (Jon Drukman)
Subject: Re: Fast DNS lookups?
Message-Id: <slrn7e8n3k.10j.jsd@hudsucker.gamespot.com>
In article <Pine.SUN.4.05.9903061930000.1992-100000@mail.enetis.net>,
Justin England wrote:
>Well, I am writing a perl / CGI program that will query the MySQL db and
>generate some stats. I am concered about speed, and so far everything
>runs as quick I need, except when it comes to DNS lookups. I know that
>their are alot of variables outside of my perl program that will determine
>how fast an DNS lookup is, but I am wondering what the fast way would be.
>Here's what I am using right now:
(code snipped)
it's not going to get any faster than that. the fundamental problem
is that the gethostbyaddr() call blocks, and it can take a minute or
two to decide that it's time to give up.
here are three things you can do to speed the process up, in order
of increasing complexity:
1. keep an in-memory hash of IP's and hostnames. that way you can
look up the IP in the hash and know whether you've already done the
(time consuming) dns resolution.
2. set an alarm before you do the gethostbyaddr() call and abort it
if takes more than a few seconds. you may miss some servers with slow
response times. decide if it's worth the tradeoff.
3. fork off a bunch of child processes to do the dns lookups and
somehow coordinate getting the results back from them. combine this
with the previous two techniques.
documentation on the above techniques:
1. perldata talks about hashes.
2. perlfunc talks about alarm.
3. perlipc talks about inter-process communication.
good luck.
--
Jon Drukman jsd@gamespot.com
-----------------------------------------------------------------------
Fear the government that fears your computer.
------------------------------
Date: Mon, 08 Mar 1999 19:24:43 -0500
From: Aaron Walker <amwalker@gate.net>
Subject: foreach question
Message-Id: <36E46A4B.74A4F84F@gate.net>
hello,
here's the program I have:
---- start ----
#!/usr/bin/perl
$ls = `ls`;
@ls_output = $ls;
foreach $file (@ls_output)
{
print $file;
}
---- end ----
say I'm in the directory: /home/amwalker.
in that dir are three files: file1, file2, file3.
The above script will print out:
file1
file2
file3
What I want is to process each file separately
for example, say I am going to search file1 for something.
if I use the foreach loop, then it will try to look for the file called
"file1file2file3" but
it won't exist. How would I go about looking at one file at a time?
I hope the above is not confusing anyone :-)
thanks for the help,
Aaron
------------------------------
Date: 9 Mar 1999 00:33:59 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: foreach question
Message-Id: <slrn7e8r3n.8l8.sholden@pgrad.cs.usyd.edu.au>
On Mon, 08 Mar 1999 19:24:43 -0500, Aaron Walker <amwalker@gate.net> wrote:
>hello,
>
>here's the program I have:
>
>---- start ----
>#!/usr/bin/perl
>$ls = `ls`;
>@ls_output = $ls;
And what do you propose that line is meant to do???
Maybe you want @ls_output = split /\n/, $ls;
Maybe you want @ls_output = glob("*");
Maybe you want @ls_output = <*>;
--
Sam
There's no such thing as a simple cache bug.
--Rob Pike
------------------------------
Date: Tue, 09 Mar 1999 00:45:54 GMT
From: mag@imchat.com (Mark P.)
Subject: Re: foreach question
Message-Id: <36e46d0a.1314847931@news.ionet.net>
Try something like this.
$datadir = "./";
opendir(COP, "$datadir") || die $!;
@filenames = grep (/\.*$/i,readdir(COP));
closedir(COP);
print "Content-type: text/plain\n\n";
foreach $file (@filenames)
{
print "$file\n";
# you can do any sub routine here like a grep. I just printed it for
grins.
}
On Mon, 08 Mar 1999 19:24:43 -0500, Aaron Walker <amwalker@gate.net>
wrote:
>hello,
>
>here's the program I have:
>
>---- start ----
>#!/usr/bin/perl
>$ls = `ls`;
>@ls_output = $ls;
>
>foreach $file (@ls_output)
>{
> print $file;
>}
>---- end ----
>
>say I'm in the directory: /home/amwalker.
>in that dir are three files: file1, file2, file3.
>
>The above script will print out:
>file1
>file2
>file3
>
>What I want is to process each file separately
>for example, say I am going to search file1 for something.
>if I use the foreach loop, then it will try to look for the file called
>"file1file2file3" but
>it won't exist. How would I go about looking at one file at a time?
>
>I hope the above is not confusing anyone :-)
>
>thanks for the help,
>Aaron
>
------------------------------
Date: 8 Mar 1999 21:33:09 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How to do Spell Check
Message-Id: <7c1fml$35i$1@gellyfish.btinternet.com>
On Sun, 7 Mar 1999 20:18:03 +0800 Rollo Chan Ka Chun wrote:
> Dear all,
>
> How to do spell check in PERL?
>
I had felt disinclined to look at this after a hard day at the code face
however I got a little intrigued so here you go - its crap and its slow
and you'd be better off using 'spell' but it works after a fashion ...
#!/usr/bin/perl -w
use strict;
use Search::Dict;
my $file = '/usr/dict/words';
open(DICT,$file) || die "Cant open dictionary $file - $!\n";
while(<>)
{
my $line_number = $.;
chomp;
foreach (split )
{
s/\W//g;
next if /^\d/;
my $pos = look *DICT,$_,1,1;
my $word = <DICT>;
chomp $word;
if (lc($_) ne lc($word))
{
print "line $line_number : $_ - guess $word \n";
}
}
}
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 8 Mar 1999 20:44:58 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: How to run Perl program as NT service? <--- perl.exe persistance
Message-Id: <7c1csa$2v7$1@gellyfish.btinternet.com>
On Sun, 07 Mar 1999 17:15:38 -0800 pault12@postoffice.pacbell.net wrote:
> Jonathan Stowe wrote:
>
>> <comp.lang.perl is a former newsgroup>
<snip 54 lines without a further word from me>
Er, Ok you might have trouble with your newsfeed, you might not have the
original post to hand - but if I get the attribution it would be quite
nice to have more than one line (and that irrelevant) quoted.
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Tue, 09 Mar 1999 00:17:18 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: How to use and ActiveX
Message-Id: <36ef5728.16166946@news3.ibm.net>
[mailed & posted]
"Sriram" <sriram.v@mailcity.com> wrote:
>can anybody please tell me how to use and activex component developed
>inhouse with the perl script. i use this component to work with the
>underlying sql database. any example code or any reference where i can get
>more information is very much appreciated.
You can use ActiveX components through the Win32::OLE module *if* the
components support the IDispatch Automation interface. You won't be able to
use events (connection points).
-Jan
------------------------------
Date: 8 Mar 1999 22:47:36 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Limit string length
Message-Id: <7c1k28$393$1@gellyfish.btinternet.com>
On Mon, 8 Mar 1999 02:27:50 -0500 Dan Burke wrote:
> What is the best way to take a string and chop off the end of it, if it is
> over a certain length?
You have been shown the probably most efficient method using substr()
however someones got to give the ubiquitous regex method ;)
($string =~ /(.{0,50})/ ) && ($string = $1);
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 08 Mar 1999 22:48:29 GMT
From: bababozorg@aol.com
Subject: MULTI SEACRH SCRIPT (HELP PLEASE)
Message-Id: <7c1k3q$uc9$1@nnrp1.dejanews.com>
hi
i am making a search script for searching some electronic chips part numbers
this script should be able to search 2 or more part number at once and bring
the results in on page but in the seprate table for each one of the search
entries.
search entries will be entred to the script from the textarea
for example they can type:
2n2222
mc3413
2n4444
then press search and ......
i have made the script that pass each string in that search entries to the
function (sub ....{})
and that function returns the results if the string found in the database.
#foreach $search_for(@search_for){ ####### i used this
#&search_database($search_for); ####### to pass the strings
#}
there is a little problem.
the search function looks like this:
sub search_database{
my $search_for = $_[0];
open(DB, $database) or die "Error opening file: $!\n";
while(<DB>){
if($search_field =~ /all/i){
if(/$search_for/oi){push @results, $_};
} else {
@field_vals = split(/\|/, $_);
if($field_vals[$search_field] =~ /$search_for/oi){
chomp;
push @results, $_;
};
}
}
close (DB);
}
the problem is if i enter the search strings for example: 2n2222 mc3419 it
brings the results for the first string (2n2222) but instead of having a
results for second string (mc3419) i have a duplicate of a 2n2222 results or
if i add 3 strings i get the results of a 2n2222 times 3. :) but i dont want
this to happen i want to have a seprate results for each one of them.
i removed the push @results, $_; and just said print "$_"; but didnt help same
thing happend.
i removed the
my $search_for = $_[0];
but no help....
can you help please ;)
thanks
hamed
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Mon, 08 Mar 1999 20:03:05 -0500
From: Frank Varnavas <varnavas@iname.com>
To: bababozorg@aol.com
Subject: Re: MULTI SEACRH SCRIPT (HELP PLEASE)
Message-Id: <36E47349.52F88A3A@iname.com>
I think you don't want the /o modifier on these pattern matches.
frank v
bababozorg@aol.com wrote:
> if(/$search_for/oi){push @results, $_};
>
> if($field_vals[$search_field] =~ /$search_for/oi){
>
> if i add 3 strings i get the results of a 2n2222 times 3. :) but i dont want
> this to happen i want to have a seprate results for each one of them.
------------------------------
Date: Mon, 08 Mar 1999 15:04:58 -0800
From: "David L. Cassell" <cassell@mail.cor.epa.gov>
To: Rob Moore <rob@best-buys.com>
Subject: Re: Newbie: String manipulation.
Message-Id: <36E45799.2AB9F1@mail.cor.epa.gov>
Rob Moore wrote:
>
> I've been wracking my brain on this for a couple of hours now, and since I'm
> on deadline, I'm becoming less and less focused as I go. Here's the problem:
>
> I have a flat text db file whith each line looking similar to:
>
> 8005551212,8,REALNAMEXXXXXX
>
> The first field is a phonenumber and the first part of the third field
> contains a proper name. The second field is a number indicating in
> characters, the length of the name contained in the third field.
>
> So if I say
>
> ($phone,$length,$longname) = split(/,/, $line);
>
> I get $phone = 8005551212; $length = 8; $longname = REALNAMEXXXXXX
>
> How do I get a string that only takes {$length} characters from {$name} and
> discards the rest? I want to end up with $shortname = REALNAME
You're soooo close already. Try:
perldoc -f substr
to learn about the substr function. Then use something like:
$shortname = substr ( $longname, 0, $length);
That's starting at offset 0, BTW.
HTH,
David
--
David L. Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 09 Mar 1999 00:17:17 +0100
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: OLE, DBI-ODBC conflicts?
Message-Id: <36ed568c.16010862@news3.ibm.net>
[mailed & posted]
Lynn Wilson <lynn@swcp.com> wrote:
>I've written a rather large body of perl code that opens an Excel workbook and
>manipulates it. I've also written a DBI-ODBC interface to an Access database.
>If I open the spreadsheet first and leave it open, the 'connect' operator with
>the ODBC fails. It works fine if I close the OLE prior to opening the ODBC.
>
>I'm running perl, version 5.005_02 built for MSWin32-x86-object (ActiveState)
>on a WinNT sp4 machine. Is this normal behavior? If I rewrite the spreadsheet
>code to use DBI-ODBC techniques, will I be able to use both objects
>simultaneously?
It would help if you would at least show how it fails (error message). Are you
running your program with "perl -w"?
You could try to insert the following statement directly after your
"use Win32::OLE;" statement and see if it helps.
Win32::OLE->Initialize(Win32::OLE::COINIT_OLEINITIALIZE);
-Jan
------------------------------
Date: 8 Mar 1999 22:32:43 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: open() sing Perl for Win32
Message-Id: <7c1j6b$38v$1@gellyfish.btinternet.com>
On Sun, 07 Mar 1999 21:25:31 GMT mmueller007@hotmail.com wrote:
> I'm working on a little cgi-program (I'm using Perl for Win32) that is
> supposed to open a file, but there seems to be a problem with the
> open-command:
>
> open($PRICE_FILE, "<sys2.txt");
> while (<$PRICE_FILE>) {
> chop;
> ($item, $price) = split(/:/,$_,2) ;
> $price_list{$item} = $price ;
> }
>
If you had run this with the -w switch (as is recommended *always* when
developing a program):
Name "main::price_list" used only once: possible typo at ./crap.pl line 7.
Use of uninitialized value at ./crap.pl line 3.
Can't use an undefined value as filehandle reference at ./crap.pl line 3.
I think that third message says it all really - you are attempting to
use an undefined value as reference to a filehandle which is entirely not
what you want - you could assign some value to the *variable* $PRICE_FILE
or alternatively and more usual you could simply use PRICE_FILE - this
being the usual construction for a filehandle - check the perlfunc manpage
entry for open().
Also and importantly you should *always* check the success of an open() :
(also a file is opened for reading by default so the '<' is unnecessary).
open(PRICE_FILE,'sys2.txt') || die "Cant open sys2.txt -$!\n";
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 8 Mar 1999 17:09:48 -0600
From: Ted <eroden1@uic.edu>
Subject: perl Development tools
Message-Id: <Pine.SOL.3.96.990308170616.3531A-100000@icarus.cc.uic.edu>
I'm looking for some good perl development tools to run on my linux box. I
am obviously a newbie at both perl and linux, so any suggestions would be
much appreciated. Thanks
thanks,
Ted
ted@fatkids.com
ted@slapfactory.com
eroden1@uic.edu
------------------------------
Date: Tue, 09 Mar 1999 00:12:09 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: perl Development tools
Message-Id: <slrn7e8rer.5o.alastair@calliope.demon.co.uk>
Ted <eroden1@uic.edu> wrote:
>I'm looking for some good perl development tools to run on my linux box.
All you need is a decent editor.
--
Alastair
work : alastair@psoft.co.uk
home : alastair@calliope.demon.co.uk
------------------------------
Date: Mon, 08 Mar 1999 16:37:00 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
Subject: Re: perl Development tools
Message-Id: <36E46D2C.27F3E561@atrieva.com>
Ted wrote:
>
> I'm looking for some good perl development tools to run on my linux box. I
> am obviously a newbie at both perl and linux, so any suggestions would be
> much appreciated. Thanks
Emacs or vi are probably already there, and they work great!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 09 Mar 1999 00:53:34 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: perl Development tools
Message-Id: <920941078.220248@thrush.omix.com>
Ted <eroden1@uic.edu> wrote:
: I'm looking for some good perl development tools to run on my linux box. I
: am obviously a newbie at both perl and linux, so any suggestions would be
: much appreciated. Thanks
Xterms and your favorite editor (I prefer "joe"), or if you really
like lots of pretty colors getting in the way of your code there
is always XEmacs.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: 8 Mar 1999 22:04:59 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: problem with CGI::append() on win95???
Message-Id: <7c1hib$37t$1@gellyfish.btinternet.com>
On Sun, 07 Mar 1999 16:25:06 -0600 Dan Baker wrote:
>
> Well, I DO know basic Perl syntax, and I thought the docs looked weird.
> I've tried it as documented as well as other forms without success:
>
> append(-name=>'VarName',-values=>['word1','word2','word3']) ;
> append(-name=>'VarName',-value=>['word1','word2','word3']) ;
What message did you get here : not the same as before I would wager !
> CGI::append(-name=>'VarName',-values=>['word1','word2','word3']) ;
>
And what message did you get here : again different ;
Which in the course of investigation and based on the previous messages
led me to this:
use CGI ;
my $thing = new CGI;
$thing->append(-name=>'VarName',-values=>['word1','word2','word3']) ;
foreach ($thing->param())
{
print "$_ = ",$thing->param($_),"\n";
}
It appears that append doesnt work properly for the procedural interface to
CGI.pm (for whatever reason).
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 8 Mar 1999 17:03:48 -0600
From: "Eytan Seidman" <eytans@eniac.seas.upenn.edu>
Subject: Quick way to get Perl for Win32
Message-Id: <7c1l5i$l1d$1@netnews.upenn.edu>
Can anyone recommend the quickest and best way to get Perl for Win32 without
having a C/C++ compiler. Details would be appreciated,
Eytan
------------------------------
Date: Tue, 09 Mar 1999 00:47:12 GMT
From: mag@imchat.com (Mark P.)
Subject: Re: Quick way to get Perl for Win32
Message-Id: <36e46f7b.1315473360@news.ionet.net>
Active perl from ActiveState.com
On Mon, 8 Mar 1999 17:03:48 -0600, "Eytan Seidman"
<eytans@eniac.seas.upenn.edu> wrote:
>Can anyone recommend the quickest and best way to get Perl for Win32 without
>having a C/C++ compiler. Details would be appreciated,
>
>Eytan
>
>
------------------------------
Date: Mon, 08 Mar 1999 18:57:58 -0500
From: Jay Glascoe <jglascoe@giss.nasa.gov>
To: mane@interscape.de
Subject: Re: s/\n\s// don't work
Message-Id: <36E46405.B454E86F@giss.nasa.gov>
[courtesy copy of post sent to Manfred]
hi Manfred,
Manfred Brunner wrote:
>
> Thank you Jay,
>
> but this dont work in my case.
dang! Let's try again.
> > Jay Glascoe wrote:
> >
> > all of your loops are working on the input
> > one line at a time. So, the first time through
>
> Maybe not, because i redirect from stdin a whole textfile which go fully into
> "$_" (it seems so) and it realy work through the whole file if i only
> substitute spaces or newlines or anything else.
hmm. No, "while (<STDIN>) BLOCK" will assign a line from
STDIN to "$_" each time through the loop.
If you really want the entire text file to be slurped into
a single scalar, newlines and all, then you can do:
$/ = undef;
$all = <STDIN>;
OR
@all = <STDIN>;
$all = join '', @all;
The first method is faster, but I prefer the second one (don't know why :).
At any rate, let's assume the whole file has been slurped into "$all".
$all =~ s/\n / /g; # replace newline-space pairs with spaces
$all =~ tr/ //s; # squash duplicate spaces
and if you want the resulting lines as a list:
@all = split /\n/, $all;
Of course, if your input is very large, then you can't slurp it
all into a single scalar. Maybe do this:
my @lines = ();
my $next_line = <STDIN>;
while ($next_line) {
my @tmp = ($next_line);
while ($next_line = <STDIN>) {
last unless $next_line =~ /^ /;
chomp $tmp[$#tmp];
push @tmp, $next_line;
}
push @lines, join '', @tmp;
}
Jay Glascoe
--
"Narf!"
--Pinky
------------------------------
Date: 8 Mar 1999 21:42:16 -0000
From: Jonathan Stowe <gellyfish@btinternet.com>
Subject: Re: Sub calls: how can I do this?
Message-Id: <7c1g7o$35l$1@gellyfish.btinternet.com>
On Sun, 07 Mar 1999 14:39:46 GMT Rick Delaney wrote:
> Jonathan Stowe wrote:
>>
>> On Sun, 07 Mar 1999 05:25:18 GMT Rick Delaney wrote:
>> >
>> > if ( defined &{$ARGV[0]} ) { }
>> >
>>
>> Or an alternative for the paranoid
>>
>> if ( ref($ARGV[0]) == 'CODE' )
> ^^
> ITYM eq.
>
Er yes ...
> Also, this works for the hard ref case, not when using symbolic refs.
> It would be pretty hard to pass a coderef as a command line argument.
>
Er yes - I kind of blanked out the meaning of $ARGV[0] there and just carried
on assuming a bunch of hard refs in the array ...
> This could be used instead of testing for the existance of the hash keys
> that point to the corresponding coderefs, as Bryan suggested.
>
> if ( ref( $hash{$ARGV[0]} ) eq 'CODE' ) {}
>
Er yes ...
/J\
--
Jonathan Stowe <jns@btinternet.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Mon, 8 Mar 1999 12:36:22 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Using Regex to exclude a domain name, can't seem to get it to work.
Message-Id: <mq11c7.ak.ln@magna.metronet.com>
wg (wgraphic@bellsouth.net) wrote:
: I am trying to exclude a domain name using Regex
: in this log program Web Log
: After reading the documentation I still couldn't
: get it to exclude for example I have
: # $ExcludeDomain = ".yahoo.";
: in order to exclude any thing from the yahoo
: domain but it doesn't seem to work using regex.
That is not a regex.
That is assigning a string to a scalar.
Where is the regex that you are having trouble with?
We (usually) cannot fix it if we cannot see it...
: I believe I have the correct regex but obviously
: not.
So then you should _show_ us the suspect syntax, don't you think?
: I also want to exclude any thing from
: # $ExcludeDomain = "lax.southwest.net";
: or as I see it in the logs as
: host-219-204-170-215.lax.southwest.net
print unless /lax\.southwest\.net/;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
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 5090
**************************************