[17751] in Perl-Users-Digest
Perl-Users Digest, Issue: 5171 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 21 11:05:35 2000
Date: Thu, 21 Dec 2000 08:05:10 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <977414710-v9-i5171@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 21 Dec 2000 Volume: 9 Number: 5171
Today's topics:
Re: automatic FAQ answerer idea <valb@vtek.com>
Re: automatic FAQ answerer idea (Tad McClellan)
Re: bug in open() (Brandon Metcalf)
Re: bug in open() <joe+usenet@sunstarsys.com>
Death and Jeopardy (Tom Christiansen)
Re: FAQ 5.4: How do I make a temporary file name? <cleon42@my-deja.com>
Re: FAQ 5.4: How do I make a temporary file name? (Tom Christiansen)
file upload for winNT <svwasan@lucent.com>
Re: file upload for winNT <mkuin@globalrangers.com>
Re: getting data <cleon42@my-deja.com>
Re: getting data (Tom Christiansen)
Re: If I don't want to 'goto' <ubl@schaffhausen.de>
Re: is this bad perl programming habit? <rick.delaney@home.com>
Re: Language evolution C->Perl->C++->Java->Python (Is P <jason@harlequin.com>
Re: Language evolution C->Perl->C++->Java->Python (Is P mexicanmeatballs@my-deja.com
Looking for a Canadian PERL/CGI programmer ignition78@my-deja.com
Re: ok <mjcarman@home.com>
Re: perl DBI (Garry Williams)
Re: perl DBI (Randal L. Schwartz)
Re: print to html problem ignition78@my-deja.com
Reorder array via for <bh_ent@my-deja.com>
Re: Reorder array via for <mkuin@globalrangers.com>
Select(2) and Term::Readkey delanthear@my-deja.com
Re: Select(2) and Term::Readkey <dorsettest@uk.insight.com>
Re: SSI in perl output <ubl@schaffhausen.de>
Re: very strange thing with closures <tech3@us-it.net>
Re: very strange thing with closures <ubl@schaffhausen.de>
Re: very strange thing with closures patrick_k6801@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 21 Dec 2000 09:47:03 -0500
From: "Val Bykoski" <valb@vtek.com>
Subject: Re: automatic FAQ answerer idea
Message-Id: <91t57v$4g32q$1@ID-62387.news.dfncis.de>
Hi Logan:
Sounds good to me... Being practically useful,
the tool will show the reach of Perl into advanced knowledge
processing areas.
Val Bykoski (val@vtek.com)
"Logan Shaw" <logan@cs.utexas.edu> wrote in message
news:91s8gi$h9v$1@boomer.cs.utexas.edu...
> Hi everyone.
>
> I've noticed lately a lot of trouble with people asking questions
> that are answered in the FAQ. They may ask on the newsgroup
> because they don't know where the FAQ is, don't know how to use
> it, don't know that it exists, or just because they're too lazy.
>
> But why they do it isn't the point. The point is that it happens and
> it would be nice if something constructive could be done about it.
>
> I was thinking about this problem, and it suddenly occurred to me that
> maybe something really can be done about it. So, here's my idea.
>
> As a former sysadmin turned college student, I had the opportunity
> to take an artificial intelligence class this last semester, and I
> learned (among other things) a little about automatic text
> categorization. Most importantly, I learned that tools to do it
> already exist, and that they can be pretty accurate in many
> cases. Given a bunch of documents and their correct categories,
> such a tool can construct a database that it can use to categorize
> new documents it hasn't seen before. It will even give a
> probability that a document belongs in the category it suggests.
>
> So, what I propose is the construction of a system that would run
> every new article posted to comp.lang.perl.misc through a text
> categorization engine and look at the result. If the engine says,
> "Hey, there is a greater than 90% chance that this article falls
> into the category called 'questions that are equivalent to FAQ
> question number #41'", then the system would post the answer to
> the newsgroup so that the original asker and others could see it.
>
> There are some difficulties, but I think I can see ways to get
> around many of them. False matches (which would result in unwanted
> automatic postings!) could be reduced with several heuristics such
> as not considering articles with non-blank References: headers or
> articles with low rates of certainty for the categorization.
>
> The biggest difficulty would probably be the fact that the system
> would have to be trained. In order to learn how to do the
> categorization accurately, it would need to know the correct
> categorizations for a bunch of articles. This could be
> accomplished in a number of ways, such as special keywords that
> could be inserted into replies by humans; these keywords would
> alert the system that a particular post was an FAQ, and the system
> would use that as its training data. Or, a web-based interface
> could be used as well. (And, either approach could be used to
> improve performance later on as well, by correcting the system
> when it guesses wrong and letting it know when it guesses right.)
>
> Does this sound like an interesting idea to anyone?
> Would anyone be willing to work on it with me? (And,
> does anyone have a machine with a full-time Internet
> connection and NNTP access that this thing could run on?)
>
> The tool I had in mind, by the way, is the "rainbow" program
> from http://www.cs.cmu.edu/~mccallum/bow/ . It uses Bayesian
> methods (which I personally know a little bit about), but
> also supports other methods (which I know nothing about).
>
> - Logan
------------------------------
Date: Thu, 21 Dec 2000 07:27:51 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: automatic FAQ answerer idea
Message-Id: <slrn943tq7.4tk.tadmc@magna.metronet.com>
Logan Shaw <logan@cs.utexas.edu> wrote:
>In article <x766kedznc.fsf@home.sysarch.com>,
>Uri Guttman <uri@sysarch.com> wrote:
>> many people don't want a robot in a newsgroup, etc.
That would be the show-stopper as far as I am concerned.
>Don't we already have a robot in this newsgroup posting answers to FAQs
>randomly?
Yes. But it is a fixed rate of robot-postings.
>Would it be better (again, *if* it can be made to work as
>intended) to send responses in a more directed fashion?
When Joe Gimme-Gimme gets pissed at the newsgroup, he starts
making response-triggering postings just to watch the
machine spew stuff...
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Dec 2000 14:11:10 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Re: bug in open()
Message-Id: <91t31u$dr2$1@bcarh8ab.ca.nortel.com>
krahnj@acm.org writes:
> Brandon Metcalf wrote:
> >
> > open() seems to have been broken in Perl 5.005_3 as well as the latest
> > ActivePerl. In Perl 5.6.0 on solaris open() behaves as it should.
> >
> > Can anyone confirm this?
> >
> > $ cat ~/tmp/jj
> > open (DD, "lls|") || die "bad command: $!";
>
> I'm guessing that lls is an alias not an actual command which is why it
> can't be found by open.
Please go back and read my original post. You missed the point
completely.
Brandon
------------------------------
Date: 21 Dec 2000 10:11:15 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: bug in open()
Message-Id: <m38zp9izcc.fsf@mumonkan.sunstarsys.com>
bmetcalf@nortelnetworks.com (Brandon Metcalf) writes:
> open() seems to have been broken in Perl 5.005_3 as well as the latest
> ActivePerl. In Perl 5.6.0 on solaris open() behaves as it should.
>
> Can anyone confirm this?
>
> $ cat ~/tmp/jj
> open (DD, "lls|") || die "bad command: $!";
I think the bug is in 5.6 - try this line instead:
open(DD, "sleep 1 && lls |") || die "bad fork: $!";
--
Joe Schaefer
------------------------------
Date: 21 Dec 2000 08:54:40 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Death and Jeopardy
Message-Id: <3a4227c0@cs.colorado.edu>
+------------------------------------------------------------------+
| The short point is this: if you post crap, you will be killfiled |
| at best, and excoriated at worst. Cut it the frick out. I will |
| reinstate the cron job until the idiot-flups quit their crap. |
+------------------------------------------------------------------+
EXECUTIVE SUMMARY:
To send better messages, please trim and summarize what you're
replying to, and integrate your quoted text with the body of your
message. Don't just put everything at the end. This isn't Jeopardy.
People expect question-and-answer, not answer-and-question responses.
LONG STORY:
Wouldn't you like to make your messages easier for others to read and
understand? If so, I have some news posting tips for you. If not,
just ignore this. (Of course, if you don't want your messages
easier to read and understand, it's not clear why you bother to
send them in the first place. :-) I'm going to take a bit of
time to explain this, because newcomers to Usenet often lack the
cultural background were I to send a superbrief message.
Here's the issue: you appear to have quoted the entire message to which
you were replying. Worst of all, you have done so by merely appending
the complete message at the bottom. Folks are used to reading the
original material first, then the follow-up. That's why it's called a
"follow-up", you know. :-)
If all you want to do is forward a copy of the message, that's one thing,
but here you seem to have just blindly pasted the complete old message at
the end without providing any content. This is neither a proper public
followup nor even a decent private reply. Here's why.
First of all, this is massive overkill -- you're supposed to trim your
quoted text to only what you're replying to. Otherwise you'll probably
violate the netiquette target quoting percentage of 50%. See below.
This isn't really an issue of space (I know that a few bytes here and
there mean less today than 20 years go), so much as it is of integrating
your comments with the old material for continuity.
Second, putting everything at the bottom does little good. It doesn't
provide the proper context. It's far too late. When you reply to
someone's content, the reason you quote the previous message is so that
you can provide some degree of contextual continuity. The best way to
do this is to interleave what you're quoting with your responses to that
particular piece. That means that you should provide a quoted portion,
then address what the points therein, then another quoted section, etc.
For example, here's how followup replies *should* look if you'd
like them to be more effective.
> Joe said we should eat noodles.
But I don't like noodles. They are a pain to prepare -- remember
that what started this thread was how to cook using only a microwave,
not real cooking -- and they provide you with very little sustenance
in the long run. It's like eating cardboard, nutritionally speaking.
> He also suggests adding anchovies.
What is this fish fetish? Not all of us like the little minnows
with the lingering briny taste swimming around our mouths for the
next few hours or days. Can you imagine this on a date? Iccccch!
Notice how in the text above, alternate quoted passages are interleaved
with new response text. Notice also that the new text far exceeds the
old text. This is the way it should be.
Here's an excerpt from RFC 1855, which explains why this is bad.
You can read the whole RCS at http://www.faqs.org/rfcs/rfc1855.html
- If you are sending a reply to a message or a posting be sure you
summarize the original at the top of the message, or include just
enough text of the original to give a context. This will make
sure readers understand when they start to read your response.
Since NetNews, especially, is proliferated by distributing the
postings from one host to another, it is possible to see a
response to a message before seeing the original. Giving context
helps everyone. But do not include the entire original!
If you are receiving this message in response to a news posting, please
understand that all modern newsreaders provide a mechanism to fetch
the parent article, so it is seldom necessary to quote the whole thing.
Sometimes even mail readers provide this, depending on the mail headers
and the list archival mechanism on your own system.
Here's a section from the essential netiquette guide, "A Primer
on How to Work With the Usenet Community", which is available in
news.announce.newusers. Perhaps your service provider neglected to point
you at this newsgroup before you got swallowed up by all of Usenet.
It's not only a good read; it's critical to understanding the culture
you're now moving in.
Summarize What You are Following Up.
When you are following up someone's article, please summarize the
parts of the article to which you are responding. This allows readers
to appreciate your comments rather than trying to remember what the
original article said. It is also possible for your response to get
to some sites before the original article.
Summarization is best done by including appropriate quotes from
the original article. Do not include the entire article since it
will irritate the people who have already seen it. Even if you are
responding to the entire article, summarize only the major points you
are discussing.
It's even more annoying when people needlessly quote the original's
automatic trailing matter, like signatures, adverts, or disclaimers.
Please don't do that.
------------------------------
Date: Thu, 21 Dec 2000 15:28:43 GMT
From: Adam Levenstein <cleon42@my-deja.com>
Subject: Re: FAQ 5.4: How do I make a temporary file name?
Message-Id: <91t7j3$8a2$1@nnrp1.deja.com>
In a job I was on a few months ago, the way we did it (albeit in C++)
was to simply use "temp-" and the PID. Quick and dirty, but it got the
job done. And if we needed more than one, we could always use "temp-a-
PID," "temp-b-PID," etc.
Adam
--
-------------------------------------------------
Adam Levenstein
cleon42@my-deja.com
"Extraordinary claims require extraordinary evidence."
-- Carl Sagan
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 21 Dec 2000 08:52:01 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: FAQ 5.4: How do I make a temporary file name?
Message-Id: <3a422721@cs.colorado.edu>
In article <91t7j3$8a2$1@nnrp1.deja.com>,
Adam Levenstein <cleon42@my-deja.com> wrote:
>
>In a job I was on a few months ago, the way we did it (albeit in C++)
>was to simply use "temp-" and the PID. Quick and dirty, but it got the
>job done. And if we needed more than one, we could always use "temp-a-
>PID," "temp-b-PID," etc.
That's very often a security hole just begging to have something wicked
rammed up. Use File::Temp instead.
use File::Temp 'tempfile';
$fh = tempfile();
From the Camel's security chapter:
Careless or casual programs use temporary files in all kinds
of unsafe ways, like placing them in world-writable directories,
using predictable filenames, and not making sure the file doesn't
already exist. Whenever you find a program with code like
open(TMP, ">/tmp/foo.$$")
|| die "can't open /tmp/foo.$$: $!";
you've just found all three of those errors at once. That
program is an accident waiting to happen.
The way the exploit plays out is that the cracker first plants
a file with the same name as the one you'll use. Appending the
pid isn't enough for uniqueness; surprising though it may sound,
guessing pids really isn't difficult.<footnote>Unless you're
on a system like OpenBSD, which randomizes new pid
assignments.</footnote> Now along comes the program with the
careless C<open> call, and instead of creating a new temporary
file for its own purposes, it overwrites the cracker's file
instead.
So what harm can that do? A lot. The cracker's file isn't
really a plain file, you see. It's a symbolic link (or sometimes
a hard link), probably pointing to some critical file that the
cracker couldn't normally write to program thought it opened a
brand new file in I</tmp>, but clobbered an existing file
somewhere else instead.
To understand why you want the filehandle back, not the filename,
you need to read up on race conditions and atomicity.
--tom
------------------------------
Date: Thu, 21 Dec 2000 19:52:11 +0530
From: sumit <svwasan@lucent.com>
Subject: file upload for winNT
Message-Id: <3A421213.1BF8D351@lucent.com>
HI
Can anybody suggest any working perlscript for uploading a file to web server
on NT?
Thanx in advance
Sumit
------------------------------
Date: Thu, 21 Dec 2000 16:08:38 +0100
From: "Mark Kuin" <mkuin@globalrangers.com>
Subject: Re: file upload for winNT
Message-Id: <91t6fk$dvp$1@news1.xs4all.nl>
I assume you are posting a HTML form like this...
<form method="post" action="upload.cgi" enctype="multipart/form-data">
<input type="file" name="frm_fil">
<input type="submit" value="upload">
</form>
This works for me....
use CGI qw(:standard);
my $query = new CGI;
my $frm_fil = $query->param('frm_fil');
my $new_fil = 'upload.tmp';
open(NEWFILE,">$new_fil") || die "Error writing file: $!";
binmode(NEWFILE);
while(read($frm_fil,my $data,1024)) {
print NEWFILE $data;
}
close(NEWFILE);
close($frm_fil);
Mark
"sumit" <svwasan@lucent.com> wrote in message
news:3A421213.1BF8D351@lucent.com...
> HI
>
> Can anybody suggest any working perlscript for uploading a file to web
server
> on NT?
>
> Thanx in advance
>
> Sumit
------------------------------
Date: Thu, 21 Dec 2000 15:21:59 GMT
From: Adam Levenstein <cleon42@my-deja.com>
Subject: Re: getting data
Message-Id: <91t76f$7t1$1@nnrp1.deja.com>
Well...You can get an ODBC driver for Excel (in fact, I think MS Office
installs one automatically), so yes, you can use ODBC calls to talk to
an Excel spreadsheet.
In article <3A41F7D9.5F9408AE@schaffhausen.de>,
ubl@schaffhausen.de wrote:
> Sven Franke schrieb:
> >
> > Hi,
> >
> > I wonder hoe I can read data out an Excel -sheet.
> > I heard about a DBI/DBD module, but I can't find info about excel.
> >
> > How can this be done?
> > (I thought of DBI because I need to store the exceldata in a
database...)
>
> DBI is the right choice to store/read data to and from a database.
> Excel is not a database, so DBI is not the right module (Correct me,
maybe
> there is a way to do this with the ODBC DBD). I dont think there is a
perl
> parser for the ever changing excel file format, but you can probably
access
> the data via OLE, so look for the WIN32::OLE modules.
>
> You can find all of that at cpan.org
>
> ->malte
>
--
-------------------------------------------------
Adam Levenstein
cleon42@my-deja.com
"Extraordinary claims require extraordinary evidence."
-- Carl Sagan
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 21 Dec 2000 08:52:53 -0700
From: tchrist@perl.com (Tom Christiansen)
Subject: Re: getting data
Message-Id: <3a422755@cs.colorado.edu>
In article <91t76f$7t1$1@nnrp1.deja.com>,
Adam Levenstein <cleon42@my-deja.com> wrote crap. Again.
EXECUTIVE SUMMARY:
To send better messages, please trim and summarize what you're
replying to, and integrate your quoted text with the body of your
message. Don't just put everything at the end. This isn't Jeopardy.
People expect question-and-answer, not answer-and-question responses.
LONG STORY:
Wouldn't you like to make your messages easier for others to read and
understand? If so, I have some news posting tips for you. If not,
just ignore this. (Of course, if you don't want your messages
easier to read and understand, it's not clear why you bother to
send them in the first place. :-) I'm going to take a bit of
time to explain this, because newcomers to Usenet often lack the
cultural background were I to send a superbrief message.
Here's the issue: you appear to have quoted the entire message to which
you were replying. Worst of all, you have done so by merely appending
the complete message at the bottom. Folks are used to reading the
original material first, then the follow-up. That's why it's called a
"follow-up", you know. :-)
If all you want to do is forward a copy of the message, that's one thing,
but here you seem to have just blindly pasted the complete old message at
the end without providing any content. This is neither a proper public
followup nor even a decent private reply. Here's why.
First of all, this is massive overkill -- you're supposed to trim your
quoted text to only what you're replying to. Otherwise you'll probably
violate the netiquette target quoting percentage of 50%. See below.
This isn't really an issue of space (I know that a few bytes here and
there mean less today than 20 years go), so much as it is of integrating
your comments with the old material for continuity.
Second, putting everything at the bottom does little good. It doesn't
provide the proper context. It's far too late. When you reply to
someone's content, the reason you quote the previous message is so that
you can provide some degree of contextual continuity. The best way to
do this is to interleave what you're quoting with your responses to that
particular piece. That means that you should provide a quoted portion,
then address what the points therein, then another quoted section, etc.
For example, here's how followup replies *should* look if you'd
like them to be more effective.
> Joe said we should eat noodles.
But I don't like noodles. They are a pain to prepare -- remember
that what started this thread was how to cook using only a microwave,
not real cooking -- and they provide you with very little sustenance
in the long run. It's like eating cardboard, nutritionally speaking.
> He also suggests adding anchovies.
What is this fish fetish? Not all of us like the little minnows
with the lingering briny taste swimming around our mouths for the
next few hours or days. Can you imagine this on a date? Iccccch!
Notice how in the text above, alternate quoted passages are interleaved
with new response text. Notice also that the new text far exceeds the
old text. This is the way it should be.
Here's an excerpt from RFC 1855, which explains why this is bad.
You can read the whole RCS at http://www.faqs.org/rfcs/rfc1855.html
- If you are sending a reply to a message or a posting be sure you
summarize the original at the top of the message, or include just
enough text of the original to give a context. This will make
sure readers understand when they start to read your response.
Since NetNews, especially, is proliferated by distributing the
postings from one host to another, it is possible to see a
response to a message before seeing the original. Giving context
helps everyone. But do not include the entire original!
If you are receiving this message in response to a news posting, please
understand that all modern newsreaders provide a mechanism to fetch
the parent article, so it is seldom necessary to quote the whole thing.
Sometimes even mail readers provide this, depending on the mail headers
and the list archival mechanism on your own system.
Here's a section from the essential netiquette guide, "A Primer
on How to Work With the Usenet Community", which is available in
news.announce.newusers. Perhaps your service provider neglected to point
you at this newsgroup before you got swallowed up by all of Usenet.
It's not only a good read; it's critical to understanding the culture
you're now moving in.
Summarize What You are Following Up.
When you are following up someone's article, please summarize the
parts of the article to which you are responding. This allows readers
to appreciate your comments rather than trying to remember what the
original article said. It is also possible for your response to get
to some sites before the original article.
Summarization is best done by including appropriate quotes from
the original article. Do not include the entire article since it
will irritate the people who have already seen it. Even if you are
responding to the entire article, summarize only the major points you
are discussing.
It's even more annoying when people needlessly quote the original's
automatic trailing matter, like signatures, adverts, or disclaimers.
Please don't do that.
------------------------------
Date: Thu, 21 Dec 2000 14:55:10 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: If I don't want to 'goto'
Message-Id: <3A420BBD.26ECDF1F@schaffhausen.de>
John Lin schrieb:
>
> Dear all,
>
> In "perldoc -f goto" it proudly says
>
> The author of Perl has never felt the need to use this
> form of `goto' (in Perl, that is--C is another matter).
>
> Really? Recently I tried to modify the structure of a program
> to avoid using 'goto'.
>
> for my $file (<*>) {
> ...
> if($fail_condition1) { warn "message 1"; goto fail }
> ...
> if($fail_condition2) { warn "message 2"; goto fail }
> ...
> if($fail_condition3) { warn "message 3"; goto fail }
>
> next;
> fail:
> rename $file => "fail/$file"; # move to fail/ sub directory
> ... and many other statements
> }
>
> Whenever there is an failure condition, I want to move the file
> to fail/ directory as well as doing some other cleanups.
>
> I couldn't think of a better structure to avoid the 'goto'.
>
> For example, constructing the block after fail: as a sub
>
> if($fail_condition1) { warn "message 1"; fail; next }
>
> sub fail { ... }
>
> is not suitable because many "my" variables are involved,
> they would either be invisible or need to be passed as arguments
> which is ugly.
I guess you have to give a better reason to why not use subs. You present
a perfect solution to your problem and then you say its ugly. You cant expect
us to give you something better than the best. In case you wouldn't have
mentioned the subs, probably, everybody here would have told you to use
them.
->malte
------------------------------
Date: Thu, 21 Dec 2000 14:15:46 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: is this bad perl programming habit?
Message-Id: <3A42142D.67BDF0F9@home.com>
Uri Guttman wrote:
>
> A> require MyModules::XYZModule;
>
> syntax error. you fell into the use to require trap. the argument to
> require is an expression and not a package name. it needs to be quoted,
No, see perlfunc.
> have the .pm suffix and :: converted to /. i ran into this when doing a
> dynamic load of modules based on the package name.
Well, yes, presumably because by dynamic load you mean something like
require $package;
Since $package is an expression, and not a bareword, whatever it
evaluates to is treated as a file name. So
require MyModules::XYZModule;
will do what you want but
$package = 'MyModules::XYZModule';
require $package;
won't (unless you have a file named 'MyModules::XYZModule' in one of the
directories of @INC).
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Thu, 21 Dec 2000 13:41:25 +0000
From: Jason Trenouth <jason@harlequin.com>
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE oflanguages??)
Message-Id: <61244t8qthmesd7kcef2hc7dfvukfavicv@4ax.com>
On Wed, 20 Dec 2000 11:49:37 -0800, Kenny Pearce <kenny@kennypearce.net> wrote:
> well, in Java, you can apply Integer methods to a primitive type int, or you can just do
> int primitive = 5;
> Integer object = (Integer)primitive;
>
> and force your primitive to become an object at any point in your code... not too
> difficult..
This is just nonsense.
__Jason
------------------------------
Date: Thu, 21 Dec 2000 15:09:17 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: Language evolution C->Perl->C++->Java->Python (Is Python the ULTIMATE oflanguages??)
Message-Id: <91t6en$79q$1@nnrp1.deja.com>
In article <61244t8qthmesd7kcef2hc7dfvukfavicv@4ax.com>,
Jason Trenouth <jason@harlequin.com> wrote:
> On Wed, 20 Dec 2000 11:49:37 -0800, Kenny Pearce
<kenny@kennypearce.net> wrote:
>
> > well, in Java, you can apply Integer methods to a primitive type
int, or you can just do
> > int primitive = 5;
> > Integer object = (Integer)primitive;
> >
> > and force your primitive to become an object at any point in your
code... not too
> > difficult..
>
> This is just nonsense.
Not quite, inaccurate yes, but there are object wrappers for the
primitives in java..
# cat >test.java
class Test {
public static void main(String[] args) {
int i=123;
Integer ObjectI = new Integer(i);
System.out.println(ObjectI); //Display the string.
}
}
# /usr/java/jdk1.3/bin/javac ./test.java
# /usr/java/jdk1.3/bin/java -cp . Test
123
--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 21 Dec 2000 15:14:36 GMT
From: ignition78@my-deja.com
Subject: Looking for a Canadian PERL/CGI programmer
Message-Id: <91t6ol$7ee$1@nnrp1.deja.com>
Hi, I am not sure if this is the right forum, but it is a misc forum,
so here goes:
I need a program written, and I am looking for a Canadian programmer
(preferably) to do it, or someone who does not mind getting paid in
Canadian Dollars. ;)
The scenario is this:
This program should do the following:
 Go to a specified URL through a search page (see below for
example
URL’s) take all the search results that have today’s date, extract the
information from all the matching links.
 The information should then be sent to the human operator in
some
form where they can quickly skim the results and flag desired items.
 After the human operator is finished, he/she should be able to
click “Go” and the desired posts are then sent a form e-mail with an
html link.
 The results should be able to be archived into a database.
 The program should be easily scaleable, so I can add or
subtract
different URL’s from time to time.
 I need it to run via crontab, same time every day.
 I need it to be easily customizable and of course user-friendly
If anyone is interested in taking this on, please send e-mail to
ignition2@sympatico.ca with an estimated cost quote.
Also if anyone wants further clarification, e-mail me as well.
Example URLS:
http://jobs.workopolis.com/jobshome/db/work.gam_joblist?
pi_gam_date=20001221 <--this date should reflect the current date
http://jobsearch.monster.com/jobsearch.asp?cy=US&brd=1&q=
http://www.jobshark.ca/CaEng/JobSearch/SearchJobResults.cfm?
CFID=1210393&CFTOKEN=50822368
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 21 Dec 2000 08:11:55 -0600
From: Michael Carman <mjcarman@home.com>
Subject: Re: ok
Message-Id: <3A420FAB.91092D6A@home.com>
AP wrote:
>
> Ok, ok, I now know about the Benchmark module. [...]
> One request, though: if you're rolling your eyes because I
> didn't try some document or resource when attempting to solve
> a problem, just refer me to the document/resource instead of
> going out and doing it for me, *then* telling me how dumb I am.
> You can simply tell me how dumb I am and I'll go figure out
> what's needed so you won't have to waste more of your time.
Heh. If only more of the newcomers to this group felt that way.
Unfortunately, most of them seem to get downright indignant when someone
refers them to the docs instead of giving them an answer directly. It's
nice to see that someone wants to learn to fish. Welcome to clpmisc,
you'll do fine here. :)
-mjc
------------------------------
Date: Thu, 21 Dec 2000 15:48:27 GMT
From: garry@zweb.zvolve.net (Garry Williams)
Subject: Re: perl DBI
Message-Id: <fDp06.620$Kk5.34051@eagle.america.net>
On Thu, 21 Dec 2000 13:26:28 +0100, Malte Ubl <ubl@schaffhausen.de>
wrote:
>Rafael Garcia-Suarez schrieb:
>
>>
>> Ensure proper disconnection even if the select failed:
>>
>> END { $dbh->disconnect if $dbh }
>
> Doesn't DBI provide for this in it's
>DESTROY method?
Yes, but it generates a warning too.
--
Garry Williams
------------------------------
Date: 21 Dec 2000 08:03:18 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: perl DBI
Message-Id: <m1n1dpwym1.fsf@halfdome.holdit.com>
>>>>> "AvA" == AvA <a.v.a@home.nl> writes:
AvA> pff that makes an easy readible language like perl very hard to
AvA> understand. i prefer to use as little as modules as possible for
AvA> learning purposes. have to get it to work raw first.
So you started with assembler, or perhaps wirewrapping your own boards?
pff to you too.
:(
If you want to be hireable, learn the modules first. Then delve into
them to figure out why they do what they do. *Then* write your own,
only after understanding why the module author did everything they did.
Just another member of the "don't needlessly reinvent the wheel" committee,
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 21 Dec 2000 15:23:50 GMT
From: ignition78@my-deja.com
Subject: Re: print to html problem
Message-Id: <91t79u$7ud$1@nnrp1.deja.com>
Thanks Dave,
Your help, along with the website link you gave, and a purchase of a
PERL Programmers book were a great help, and I have successfuly changed
the script.
In article <91482v$ipc$1@nnrp1.deja.com>,
Dave Brondsema <brondsem@my-deja.com> wrote:
> In article <91465h$h6l$1@nnrp1.deja.com>,
> ignition78@my-deja.com wrote:
> > Just wondering if anyone can help me with this problem:
> >
> > One component of the program in question, a separate .pl script, was
> to
> > obtain user input in the form of a search query, which searched a
data
> > base, then returned hot-linked results in a plain boring web page.
> >
> > Now, I do not like the plain boring web page that it generates, and
I
> > would like it to appear the same as the page that the search was
> > initiated from.
> >
> > I have tinkered with it to the best of my ability, but this code
seems
> > a bit more complex for me, and I have gotten is nothing but server
> > errors.
> >
> > I do have a very general knowledge of manipulating and configuring
> perl
> > scripts for use with my web sites, but have no real programming
> > training.
> >
> > So with that said, can someone please explain to me in simplistic
> > terms, how I would be able to add some of the HTML to the output on
> > this program, I guess I am asking what the proper syntax is for the
> > print (command, propertier, operator?) to get the additional HTML in
> > there
> >
>
> [snip]
>
> try putting it in various places and see what happens. In particular,
> the subs with names like output_results
>
> The syntax is:
> print "some <b>html</b>";
>
> quotes must be escaped like this
> print "<font face=\"Times New Roman\">Hello</font>";
>
> or .. use the double quote operator:
> print qq~<img src="hey.gif">this is some more text~;
>
> For perl-specific help, look to http://www.perl.com and
> http://www.cgi101.com/class for free (free is good) documentation and
> tutorials.
>
> --
> Dave Brondsema
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 21 Dec 2000 15:04:08 GMT
From: Drew Myers <bh_ent@my-deja.com>
Subject: Reorder array via for
Message-Id: <91t653$6u9$1@nnrp1.deja.com>
I've written a program to gather information from several data files.
The info is stored in multiple arrays. I'd like to output this
information in some reasonably simple format, but the arrays are not in
a convenient form. The code is:
my $x = @name;
--$x;
my $c;
for ($c = 0; $c = $x; $c++) {
@output = qw($name[$c] $date[$c] $high[$c] $low[$c] $avg[$c] $realmem
$free[$c] $realfree[$c]);
}
The arrays, @name, @date, etc. are the arrays spoken of earlier.
When run, this code simply hangs. I get no error messages, or any
ouput at all.
Any suggestions?
Thanks in advance.
--
Drew Myers
perotsystems
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 21 Dec 2000 16:19:16 +0100
From: "Mark Kuin" <mkuin@globalrangers.com>
Subject: Re: Reorder array via for
Message-Id: <91t73i$f94$1@news1.xs4all.nl>
You might want to try $c <= $x instead of $c = $x.........
"Drew Myers" <bh_ent@my-deja.com> wrote in message
news:91t653$6u9$1@nnrp1.deja.com...
> I've written a program to gather information from several data files.
> The info is stored in multiple arrays. I'd like to output this
> information in some reasonably simple format, but the arrays are not in
> a convenient form. The code is:
>
> my $x = @name;
> --$x;
> my $c;
> for ($c = 0; $c = $x; $c++) {
> @output = qw($name[$c] $date[$c] $high[$c] $low[$c] $avg[$c] $realmem
> $free[$c] $realfree[$c]);
> }
>
> The arrays, @name, @date, etc. are the arrays spoken of earlier.
> When run, this code simply hangs. I get no error messages, or any
> ouput at all.
>
> Any suggestions?
>
> Thanks in advance.
> --
> Drew Myers
> perotsystems
>
>
> Sent via Deja.com
> http://www.deja.com/
------------------------------
Date: Thu, 21 Dec 2000 14:20:14 GMT
From: delanthear@my-deja.com
Subject: Select(2) and Term::Readkey
Message-Id: <91t3ip$4q1$1@nnrp1.deja.com>
Is it possible to use both the Term::Readkey and use Select(2) at the
same time?
Check this example:
LISTENER is one half of a paidsocket to child process. Basically the
idea is to while loop until either there is some waiting on <LISTENER>
or a key has been pressed. I can't get them to both work as the same
time.
--------
my $rin = '';
vec($rin, fileno(LISTENER), 1) = 1;
ReadMode('cbreak');
while ($loop) {
if (defined ($char = ReadKey(0))) {
printf(" Decimal: %d\tHex: %x\n", ord($char), ord($char));
$loop = 0;
} else {
ReadMode(0);
$nfound = select($rout=$rin, undef, undef, 0);
if ($nfound) {
if (vec($rout,fileno(LISTENER),1)) {
$tmp = <LISTENER>;
print "LISTENER! - $tmp\n";
$loop = 0;
}
$nfound = "";
}
}
}
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 21 Dec 2000 14:37:29 +0000
From: Kelly Dorset <dorsettest@uk.insight.com>
Subject: Re: Select(2) and Term::Readkey
Message-Id: <3A4215A9.CFDBB1F@uk.insight.com>
delanthear@my-deja.com wrote:
> LISTENER is one half of a paidsocket to child process.
Socketpair I mean :o)
------------------------------
Date: Thu, 21 Dec 2000 15:11:11 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: SSI in perl output
Message-Id: <3A420F7F.876C637A@schaffhausen.de>
Enrico Ng schrieb:
>
> Is there a way to put a SSI include directive into the output of a perl
> script and have the server interpret it as a shtml?
Although, as the other posters, I cant see why this would be useful. There
is a way to do this, at least I think I read it somewhere in the mod_perl
documentation that Perl's output under mod_perl could also be parsed just
like any other html page.
->malte
------------------------------
Date: Thu, 21 Dec 2000 09:19:18 -0500
From: "James Brazelton" <tech3@us-it.net>
Subject: Re: very strange thing with closures
Message-Id: <t444gegoau8234@corp.supernews.com>
<patrick_k6801@my-deja.com> wrote in message
news:91ssrk$vo8$1@nnrp1.deja.com...
> Hello out there.
>
> I am desperately thrying to find, why this two subs behave in different
> ways. Both are creating two closures that print out a variable (value 1
> or 2). But only the second one is behaving correct and the closures are
> printing 1 and 2. The first sub's closures are both printing 2. Has
> anybody an idea about this ?
>
> regards,
> Patrick
>
> #!/usr/bin/perl
>
> sub this_is_not_fucking
> {
> my $fucking_variable = 1;
> my $fucking_sub = sub { print $fucking_variable; };
> $fucking_variable = 2;
you need to declare this variable after runtime of first sub, in other
words...
> my $another_fucking_sub = sub { print $fucking_variable; };
> &$fucking_sub();
declare it here
> print "\n";
or here
> &$another_fucking_sub();
> print "\n";
> }
------------------------------
Date: Thu, 21 Dec 2000 14:57:16 +0100
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: very strange thing with closures
Message-Id: <3A420C3C.51D4E262@schaffhausen.de>
patrick_k6801@my-deja.com schrieb:
>
> Hello out there.
>
> I am desperately thrying to find, why this two subs behave in different
> ways. Both are creating two closures that print out a variable (value 1
> or 2). But only the second one is behaving correct and the closures are
> printing 1 and 2. The first sub's closures are both printing 2. Has
> anybody an idea about this ?
>
> regards,
> Patrick
>
> #!/usr/bin/perl
>
> sub this_is_not_fucking
> {
> my $fucking_variable = 1;
> my $fucking_sub = sub { print $fucking_variable; };
> $fucking_variable = 2;
> my $another_fucking_sub = sub { print $fucking_variable; };
> &$fucking_sub();
> print "\n";
> &$another_fucking_sub();
> print "\n";
> }
>
> sub this_is_fucking
> {
> my $fucking_list = ();
> for my $fucking_variable (1..2) {
> push @fucking_list , sub { print $fucking_variable; };
> }
>
> $fucking_list[0]();
> print "\n";
> $fucking_list[1]();
> print "\n";
> }
>
> this_is_not_fucking();
> this_is_fucking();
Probably, because you thought about sex all the time.
------------------------------
Date: Thu, 21 Dec 2000 15:24:13 GMT
From: patrick_k6801@my-deja.com
Subject: Re: very strange thing with closures
Message-Id: <91t7ak$7um$1@nnrp1.deja.com>
Hi, James !
Perl should establish closure variables that are packed with the two
subs. As sub this_is_fucking demonstrates, the variable
fucking_variable is existing in two independent instances after the for-
loop in this_is_fucking. (one for each sub in fucking_list). The
closures are produced in the line
push @fucking_list , sub { print $fucking_variable; };
What i simply do not understand is: Why does this work correctly in the
second sub but not in the first one ?
regards
Patrick
In article <t444gegoau8234@corp.supernews.com>,
"James Brazelton" <tech3@us-it.net> wrote:
>
> <patrick_k6801@my-deja.com> wrote in message
> news:91ssrk$vo8$1@nnrp1.deja.com...
> > Hello out there.
> >
> > I am desperately thrying to find, why this two subs behave in
different
> > ways. Both are creating two closures that print out a variable
(value 1
> > or 2). But only the second one is behaving correct and the closures
are
> > printing 1 and 2. The first sub's closures are both printing 2. Has
> > anybody an idea about this ?
> >
> > regards,
> > Patrick
> >
> > #!/usr/bin/perl
> >
> > sub this_is_not_fucking
> > {
> > my $fucking_variable = 1;
> > my $fucking_sub = sub { print $fucking_variable; };
> > $fucking_variable = 2;
>
> you need to declare this variable after runtime of first sub, in other
> words...
>
> > my $another_fucking_sub = sub { print $fucking_variable; };
> > &$fucking_sub();
>
> declare it here
>
> > print "\n";
>
> or here
>
> > &$another_fucking_sub();
> > print "\n";
> > }
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 5171
**************************************