[12393] in Perl-Users-Digest
Perl-Users Digest, Issue: 5993 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 14 18:07:25 1999
Date: Mon, 14 Jun 99 15:00:37 -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 Mon, 14 Jun 1999 Volume: 8 Number: 5993
Today's topics:
Re: can't send large-ish udp packets? <nmarino@home.com>
Re: Creating an external config file. How ? (Kenneth Herron)
csv database w/ PERL classic_catering@my-deja.com
csv interfacing w/PERL classic_catering@my-deja.com
Re: Does Perl have a future? <webmaster@chatbase.com>
Re: Extracting PIDs from a 'ps aux' (Gregory Snow)
Re: file read (Greg Bacon)
Re: file read (Gregory Snow)
Re: function to retrieve number of members in list (Andrew Allen)
Re: I have a question about 5.16 and IIS 4.0 <rootbeer@redcat.com>
Re: Insidious 'use constant' syntax bit me jboes@qtm.net
intetfacing database (csv) w/PERL classic_catering@my-deja.com
intetfacing database (csv) w/PERL classic_catering@my-deja.com
intetfacing database (csv) w/PERL classic_catering@my-deja.com
Re: Large String handling (Philip 'Yes, that's my address' Newton)
Re: my() in a loop (Andrew Allen)
Need this code tightened tbsmith@deltacom.net
Netscape problem <perini@buffalo.edu>
Re: Netscape problem <ericd@nospam.comtelligence.net>
Perl / Sybase Opening <mlewis@worldnetcorp.com>
Re: PERL tutorial (Jason)
Polling a file? <portboy@home.com>
Q: listing all currently installed modules (umask 077)
Re: Redirection but no 'Back' <jbc@shell2.la.best.com>
regex to replace quotes delimited by quotes. <vicuna@my-deja.com>
Re: Regular Expressions <show@netcom.com>
Re: Sort on mtime <aef@pangea.ca>
Re: win32: vba2perl (Jan Dubois)
Writing to a pipe...?? <portboy@home.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 14 Jun 1999 20:17:04 GMT
From: "Nicholas Marino" <nmarino@home.com>
Subject: Re: can't send large-ish udp packets?
Message-Id: <4rd93.2477$Mp5.1283@news.rdc1.pa.home.com>
..also, the send() function returns correctly in either case, with the
number of bytes sent.
Nicholas Marino wrote in message
<42d93.2471$Mp5.1237@news.rdc1.pa.home.com>...
>My perl script can't seem to send udp packets beyond a certain size.
>
>For example, in the following code:
>
> $fpicname = "image.gif";
> open(FPIC, $fpicname);
> binmode(FPIC);
> $bytesread = read(FPIC, $picdata, 8192);
> close(FPIC);
> $rc = send(TTMD, $picdata, 0, $ipaddr);
>
>If image.gif is 648 bytes, the packet is received fine at the other end.
>However when I attempt to send a 2236 byte image, the other end
>never sees the packet.
>
>I've tried calling setsockopt(SOCK, SOL_SOCK, SO_SNDBUF, 8192)
>thinking a larger send buffer might help, but it doesn't.
>
>Is there a limit on UDP packet size? I'm running RedHat Linux, v 5.2.
>
>
>
>
------------------------------
Date: 14 Jun 1999 20:01:35 GMT
From: kherron@sgum.mci.com (Kenneth Herron)
Subject: Re: Creating an external config file. How ?
Message-Id: <7k3n2v$2aij@news2.newsguy.com>
In article <375ebfd8@cs.colorado.edu>,
Tom Christiansen <tchrist@mox.perl.com> wrote:
>In comp.lang.perl.misc, "Greg Savage" <greg@paradox.net.au> writes:
>:I have compilled my perl script and now need to store my configuration
>:options in an external text file for ease of modification. I am looking for
>:an efficient routine to read in the following pairs, ignoring # comments
>:and assign them to variables.
>
> :# This is a comment in myproggie.cf
> $logdir = '/var/log';
> $logfile = 'local0';
> $warning = 2;
> $limit = 5;
> $admin = 'admin@domain.com';
>
>Now:
>
> do "myproggie.cf";";
Along those lines, you can do something like this:
%config = require 'foo.pl';
where foo.pl contains an anonymous hash:
{
'logdir' => '/var/log',
'logfile' => 'local0',
# etc.
};
and then refer to $config->{'logdir'} and so on.
The downside of both of these methods is that the "configuration file"
has to be syntactically valid perl. Depending on the software's target
audience, this might present ease-of-use problems for future
users/maintainers.
--
Kenneth Herron -- kherron@sgum.mci.com
"Subversion has always been our best tactic...It leaves the competition
confused, and they don't know what to shoot at anymore."
-- John Ludwig, Vice president, Microsoft
------------------------------
Date: Mon, 14 Jun 1999 18:58:55 GMT
From: classic_catering@my-deja.com
Subject: csv database w/ PERL
Message-Id: <7k3jd9$js$1@nnrp1.deja.com>
I have a csv database file that I am trying to interface with my PERL
script. I pass the perl file args (ex. venue=the+national+aquarium)
and I parse and read the args. Then I open, store and close my csv
database file to array (@DB). My question or problem is that I am
having a hard time comparing the fields of @DB with my args. How do I
name all of the different fields in my @DB array and compare them with
the args? My first field in the @DB is the venue name, and there are
about 8 - 10 other fields afterwards, that need to be output to the
resulting HTML page. Any help would be greatly appreciated as I am
still new to PERL.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 18:46:11 GMT
From: classic_catering@my-deja.com
Subject: csv interfacing w/PERL
Message-Id: <7k3ilg$9p$1@nnrp1.deja.com>
I'm trying to interface a CSV database-file with
PERL. I have my csv file and my .pl file. My
problem is searching the csv file for a string.
My webpage sends an arg
(ex. venue=the+national+aquarium)
then I parse the data. All that is great. I
open my file and read it in an array (@DB) then
close the DB file. My question is , how do I
name each of the fields I input from the DB file
and how do I search for a match from the query
string to the DB?? Any help would be greatly
appreciated as I am just learning PERL.
Thanks,
Rob
rkuryk@classiccatering.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 14:53:40 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
To: Christian Ahkman <tchristian7@yahoo.com>
Subject: Re: Does Perl have a future?
Message-Id: <376579E4.735FFA4A@chatbase.com>
Christian Ahkman wrote:
>
> On Sun, 13 Jun 1999 13:57:59 -0700, TRG Software : Tim Greer
> <webmaster@chatbase.com> wrote:
>
> >Of course they do, they're promoting their product. Do you assume Ford
> >is best if they say that Chevy will go out of business because of their
> >competition?
> >
>
> No. I don't assume anything. Which is why I said "of course Sun
> claims it's dead." I was asking if people are seeing a shift away
> from perl for internet functionality on UNIX (to Java or something
> else). I'm not an "advocate."
Sorry, it seemed that way, my apologies. But no, I don't see that
happening, ever. (I could be wrong, I hope I don't ever see that
happen).
> >
> >Pretty much on top, in the Unix world anyway. I use ASP on occasion, as
> >do I use ActiveX, and yes, even Java... But usually C or Perl. But my
> >personal opinion (that many would probably agree with if they are in
> >this NG), is that there's nothing Perl has to worry about.
>
> Do you think the criticism of perl and other script-based solutions
> for web applications is valid? Namely that the cost of perl/CGI is
> too large (overhead of running a script for every request) compared to
> servlets or COM objects that basically function as daemons?
Take a look at some info about mod_perl and fastcgi, etc. I know what
you're saying, and spawning so many processes can be murder on your
system, but if you take advantage of such things, then any complaint
anyone can use in such a manner is no longer valid. Sorry I didn't get
into detail in regards to this, but I didn't think it would have been
very relevant to the subject, but I guess I was wrong. You can even use
fastcgi with programs compiled in C (Does that seem fast enough?) I
don't think a servlet is going to out-do that in performance (not unless
someone's a poor C coder).
Just remember that Perl is always advancing as well. So it's not as if
Sun will come out with something so new that Perl will be forgotten.
Anything java related has a lot of catching up to do in regards to Perl.
--
Regards,
Tim Greer: chatmaster@chatbase.com / software@linkworm.com
Chat Base: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripting in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, Sciences.
------------------------------
Date: 14 Jun 1999 20:52:19 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Re: Extracting PIDs from a 'ps aux'
Message-Id: <7k3q23$j9u$1@nntp6.u.washington.edu>
In article <iPc93.167$eW3.649@newsfeed.slurp.net>,
John Jones <jjones@paracom.com> wrote:
[snip]
>
> @grep = 'ps aux | grep radius';
>
> @line1 = $grep[0];
> @line2 = $grep[1]; # these two lines work, verified by a 'print
>@line1' and such.
>
>The problem I am running into, is that when using backquotes, multiple line
>output is assigned an array as one line per element. What do I need to do
>to then extract the pids (second 'word' in each 'element') into an array
>called @pids?
>
>I can then do a:
>
> > kill 9, @pids;
>
>at the end of the script.
>
try using map with split, i.e.
@pids = map { (split)[1] } @grep;
That worked for my simple test, look in the perlfunc man page for
more details on map and split.
--
-------------------------------------------------------------------------------
Gregory L. Snow | Imagination is the one weapon in the
(Greg) | war against reality.
snow@biostat.washington.edu | -- Jules de Gaultier
------------------------------
Date: 14 Jun 1999 20:16:05 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: file read
Message-Id: <7k3nu5$h1i$9@info2.uah.edu>
In article <7k3g3q$v81$1@nnrp1.deja.com>,
olmert@netvision.net.il writes:
: Can any body help me with this: I want to create a perl script that
: opens a file for reading, prints it's content to the user's screen, and
: then timesout for 2 seconds. after two seconds it checks if the file was
: updated, and if so- prints the content from the place it stopped the
: previous time.
You want `tail -f`. Lots of people do. It's answered in the FAQ.
Section 5. "How do I do a tail -f in perl?".
Greg
--
Micro-optimizations are useless but dangerous hobgoblins that
haunt the deluded minds of uncounted programmers of small capability.
-- Tom Christiansen in <36cdadec@csnews>
------------------------------
Date: 14 Jun 1999 20:27:46 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Re: file read
Message-Id: <7k3ok2$6s8$1@nntp6.u.washington.edu>
In article <7k3g3q$v81$1@nnrp1.deja.com>, <olmert@netvision.net.il> wrote:
>Hello
>Can any body help me with this: I want to create a perl script that
>opens a file for reading, prints it's content to the user's screen, and
>then timesout for 2 seconds. after two seconds it checks if the file was
>updated, and if so- prints the content from the place it stopped the
>previous time.
>any ideas?
You will probably find something useful if you go to PPT (perl power
tools: http://language.perl.com/ppt/ ) and look at "tail". This may
do what you want without having to write your own script, or give you
an example that works to base your own on.
--
-------------------------------------------------------------------------------
Gregory L. Snow | Imagination is the one weapon in the
(Greg) | war against reality.
snow@biostat.washington.edu | -- Jules de Gaultier
------------------------------
Date: 14 Jun 1999 20:16:35 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: function to retrieve number of members in list
Message-Id: <7k3nv3$ip6$5@fcnews.fc.hp.com>
dalehend@flash.net wrote:
: Is there a function to return the number of members in a list or
: array?
: Is it @{...} ?
Like others have said, "@array" in a scalar context gives you number
of elements in @array.
For a list, it's a little more tricky.
scalar(()=(8,9,0))
yields 3, as does
scalar(@{[8,9,0]})
I'm sure Abigail will have even more obscure idioms. Good luck!
Andrew
------------------------------
Date: Mon, 14 Jun 1999 14:57:41 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: I have a question about 5.16 and IIS 4.0
Message-Id: <Pine.GSO.4.02A.9906141451540.6999-100000@user2.teleport.com>
On Mon, 14 Jun 1999, Rollo Lawson wrote:
> My company was using IIS 3.0 and all of
> my scripts were working beautifully.
So, you don't have a Perl problem. You may benefit from the docs, FAQs,
and newsgroups about your server and the CGI environment.
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs=split(/&/, $buffer);
Don't do this. Use a module like the CGI module, which is not only easier
to use...
> #Split the Values
> foreach $pair (@pairs)
> {
> ($name,$value)=split(/=/,$pair);
> $value =~tr/+/ /;
> $value =~s/%(..)/pack("C",hex($1))/eg;
> $FORM{$name}=$value;
...but also which does it correctly.
> open(HTML, $file);
Even when your script is "just an example" (and perhaps especially in that
case!) you should _always_ check the return value after opening a file.
> ($third,$fourth)=split(/<\/title>/i,$body);
You should probably be using a true parser to work with the HTML. See
HTML::Parser on CPAN.
> print "<AREA SHAPE=\"Rect\" COORDS=\"180,1,258,21\"";
> print "HREF=\"http://www.micro.lucent.com\">";
> print "<AREA SHAPE=\"Rect\" COORDS=\"262,0,332,21\"";
> print "HREF=\"javascript:search.htm\">";
A here-doc would be easier to read, write, and maintain here.
When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.
http://www.perl.com/CPAN/
http://www.perl.org/CPAN/
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
http://www.perl.org/CPAN/doc/manual/html/pod/
Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Mon, 14 Jun 1999 19:36:35 GMT
From: jboes@qtm.net
Subject: Re: Insidious 'use constant' syntax bit me
Message-Id: <7k3lk2$1ip$1@nnrp1.deja.com>
While I've got your attention: why aren't constants in 'require'd files
visible to the requiring code?
E.g., in 'foo.ph':
use constant FOO => 23;
1;
while in 'foo.pl';
require 'foo.ph';
print FOO;
print foo::FOO;
etc. Is there a way to make FOO visible without turning 'foo.ph' into a
package?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 18:46:07 GMT
From: classic_catering@my-deja.com
Subject: intetfacing database (csv) w/PERL
Message-Id: <7k3ild$9n$1@nnrp1.deja.com>
I'm trying to interface a CSV database-file with
PERL. I have my csv file and my .pl file. My
problem is searching the csv file for a string.
My webpage sends an arg
(ex. venue=the+national+aquarium)
then I parse the data. All that is great. I
open my file and read it in an array (@DB) then
close the DB file. My question is , how do I
name each of the fields I input from the DB file
and how do I search for a match from the query
string to the DB?? Any help would be greatly
appreciated as I am just learning PERL.
Thanks,
Rob
rkuryk@classiccatering.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 18:46:09 GMT
From: classic_catering@my-deja.com
Subject: intetfacing database (csv) w/PERL
Message-Id: <7k3ile$9o$1@nnrp1.deja.com>
I'm trying to interface a CSV database-file with
PERL. I have my csv file and my .pl file. My
problem is searching the csv file for a string.
My webpage sends an arg
(ex. venue=the+national+aquarium)
then I parse the data. All that is great. I
open my file and read it in an array (@DB) then
close the DB file. My question is , how do I
name each of the fields I input from the DB file
and how do I search for a match from the query
string to the DB?? Any help would be greatly
appreciated as I am just learning PERL.
Thanks,
Rob
rkuryk@classiccatering.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 18:46:07 GMT
From: classic_catering@my-deja.com
Subject: intetfacing database (csv) w/PERL
Message-Id: <7k3ilb$9m$1@nnrp1.deja.com>
I'm trying to interface a CSV database-file with
PERL. I have my csv file and my .pl file. My
problem is searching the csv file for a string.
My webpage sends an arg
(ex. venue=the+national+aquarium)
then I parse the data. All that is great. I
open my file and read it in an array (@DB) then
close the DB file. My question is , how do I
name each of the fields I input from the DB file
and how do I search for a match from the query
string to the DB?? Any help would be greatly
appreciated as I am just learning PERL.
Thanks,
Rob
rkuryk@classiccatering.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 20:04:45 GMT
From: nospam.newton@gmx.net (Philip 'Yes, that's my address' Newton)
Subject: Re: Large String handling
Message-Id: <37655f0b.214369194@news.nikoma.de>
On Fri, 11 Jun 1999 23:52:57 +0200, "F. Brekeveld"
<brekevel@worldonline.nl> wrote:
><TR><TD .........></TD></TR><TR><TD>......</TD></TR>
>
>I want everything between the <TR><TD> and </TD></TR> on a separate line
>for further processing
Well, if there's nothing else in the TR and TD tags (such as WIDTH,
COLSPAN, etc.), and only one TD tag per row, how about something along
the lines of:
s#(<TR><TD>)(.*?)(</TD></TR>)#$1\n$2\n$3\n#i;
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.net>
------------------------------
Date: 14 Jun 1999 21:03:56 GMT
From: ada@fc.hp.com (Andrew Allen)
Subject: Re: my() in a loop
Message-Id: <7k3qns$ip6$6@fcnews.fc.hp.com>
John Siracusa (macintsh@cs.bu.edu) wrote:
: For some reason, I have no qualms about doing "foreach my $var (...)",
: but balk at putting a my() inside the loop (as in example 2), preferring
: to declare those vars above the loop somewhere. Benchmarking seems to
: reveal that predeclaring all the my() vars before going through the loop
: (as in the first example) is the fastest method, but the second example
: seems more "popular" in ther Perl community.
The companion to DWIM (Do What I Mean) is SWYM (Say What You Mean). If
you don't need to maintiain variable values between loop iterations,
define them as "my" variables inside the loop. That way, there's no
way to "accidentally" get their values, and you've SWYM.
Andrew
------------------------------
Date: Mon, 14 Jun 1999 19:31:58 GMT
From: tbsmith@deltacom.net
Subject: Need this code tightened
Message-Id: <7k3lbe$1fn$1@nnrp1.deja.com>
if ($miles <= 30) {
$30{$_} = $miles;
} elsif ($miles <= 60) {
$60{$_} = $miles;
} elsif ($miles <= 90) {
$90{$_} = $miles;
} elsif ($miles <= 120){
$120{$_} = $miles;
}
$miles is different distances. Here I just categorize them. Later I'll
be printing out the lowest numbered hash with stuff in it. (The closest
locations in a certain radius). I pass the lowest hash like this:
if (%30) {
print "The location(s) within a 30 mile radius
around your zip code:<p>\n";
for (sort { $30{$a} <=> $30{$b} } keys %30) {
$line = $_;
$low_miles = $30{$_};
&print_primary(30)
}
} elsif (%60) {
print "The location(s) within a 60 mile radius
around your zip code:<p>\n";
for (sort { $60{$a} <=> $60{$b} } keys %60) {
$line = $_;
$low_miles = $60{$_};
&print_primary(60)
}
} elsif (%90) {
print "The location(s) within a 90 mile radius
around your zip code:<p>\n";
for (sort { $90{$a} <=> $90{$b} } keys %90) {
$line = $_;
$low_miles = $90{$_};
&print_primary(90)
}
} elsif (%120) {
print "The location(s) within a 120 mile radius
around your zip code:<p>\n";
for (sort { $120{$a} <=> $120{$b} } keys %120) {
$line = $_;
$low_miles = $120{$_};
&print_primary(120)
}
} else {
print "There were no locations closer than 120
miles to your zip code.\n";
}
There's gotta be another way to do it, with much less code.
Thanks
--
----------------
Todd Smith -japh
ITC^DeltaCom
tbsmith@deltacom.net
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 16:57:10 -0400
From: "Bob Perini" <perini@buffalo.edu>
Subject: Netscape problem
Message-Id: <7k3qkj$7es$1@prometheus.acsu.buffalo.edu>
I have a script that I am trying to run, and when I try to run the script,
netscape doesn't run it at all, but instead asks to save the file. This
script works fine on Internet Explorer.
What general problem causes a perl program to try to save in netscape?
Thanks,
--
Bob Perini
Walkway Node Instructional Programmer
"You think Y2K is a bad? Could you imagine
the panic and fear when they went from B.C.
to A.D.?" - Peter Lynch
------------------------------
Date: 14 Jun 1999 14:34:12 PDT
From: Eric Dennis <ericd@nospam.comtelligence.net>
Subject: Re: Netscape problem
Message-Id: <376575AF.EB4B56C6@nospam.comtelligence.net>
It sounds like your script is sending back a Content-type that Netscape
is choking on. Perhaps a partial listing would help...it would also be
helpful to know what web server software you are using.
--
Eric Dennis (ericd at comtelligence dot net)
System Administrator
Comtelligence, LLC
P.O. Box 5200 PMB:340
Anaheim, CA 92804
Bob Perini wrote:
>
> I have a script that I am trying to run, and when I try to run the script,
> netscape doesn't run it at all, but instead asks to save the file. This
> script works fine on Internet Explorer.
> What general problem causes a perl program to try to save in netscape?
>
> Thanks,
>
> --
> Bob Perini
> Walkway Node Instructional Programmer
> "You think Y2K is a bad? Could you imagine
> the panic and fear when they went from B.C.
> to A.D.?" - Peter Lynch
------------------------------
Date: Mon, 14 Jun 1999 16:40:31 -0500
From: "Mark Lewis" <mlewis@worldnetcorp.com>
Subject: Perl / Sybase Opening
Message-Id: <929396951.130.38@news.remarQ.com>
Dear Consultant,
My client (Financial Instituation) is seeking 2
Perl / Sybase consultants for a 6+ month assignment in Downtown Chicago.
The client needs the consultants to be strong in Perl Scripting in order to
put together end of day jobs for the client.
Please include rate, start date and 1099 / W2 status.
Please send all qualified resumes, including rate to:
mlewis@worldnetcorp.com
Thanks and have a great day.
Mark
=========================
Mark Lewis
Worldnet Corporation
888-226-6758x18
mlewis@worldnetcorp.com
=========================
------------------------------
Date: Mon, 14 Jun 1999 21:25:12 GMT
From: jtc@bc.sympatico.ca (Jason)
Subject: Re: PERL tutorial
Message-Id: <376572fb.8853152@news.bctel.ca>
On 13 Jun 1999 21:37:16 GMT, John Callender <jbc@shell2.la.best.com>
wrote:
I am a university student just learning CGI scripts.
A great tutorial ....thanks for the help!!
>3) My own more modest example, which focuses on using Perl for CGI
>scripting, is at:
>
>http://www.lies.com/begperl/
Cheers,
Jason
"Good judgment comes from experience, and a lot of that comes
from bad judgment."
------------------------------
Date: Mon, 14 Jun 1999 20:51:29 GMT
From: Mitch <portboy@home.com>
Subject: Polling a file?
Message-Id: <3764FB7C.DB02AEF2@home.com>
I need to continually "poll" a file to see when that particular file has
been changed. I've searched through the perldocs and various Camel
books, and haven't found an example. The only way I figured this could
be done was to look at the modification times. However, I have a
fundamental question. If I open the file for reading, and do nothing to
it, does the modification time change or only the access time? Also,
how can I constantly poll a file to see if it has changed, and if so
throw some message to the user?
Thanks, .mitch
------------------------------
Date: 14 Jun 1999 17:18:05 -0400
From: serge@panix.com (umask 077)
Subject: Q: listing all currently installed modules
Message-Id: <7k3rid$6si$1@panix3.panix.com>
Keywords: Perl5 modules
Hi there!
How can I get a list of all Perl modules installed on a particular
machine? I have Perl 5.004_04 on HP-UX 10.20 and need to submit a
list of Perl modules to our S/A so that he can install exactly
the same set on another machine. Seeing module version numbers
in the installed modules list would be a great help too.
Please reply to serge@panix.com
Many thanks in advance,
Sergey
------------------------------
Date: 14 Jun 1999 21:18:55 GMT
From: John Callender <jbc@shell2.la.best.com>
Subject: Re: Redirection but no 'Back'
Message-Id: <376571bf$0$222@nntp1.ba.best.com>
Mike <mike@5starserv.com> wrote:
> I am using the perl script redir.pl which I understand to be a pretty
> common script in use. I am experiencing a problem that I cannot figure
> out. The script executes fine and sends the user to another site. If
> the user clicks his/her 'back' button, they are not sent back to the
> page with the script, they remain at the site to which they were
> redirected.
> Is this the way the script was made to work? If not, have I configured
> it incorrectly?
> Could it be a problem with the page at the other site?
1. People will tell you this has nothing to do with Perl, and imply
that you are a bad person for posting about it in comp.lang.perl.misc.
They are right (it does have nothing to do with Perl), but you could
not have been expected to know that (for certain values of 'expected'
that I happen to use; I know others will disagree on this point), so
they are also wrong (you are not a bad person for posting about it
here). In any event, if you can refrain from posting that particular
question in this particular newsgroup in the future, it will make the
tidy-newsgroup types a teency bit less unhappy than they otherwise
would be. A better place would probably be
comp.infosystems.www.authoring.cgi.
2. The answer you're looking for is probably this: All a redirection
script does is print out a "Location: http://www.somewhere.com/\n\n"
header, which, when sent back to your browser, causes your browser to
request the page at http://www.somewhere.com. Backing up from that page
means that the browser will run the redirection script again, and get
the same Location: header sent back to it, and thus go right back to
the page that the redirection points to (i.e., the page you were on
when you hit the "Back" button). Nothing's broken; that's just how the
Web works (or doesn't, in this particular case).
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: Mon, 14 Jun 1999 19:34:10 GMT
From: Vicuna <vicuna@my-deja.com>
Subject: regex to replace quotes delimited by quotes.
Message-Id: <7k3lfi$1gj$1@nnrp1.deja.com>
Greetings.
Task: strings must have delimiting quotes but also maybe quotes within
my $example = '123 "She said: "What you say""';
my $example2 = ' "sometimes " there is a stray";
all quotes between outer most quote must be replaced by two quotes;
$example = '123 "She said: ""What you say"""';
$example2 = ' "sometimes "" there is a stray";
My work:
s/"(.*)"/$_=$1;s|"|""|g;'"'.$_.'"'/e;
Challenge: more elegent solution? Perhaps wrong am I?
~V~
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 14 Jun 1999 13:46:47 -0700
From: "Robert Giuli [Temp]" <show@netcom.com>
Subject: Re: Regular Expressions
Message-Id: <37656A37.E1E3359E@netcom.com>
THIS IS A TEST - PLEASE IGNORE THIS
---------------------
Gareth Rees wrote:
> Andrea L. Spinelli <aspinelli@ismes.it> wrote:
> > Or the first number after any non-digit characters
> >
> > /^\D*(\d+)/
>
> Which is the same as
>
> /(\d+)/
>
> since Perl's regexp engine returns the leftmost match.
>
> --
> Gareth Rees
------------------------------
Date: Mon, 14 Jun 1999 15:55:48 -0500
From: "AEF" <aef@pangea.ca>
Subject: Re: Sort on mtime
Message-Id: <7k3q7v$uco$1@pumpkin.pangea.ca>
Jonathan Stowe <gellyfish@gellyfish.com> wrote in message
news:7k08e0$ib$1@gellyfish.btinternet.com...
> On Sat, 12 Jun 1999 21:20:26 -0500 AEF wrote:
> my $base_dir = shift;
>
> my %filedate;
>
> opendir(DIR, $base_dir) || die "Can't open $base_dir\n";
>
> my @files = map { $base_dir . '/' . $_ } grep !/^.{1,2}$/, readdir(DIR);
Jonathan:
Thanks.
Got it going. Questions...
I tried to find info on the up the
grep !/^.{1,2}$/
with little success about the explanation. What is happening with {1,2}?
Basically, could you please explain the search "not" matching...
Also, I got a error for opening the $base_dir, with the lexical scope, and
the
my $base_dir = shift;
Is there a reason for using the lexical scope? Works fine without it!
------------------------------
Date: Mon, 14 Jun 1999 23:55:06 +0200
From: jan.dubois@ibm.net (Jan Dubois)
Subject: Re: win32: vba2perl
Message-Id: <376b782f.14032567@news3.ibm.net>
[mailed & posted]
shr28@my-deja.com wrote:
>I would like to use perl to open an excel workbook which
>has links to a DDE server. The VBA syntax is as follows:
>
>Workbooks.Open FileName:="G:\shami\RBC\converts\CONVPX.xls",
>UpdateLinks:=0
>
>I'm not sure what the equivalent perl Open statement should be. I've
>tried passing the UpdateLinks=0 as an optional parameter, but that
>doesn't seem to be working. Does anyone have any ideas?
my $book = $excel->Workbooks->Open({
Filename => 'G:\shami\RBC\converts\CONVPX.xls',
UpdateLinks => 0
});
should do it.
-Jan
------------------------------
Date: Mon, 14 Jun 1999 21:38:27 GMT
From: Mitch <portboy@home.com>
Subject: Writing to a pipe...??
Message-Id: <3765067E.278C7DD9@home.com>
How can I write one byte to a file named (uhhhh) /cpipe that will be
acting as a pipe? Now, I don't need to receive anything from this pipe,
however, there will be other process listening to this "pipe", and when
a particular byte has been written, the other process will act
accordingly.
Thanks, .mitch
------------------------------
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 5993
**************************************