[12944] in Perl-Users-Digest
Perl-Users Digest, Issue: 354 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 3 19:07:23 1999
Date: Tue, 3 Aug 1999 16:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 3 Aug 1999 Volume: 9 Number: 354
Today's topics:
Re: [offtopic]RE:Quot St and the Jeop Gm <cassell@mail.cor.epa.gov>
Re: Announcement: "CRAP" (Abigail)
can Perl send e-mail with attached files? nothlit@my-deja.com
Re: can Perl send e-mail with attached files? (Sam Holden)
Re: can Perl send e-mail with attached files? (K. Krueger)
Re: Copying a file <tchrist@mox.perl.com>
Re: Copying a file <cassell@mail.cor.epa.gov>
Good method of "locking" kirk@kaybee.org
Re: Good method of "locking" <tchrist@mox.perl.com>
Re: help with find command (Mike Bristow)
Re: How to compare two files and get the differences ? <factory@factory.co.kr>
Re: How to compare two files and get the differences ? <emschwar@rmi.net>
Re: modifying vars in modules <geoff.horsnell@cdc.com>
Re: mySql & Perl -> Something simple (Malcolm Ray)
Re: Newbie Q: Removing files from a folder (Larry Rosler)
Re: Perl and Oracle using DBI <makarand_kulkarni@my-deja.com>
Re: Perl seems to be LAME! <neutron@verinet.com>
Re: Perl seems to be LAME! (Matthew Bafford)
Re: Perl seems to be LAME! <makarand_kulkarni@my-deja.com>
Re: Perl seems to be LAME! <tchrist@mox.perl.com>
Read the FAQs: CGI/Perl question (Jim Hutchison)
Re: server-side databases <cassell@mail.cor.epa.gov>
Strange STDOUT on script, any ideas? <tom.kralidis@ccrs.nrcanDOTgc.ca>
Talking to a ksh script <gregory_guerin@hp.com>
Re: tar <cassell@mail.cor.epa.gov>
Re: tar (I R A Darth Aggie)
Re: tar (I R A Darth Aggie)
Re: tar <makarand_kulkarni@my-deja.com>
Re: tar (Larry Rosler)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 03 Aug 1999 15:38:32 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: [offtopic]RE:Quot St and the Jeop Gm
Message-Id: <37A76F68.DC0B5084@mail.cor.epa.gov>
llornkcor wrote:
>
> Because I thought I would try and stand up for over abused newbies here, and
> try to make it better, and nicer place to
> get perl help.
That's a worthwhile goal. But refusing to abide by reasonable
guidelines to the point that it ticks everyone else off isn't
a good way to progress. What's so bad about a newsgroup having
a few rules set down by its *creators* and then asking others
to live by them?
Does Tom C. come into your house, get sick on your
furniture, and say "Hey, that's fine in *my* house, you should
like it!" Oh, he did? No wonder you're ticked. :-)
Did you go play high school football without pads, then get
hammered, and complain because everyone else was wearing
a helmet and a uniform? No.
When you traveled to France, did you curse them for speaking
weird stuff you didn't understand, and then complain about
the bizarre dwarf-sized water fountain in the bathroom?
No. [Although I suspect Dan Quayle did.]
When you go to someone else's culture, you politely learn
what is acceptable and what is not. You don't spout off
about how they're insisting on doing it wrong.
> But obviously this list thinks it is moderated, and those
> *perl-gawhds* obviously don't have a compassionate bone in their bodies.
Every newsgroup has the right to self-determination. And
every newsgroup handles that right differently. Have you
seen how this issue gets handled elsewhere? Of course you
have. Have you noticed that some groups descend into total
anarchy, with no control over the quality of the answers?
Oh, you've been in alt.perl already. Have you noticed
that some newsgroups are a *lot* harder than here?
> It's too bad, cause perl is a wonderful tool.
Yes. And because of the wide variety of areas Perl touches,
it is sometimes hard to decide whether a post is on-topic.
And sometimes one doesn't feel qualified to answer. And
sometimes one makes a mistake, and then just admits it and
continues. I certainly can't claim to be infallible here.
Compassionate but well-informed responses really do have
a place here. If you would just work with us instead of
against us, this could be a kinder place.
> It was worth a try...
It was. I had hopes for you. Couldn't you just try to:
[1] check the FAQ before answering; and
[2] post in the standard Usenet style.
Oh well, it would have been nice...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 3 Aug 1999 17:45:58 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Announcement: "CRAP"
Message-Id: <slrn7qes49.s35.abigail@alexandra.delanet.com>
Bart Lateur (bart.lateur@skynet.be) wrote on MMCLXIII September MCMXCIII
in <URL:news:37a7cfb7.17963440@news.skynet.be>:
## Abigail wrote:
##
## >,, RFC 2396 made ~ unreserved. No need to escape it.
## >
## >True, due to the sillyness of NCSA and lusers not able to grasp the
## >concept of escaping. But there was good reason RFC 1738 forbid the use
## >of ~. Ever seen a ~ in, say, a newspaper? Did it look like one?
##
## And yet, it is plain Ascii. This is a pure computer application, so
## printing it on paper is irrelevant. It isn't reserved for some special
## purpose. So, why the need to escape it?
Uhm. Sure. You've never seen a URL outside of a computer screen, right?
You've never told anyone a URL? You've never written down a URL?
Just because it happens to work in the cases you use it in, doesn't
mean it's a good idea.
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Tue, 03 Aug 1999 22:07:18 GMT
From: nothlit@my-deja.com
Subject: can Perl send e-mail with attached files?
Message-Id: <7o7p6e$748$1@nnrp1.deja.com>
I know that Perl can easily be used to send e-
mail by piping into the sendmail program, and I
have used this many times. But is there a way to
attach a separate file (ascii or binary) to an e-
mail sent using Perl? For example, I'd like
people who visit my site to be able to upload fan
fiction stories using a typical INPUT TYPE="file"
form field. I would then like to have a Perl
script send me that file attached to an e-mail.
Is this possible?
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Aug 1999 22:31:05 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: can Perl send e-mail with attached files?
Message-Id: <slrn7qerdr.oet.sholden@pgrad.cs.usyd.edu.au>
On Tue, 03 Aug 1999 22:07:18 GMT, nothlit@my-deja.com wrote:
> For example, I'd like
>people who visit my site to be able to upload fan
>fiction stories using a typical INPUT TYPE="file"
>form field. I would then like to have a Perl
>script send me that file attached to an e-mail.
>Is this possible?
Have a look at the CGI and MIME::Tools (MIME::Entity specifically) modules.
--
Sam
There's no such thing as a simple cache bug.
--Rob Pike
------------------------------
Date: 3 Aug 1999 15:40:17 -0700
From: kirbyk@best.com (K. Krueger)
Subject: Re: can Perl send e-mail with attached files?
Message-Id: <7o7r4h$a1s$1@shell2.ba.best.com>
In article <7o7p6e$748$1@nnrp1.deja.com>, <nothlit@my-deja.com> wrote:
>I know that Perl can easily be used to send e-
>mail by piping into the sendmail program, and I
>have used this many times. But is there a way to
>attach a separate file (ascii or binary) to an e-
>mail sent using Perl? For example, I'd like
>people who visit my site to be able to upload fan
>fiction stories using a typical INPUT TYPE="file"
>form field. I would then like to have a Perl
>script send me that file attached to an e-mail.
>Is this possible?
>
>
Certainly. Look at Mail::Mailer and Net::SMTP for
two modules that can help with this.
This is also the cover story in the latest Perl Journal,
highly recommended for anyone seriously interested in
perl, that goes into some depth. Look at:
http://www.tpj.com for details.
--
Kirby Krueger O- kirbyk@best.com
<*> Lips that taste of tears, they say, are the best for kissing - D. Parker
------------------------------
Date: 3 Aug 1999 16:21:58 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Copying a file
Message-Id: <37a76b86@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
jimtaylor5@aol.com (Jimtaylor5) writes:
:I'm trying to find information on copying a file, and yes, I have read the FAQ.
:Even searched Cspan and the entire web for copy files in perl and get
:absolutely no information on what seems to me should be a simple task (being a
:newbe and ignorant of what's difficult and easy).
This has got to be one of the most basic of programming problems
you get in the seventh grade.
A shell programmer is taught:
cp oldfile newfile
A Perl programmer is taught:
while (<>) {
print;
}
A C programmer is taught:
#include <stdio.h>
main() {
int ch;
while ((ch = getchar()) != EOF) {
putchar(ch);
}
}
There are infinite elaborations on this, like opening files implicitly,
maintaining permissions, checking error returns, producing proper
messages, understanding directories, using fancydancyprancy modules, &c.
But this is very basic stuff. It's better if you work it out on your own.
You'll learn a lot that way.
--tom
--
This is the typical life of any Unix administrator. Most user/system problems
tend to read just like detective novels. Sometimes we win, sometimes we
reboot. --Albert Viall alv@cray.com
------------------------------
Date: Tue, 03 Aug 1999 15:24:11 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Copying a file
Message-Id: <37A76C0B.1E53E8FE@mail.cor.epa.gov>
Jimtaylor5 wrote:
>
> I'm trying to find information on copying a file, and yes, I have read the FAQ.
Excellent! That's a good start. Have you learned how to
use 'perldoc' to look up FAQ entries and/or module info and/or
functions? It's a tool worth using if you're new at this,
even if TomC hates its kludgy little guts.
> Even searched Cspan and the entire web for copy files in perl and get
I know you meant CPAN there.
> absolutely no information on what seems to me should be a simple task (being a
> newbe and ignorant of what's difficult and easy). I don't want to rename the
> file, just copy ABC.gif to DEF.gif. I want to retain the original. can anyone
> tell me how I would go about doing this "or" if that's too difficult, where I
> might find the information on it?
> Thanks in advance for any direction or info you can give me.
The module File::Copy which comes with every proper install
of Perl. Type this at a command prompt:
perldoc File::Copy
Since you're posting from AOL, you probably have a win32 box.
You can download ActiveState Perl and get the docs in an
HTML tree with a shortcut dropped onto your Start Menu so
you can read them in your favorite browser.
Then you write you code like this:
use File::Copy;
copy("file1","file2");
Voila!
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 3 Aug 1999 22:44:31 GMT
From: kirk@kaybee.org
Subject: Good method of "locking"
Message-Id: <7o7rcf$ap9$1@news-int.gatech.edu>
I have a program and I need to make sure that only one instance is ever
run at the same time.
One way I thought of was to check for a lock file, and then create it if
it isn't there. The problem is that there is a race condition if
somebody was to somehow start the program twice at the same instance of
time. The other problem is that if the program terminates abnormally,
the lock file will be left behind.
I was thinking of (on Linux primarilly) opening the program's config
file and then calling 'flock' on it. If I get an exclusive lock, then
all is good and I unlock it on exit. I assume that if the program exits
abnormally, the lock will also be released. If I don't get a lock, I
quit because it means another process is running.
Does this sound like a good way of doing it? Is there another way that
would be better?
--
Kirk Bauer -- CmpE, Georgia Tech -- kirk@kaybee.org -- Avid Linux User
GT Sport Parachuting Club! http://cyberbuzz.gatech.edu/skydive
Opinions expressed are my own, but they should be everybody's.
------------------------------
Date: 3 Aug 1999 16:59:45 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Good method of "locking"
Message-Id: <37a77461@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, kirk@kaybee.org writes:
:Does this sound like a good way of doing it?
Yes.
--tom
--
"I just had a vision of a T3 line with a large suspicious-looking bulge
propagating down it ... going "mmooooooo??" ..."
-- David DeLaney
------------------------------
Date: Tue, 03 Aug 1999 22:20:16 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: help with find command
Message-Id: <slrn7qeqp0.l42.mike@lindt.fat.dotat.at>
On Tue, 03 Aug 1999 21:46:41 GMT, mr_potato_head@my-deja.com <mr_potato_head@my-deja.com> wrote:
>Hi,
> Can anyone tell me how to convert this csh command line into perl so
>I can put it in my perl script? Thanks in advance...
>
>find /u1 -name "*99*" -mtime +3 -exec rm -r {} \;
man find2perl.
--
Mike Bristow, Geek-At-Large. GK/RT0038
one tequila - two tequila - three tequila - FLOOR !!!
------------------------------
Date: Wed, 4 Aug 1999 07:23:40 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: Re: How to compare two files and get the differences ?
Message-Id: <7o7pjc$3ht$1@news1.kornet.net>
Thank you and sorry for bother all you guys.
Unfortunatly, It is too hard for me. I can't handle this through your
directions.
Let me get more advice for this , please.
I explain more about what I'm trying.
I have a new data file and a backupfile.
There are directory information on second field at each line.
If certain lines are deleted on new file, but still in backup file, I wnat
to get the directory information at second field of deleted lines,
and want to delete the directory from my server.
How, ....... please.
Abigail ÀÌ(°¡) ¸Þ½ÃÁö¿¡¼ ÀÛ¼ºÇÏ¿´½À´Ï´Ù...
>Yeong Mo/Director Hana co. (factory@factory.co.kr) wrote on MMCLXII
>September MCMXCIII in <URL:news:7o5128$cp5$1@news1.kornet.net>:
>@@ With your solution, it going to be work.
>@@ However, I have no idea hwo to handle the two lines.
>@@ my $all = "?????";
>@@ my $takeout = "?????";
>@@ Would you please give me more directions ?
>
>Here's a hint: hire someone with a clue.
>
>@@ Thank you in advance.
>@@
>@@ The following code is what I am trying;
>@@ open(FILE, "$page_dir/link/data/categories.backup") || die "I can't open
>@@ that file of $dbdata\n";
>@@ flock (FILE,1) or die "can't lock index file\n";
>@@ @lines = <FILE>;
>@@ close(FILE);
>@@ $sizelines = @lines;
>@@ for ($i=0;$i<$sizelines;$i++) {
>@@ ($f1, $categorybackup, $f2, $f3, $f4, $f5, $f6, $f7) = split ('\|',
>@@ $lines[$i]);
>@@ $catall= "$categorybackup,";
>@@ }
>
>Well, if that's what you want, why not:
>
>open FILE, "$page_dir/link/data/categories.backup" or
> die "I can't open that file of $dbdata\n"; # What's $dbdata, and why
> # isn't there a $!?
>flock FILE, 1 or die "Cannot lock index file\n"; # Where's the $!?
>my $line;
>1 while $line = <FILE>;
>my $catall = ((split '\|', $line, 3) [1]) . ",";
>
>
>After all, you're discarding everything but the result of the last line.
>Putting in everything in an array is inefficient if you're going to
>process the lines one by one anyway. And do use Perl idiom instead of
>C idiom to loop over arrays. If you want C - you know where to get it.
>
>But I think you want something else. What, that remains totally unclear.
>Please, consider hiring someone with programming experience.
>
>
>@@ use strict;
>@@
>@@ my $all = "";
>@@ my $takeout = "";
>@@
>@@ my %takeout;
>@@ @takeout{split /,\s*/ => $takeout} = ();
>
>Since $takeout is equal to "", why don't you just write:
> my %takeout = ("" => undef);
>
>Or perhaps you want something else?
>
>@@ my $remain = join ', ' => grep !exists $takeout{$_} =>
>@@ split /,\s*/ => $all;
>@@ print "$remain\n";
>
>
>Well, given that $all equals "", a split will result in (""), which happens
>to be the only key in %takeout, so it's filtered out. Hence, $remain
becomes
>"", and all the print does is printing a newline.
>
>I doubt that is what you want.
>
>What you do want is to hire someone with a clue.
>
>
>
>
>Abigail
>--
>sub camel
(^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
>h[{e
**###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
>c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278
@#@);
>print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.|
|d)&&$llama."\n");
>
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News
==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
>------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers
==-----
------------------------------
Date: 03 Aug 1999 16:47:05 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: How to compare two files and get the differences ?
Message-Id: <xkf3dy0mqhi.fsf@valdemar.col.hp.com>
"Yeong Mo/Director Hana co." <factory@factory.co.kr> writes:
> Thank you and sorry for bother all you guys.
> Unfortunatly, It is too hard for me. I can't handle this through your
> directions.
Then I suggest you hire someone who knows how to write Perl.
> Let me get more advice for this , please.
My advice: Hire someone who knows what they're doing.
> I explain more about what I'm trying.
> I have a new data file and a backupfile.
> There are directory information on second field at each line.
> If certain lines are deleted on new file, but still in backup file, I wnat
> to get the directory information at second field of deleted lines,
> and want to delete the directory from my server.
>
> How, ....... please.
First off, don't quote 94 lines without responding to any of them.
That's just rude. Second, please place your responses *after* the text
you're responding to. Third, please only quote the specific bits you're
replying to-- if we want to read the whole exchange, we can use Deja.com.
As for your question, the answer is simple: read in both files, and put
the directory information into one hash per file. Then apply the FAQ
(perlfaq4: "How do I compute the difference of two arrays? How do I
compute the intersection of two arrays?") to find the elements in the
backup file that are missing from the current file. "perldoc -f unlink"
to learn how to delete them.
If that isn't good enough, then I repeat my advice earlier: hire
somebody. This is a relatively small script, and should be cheap.
-=Eric
------------------------------
Date: Tue, 03 Aug 1999 23:39:04 +0100
From: Geoff Horsnell <geoff.horsnell@cdc.com>
Subject: Re: modifying vars in modules
Message-Id: <37A76F87.9FCA44BB@cdc.com>
Use the construct "@a = &module::f(@a);"
Inside the subroutine, return the array via a "return (@a);" statement.
That should give you the desired effect.
interuser@hotmail.com wrote:
> Hello
> I want to modify an array @a by calling a sub f from a module module
>
> ie
> i want module::f(\@a)
> to modify @a
>
> how do i do this?
>
> thanx
>
> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.
------------------------------
Date: 3 Aug 1999 22:58:19 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: mySql & Perl -> Something simple
Message-Id: <slrn7qet0b.161.M.Ray@carlova.ulcc.ac.uk>
On Tue, 03 Aug 1999 19:20:58 GMT, Mike <mgcon@neta.com> wrote:
>With the help of some folks on this group a while back I was able to begin
>putting some cgi scripts together. Now I am stuck again.
>
>The script below works just fine (i.e runs without errors), however, it
>doesn't return any values. This problem surely has some simple resolution
>to it, I just can't see it.
>
>Can someone throw me a bone or two?!
>
>TIA
>Mike
>---------------------------------------------------
>#!/usr/bin/perl -w
No 'use strict'! No -T flag!
>#---Define what is required---
>use DBI;
>use CGI;
>use CGI::Carp qw(fatalsToBrowser);
>
>#---Define Variables which require no input---
>$query = new CGI;
>$myHost = "localhost";
>$port = "3306";
>$drivername = "mysql";
>$myDb = "inventory";
>$myUser = "username";
>$myPasswd = "password";
>
>my $myFont = "<font color=\"#880000\">";
>my $logo = "<img src=/~mstarke/art/meg.jpg border=0>";
>
>$codeQuery = $query->param("codeQuery");
>
>$dsn = "dbi:$drivername:database=$myDb;host=$myHost;port=$port";
>$dbh = DBI->connect($dsn, $myUser, $myPasswd);
You don't check the return value of the connect. What happens if it
fails? You'll get an undef return, and errors on subsequent attempts to
use the handle.
>
>$statement = "SELECT Part_Number, Description, Price \
> from master \
> where code = $codeQuery";
Hmm, are you sure that $codeQuery can't contain anything which makes
that syntactically invalid? Since it comes from the user, it shouldn't
be trusted. You might like to quote it first, using the 'quote' method:
$statement = "SELECT Part_Number, Description, Price \
from master \
where code = " . $dbh->quote($codeQuery);
>
>$sth = $dbh->prepare($statement);
>
>$sth->execute;
Ok, you've executed the statement (still not checking for errors!).
>
>print "Content-type: text/html\n\n";
CGI.pm can do that for you, you know. As long as you're using CGI.pm,
it makes sense to let it insulate you as much as possible from the
gory details of HTTP headers and HTML. Look at the 'header' method.
>sub printMe{
Ugh, defining a sub in the middle of your code like that is bad style.
Move it out of the code flow.
>print<<HTML;
> <html>
> <body bgcolor="#ffffff">
> <center>
> $logo
> </center>
> <hr color="#880000">
> <p>
> The following $myFont $codeQuery</font> parts are listed below.
> <hr>
>HTML
Again, let CGI.pm do this for you. If you don't like the CGI.pm online
docs, I'd recommend investing in Stein's CGI.pm book, which is good.
>
>my $names = $query->param();
>print "<center><table border=1>\n";
>print "<tr bgcolor=000066>";
>foreach my $name (@$names)
Surely you meant:
my @names = $query->param();
print "<center><table border=1>\n";
print "<tr bgcolor=000066>";
foreach my $name (@names)
> {
> print "<th align=center><font color=\"cccccc\">$name</font></th>";
> }
>print "</tr>\n";
>my ($col, $gotdata);
>while (my @data = $sth->fetchrow_array)
> {
> print "<tr>";
> foreach $col (@data)
> {
> print "<td align=left>$col</td>";
> }
> print "</td>\n";
>
> }
>print "</table>\n";
>print "</body>\n";
>print "</html>";
>}
>
>$dbh->disconnect;
>&printMe
Hang on a minute: you disconnect and *then* you do the fetchrow_array?
This is wrong. If you check your error log, you'll probably see a message
something along the lines of 'disconnect invalidates 1 active statement'.
Don't disconnect until *after* you've called printMe.
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: Tue, 3 Aug 1999 15:14:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie Q: Removing files from a folder
Message-Id: <MPG.121109a65f7b7484989da8@nntp.hpl.hp.com>
In article <x3y1zdkekx8.fsf@tigre.matrox.com> on Tue, 3 Aug 1999
15:14:27 -0400 , Ala Qumsieh <aqumsieh@matrox.com> says...
>
> Andrew Fry <andrewf@beausys.freeserve.co.uk> writes:
>
> > I want a little utility that will tidy up various Win95/WinNT
> > folders for me ...
>
> So directories are being called "folders" these days? Interesting ..
<URL:http://x29.deja.com/[ST_rn=ps]/getdoc.xp?AN=504861089.1>
Subject: Re: Geekspeak Programming Contest
Date: 1999/07/24
Author: Tom Christiansen <tchrist@mox.perl.com>
directory = folder
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 03 Aug 1999 22:44:05 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: Perl and Oracle using DBI
Message-Id: <7o7rbj$8mg$1@nnrp1.deja.com>
> The pertinent Oracle environment variables set are:
> ORACLE_SID
> ORACLE_HOME
> ORACLE_USERID
Make sure you are setting these inside your script
if your script is a CGI program. Add this inside
BEGIN {}.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 03 Aug 1999 22:13:37 GMT
From: Jack Applin <neutron@verinet.com>
Subject: Re: Perl seems to be LAME!
Message-Id: <lQJp3.304$VPg.188427776@news.frii.net>
Moritz Mertinkat <bluebit@gmx.net> wrote:
> Perl seems to be LAME!
I think that German is a LAME language, because I can't speak a simple
sentence in it. It's not my fault--the language is LAME.
-Jack Applin
neutron@verinet.com
------------------------------
Date: Tue, 03 Aug 1999 22:36:39 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Perl seems to be LAME!
Message-Id: <slrn7qeqko.5cl.*@dragons.duesouth.net>
Moritz Mertinkat <bluebit@gmx.net>, thinking with his hands, posted the
following to comp.lang.perl.misc:
: Subject: Perl seems to be LAME!
It is.
That's why we all use various other languages.
Larry Wall even prefers Java to Perl.
: Thank you very much,
HTH,
: Moritz Mertinkat
--Matthew
------------------------------
Date: Tue, 03 Aug 1999 22:37:10 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: Perl seems to be LAME!
Message-Id: <7o7qul$8bq$1@nnrp1.deja.com>
> And with the search algorithm about 11 seconds!
The time taken depends on several factors like
kind of machine you are using, RAM it has, CPU Clock
Rate etc etc. It is not Perl related.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 3 Aug 1999 16:54:27 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl seems to be LAME!
Message-Id: <37a77323@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
bluebit@gmx.net writes:
: I'm using a text file (~1.11 MB) with about 10000 entries
: for searching. Now, when I just run through all the lines
: - without even doing *anything* - it takes up to 7 seconds!
: And with the search algorithm about 11 seconds!
:$found = 0;
:foreach $line (<FILE>) {
That's idiot-move number 1.
: $match = 0;
: foreach $term (@query) {
: # Perform case insensitive comparison
: if (!($line =~ /$term/i)) {
And that's idiot-move number two. You could probably
make this program slower if you tried, but you'd have
to work at it.
: if ($match == 1) {
Lame use of boolean #1.
: $found = 1;
:
: print "$line<br>\n";
: }
:
:}
:
:if ($found == 0) {
Lame use of boolean #2.
I'll let someone else tell you *why* these are idiot-moves.
I just hate reading documentation to people.
--tom
--
"Software engineering phase plans are something you make so your manager
can explain to his manager how things are going"
--Rob Pike (On the subject of managerial "bullshit")
------------------------------
Date: Tue, 03 Aug 1999 22:59:50 GMT
From: jimhutchison@metronet.ca (Jim Hutchison)
Subject: Read the FAQs: CGI/Perl question
Message-Id: <37a772e1.614743824@news1.cal.metronet.ca>
I've a perl script that grabs data from a very large file, and parses
it for GD graphing as well as text presentation. The beginning of the
script has some text telling the user to wait till the report is
generated, however nothing displays till the entire script is
finished.
My korn shell version of this job is much slower, but it DOES
initially display the comfort message right away, then continues to
execute the other instructions.
Any ideas? I'm running this on Apache.
Thnx in advance...
------------------------------
Date: Tue, 03 Aug 1999 15:07:00 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: server-side databases
Message-Id: <37A76804.C090AF48@mail.cor.epa.gov>
Peter wrote:
>
> If I want to build a server-side database for interaction with web pages
> what would be the best option?
It really depends on your own personal setup. How big a database do
you need? How many hits do you see now in a busy hour? How many hits
do you expect to see in a busy hour?
> Construct the database in Perl?
>
> or
>
> Construct the database in another language (I'm more familiar with Java
> ) and use Perl as a front end when making queries?
Well, Perl will make a good front end for database queries. But
it is not your only option. Still, you ought to consider some native
RDBMS [anything from DB_File up to Sybase] with a decent language
for the connection. Perl will do this using the DBI and DBD::*
modules in just a few lines.
> Any pointers to web sites that would help me with this subject would be
> greatly appreciated.
If you go to www.perl.com, you can search on topics, like 'CGI'
or 'database' or 'tutorial' and get a shedload of pointers.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 03 Aug 1999 18:47:34 -0400
From: Tom Kralidis <tom.kralidis@ccrs.nrcanDOTgc.ca>
Subject: Strange STDOUT on script, any ideas?
Message-Id: <37A77186.AC1C7506@ccrs.nrcanDOTgc.ca>
Hi,
I've written a script to move files in a dir to a dir based on their
filename. These files come in sets of twos: one image file, with a
matching text file for metadata.
I've used a foreach on all files to check the filename, search for the
dir path, create it if it does not exist, then move the files.
The files do reach their correct destination, and dirs are made (the
script is functional), but STDOUT returns messages of "No such file or
directory. It looks like it is looking for files that have been already
moved.
foreach $input (<*.txt>)
{
$north = $1 and $east = $2 if $input =~ /(N\d{2})d\d{2}m(W\d{3}).*/;
if ( -d "/user/home/img/$east/$north")
{
system("mv $north*$east* /user/home/$east/$north/");
}
else
{
mkpath(["/user/home/$east/$north"], 1, 0775);
system("mv $north*$east* /user/home/$east/$north/");
}
}
Does anyone have any ideas as to why this is hapenning? Any advice
would be appreciated.
Thanks
..Tom
------------------------------
Date: Tue, 03 Aug 1999 16:56:20 -0600
From: Greg Guerin <gregory_guerin@hp.com>
Subject: Talking to a ksh script
Message-Id: <37A77394.CD30D556@hp.com>
I wrote the following code to try to answer several different questions
that the test.ksh script prompts with. The first answer works fine but
the second doesn't receive the WRITE string 'n'. There are more than
two questions but I am just trying to get past # 2 right now. Any
suggestions would be appreciated!
#!/opt/perl5/bin/perl
use FileHandle;
use IPC::Open2;
$pid = open2(\*READ, \*WRITE, "test.ksh");
print WRITE "y";
print WRITE "n";
close(WRITE);
while ($line = <READ>) {
print $line;
}
close(READ);
exit 0;
Regards,
Greg Guerin
mailto: gregory_guerin@hp.com
------------------------------
Date: Tue, 03 Aug 1999 15:13:39 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: tar
Message-Id: <37A76993.D714AE5F@mail.cor.epa.gov>
Peter wrote:
>
> I don't really know that much about unix, but if I download a file of
> type .tar how do I open/decompress it?
You use 'tar', just like it says in the tar manpage.
tar -xvf
I really hope you were downloading some Perl programs from
CPAN, because otherwise I have no idea why you would be asking
that quesiton here, rather than in a unix newsgroup where
you would get *reliable* answers, instead of having to depend
on a total stranger who is sending you this from a win32
machine. But seriously folks, asking in a sub-optimal
newsgroup can do much worse than get you yelled at. It can
get you bad answers and cargo-cult responses and pointers
to misinformed websites. If you ask in the most appropriate
newsgroup and you get a bad answer, everyone else there will
jump on the poster and correct (him|her|it) so you get the
correct answer and you know it.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 3 Aug 1999 22:06:39 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: tar
Message-Id: <slrn7qeq3l.vl8.fl_aggie@thepentagon.com>
On Tue, 3 Aug 1999 16:38:38 -0500, Paul Glidden <paul.glidden@unisys.com>, in
<7o7ngs$5ru$1@eanews1.unisys.com> wrote:
+ Peter wrote in message <37A75A99.5C9C@ukc.ac.uk>...
+ >I don't really know that much about unix, but if I download a file of
+ >type .tar how do I open/decompress it?
+
+ tar -xvf filename
+
+ secondly, UNIX for dummies
And either 'man tar' or 'man -k tar' might be of passing interest...
James
------------------------------
Date: 3 Aug 1999 22:07:34 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: tar
Message-Id: <slrn7qeq5c.vl8.fl_aggie@thepentagon.com>
On 3 Aug 1999 15:55:05 -0700, Tom Christiansen <tchrist@mox.perl.com>, in
<37a76539@cs.colorado.edu> wrote:
+ The program is called, surprisingly enough, "tar". :-)
And who says TC can't be nice to beginners?
James
------------------------------
Date: Tue, 03 Aug 1999 22:39:46 GMT
From: Makarand Kulkarni <makarand_kulkarni@my-deja.com>
Subject: Re: tar
Message-Id: <7o7r3h$8co$1@nnrp1.deja.com>
> type .tar how do I open/decompress it?
..and if you have a file with extension ().tar.gz then
uncompress it using gunzip and then un-tar it using tar.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 3 Aug 1999 15:45:12 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: tar
Message-Id: <MPG.121110d6aee93562989da9@nntp.hpl.hp.com>
In article <slrn7qeq5c.vl8.fl_aggie@thepentagon.com> on 3 Aug 1999
22:07:34 GMT, I R A Darth Aggie <fl_aggie@thepentagon.com> says...
> On 3 Aug 1999 15:55:05 -0700, Tom Christiansen <tchrist@mox.perl.com>, in
> <37a76539@cs.colorado.edu> wrote:
>
> + The program is called, surprisingly enough, "tar". :-)
>
> And who says TC can't be nice to beginners?
Indeed.
He forgot to add that 'tar' comes from 'Tape ARchive', which relates to
a utility called 'ar' that makes archives. The tapes are long gone, of
course.
And a '.tar' file has come to be called a 'tarball' for some reason or
other. Though 'tarbaby' might be better (per Uncle Remus).
And now we return you to your regularly scheduled Perl program.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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 V9 Issue 354
*************************************