[13089] in Perl-Users-Digest
Perl-Users Digest, Issue: 499 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 13 09:10:21 1999
Date: Fri, 13 Aug 1999 06:05:12 -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 Fri, 13 Aug 1999 Volume: 9 Number: 499
Today's topics:
[Perl] How to find the Perl FAQ <rootbeer&pfaq*finding*@redcat.com>
Re: A CGI/Perl Question (I.J. Garlick)
Re: A CGI/Perl Question <flavell@mail.cern.ch>
Re: A CGI/Perl Question (elephant)
Re: array and file processing (Anno Siegel)
Re: Fastest form of an 'if' (Anno Siegel)
Re: ftp changed files in a directory tree? (Donovan Rebbechi)
Re: Looking for a good Perl Book (I.J. Garlick)
Re: Looking for a good Perl Book <hykit@jps.net>
Re: Looking for a solution to the problem localtime and <tchrist@mox.perl.com>
Re: Looking for a solution to the problem localtime and <tchrist@mox.perl.com>
Newbie Qu. on Databases <vyking@iweb.net.au>
Re: Newbie Qu. on Databases <rhrh@hotmail.com>
Re: Newbie Qu. on Databases (Graham Ashton)
Re: Newbie Qu. on Databases <flavell@mail.cern.ch>
Re: Newbie Qu. on Databases <rhrh@hotmail.com>
Re: obtaining local IP address in ActivePerl <Jonathan_Epstein@nih.gov>
Perl sort question/help <jeffm641@ibm.net>
Re: Please help, DBI : statement handler <rhrh@hotmail.com>
Re: searching complex data structure (Anno Siegel)
SMS PAGING MODULE <tmujak@wcom.co.uk>
Re: Tom Christiansen "Perl Cookbook" <wcjones@fccj.org>
Re: Tom Christiansen "Perl Cookbook" (Malcolm Ray)
Re: Why use Perl when we've got Python?! <kvan@dis.dk>
Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
Re: Why use Perl when we've got Python?! <tchrist@mox.perl.com>
Re: Work around for signal handler crashes (Anno Siegel)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 13 Aug 1999 10:24:04 GMT
From: Tom Phoenix <rootbeer&pfaq*finding*@redcat.com>
Subject: [Perl] How to find the Perl FAQ
Message-Id: <pfaqmessage934539843.13099@news.teleport.com>
Archive-name: perl-faq/finding-perl-faq
Posting-Frequency: weekly
Last-modified: 10 Sep 1998
[ That "Last-modified:" date above refers to this document, not to the
Perl FAQ itself! The last major update of the Perl FAQ was in Summer of
1998; of course, ongoing updates are made as needed. ]
For most people, this URL should be all you need in order to find Perl's
Frequently Asked Questions (and answers).
http://cpan.perl.org/doc/FAQs/
Please look over (but never overlook!) the FAQ and related docs before
posting anything to the comp.lang.perl.* family of newsgroups.
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Beginning with Perl version 5.004, the Perl distribution itself includes
the Perl FAQ. If everything is pro-Perl-y installed on your system, the
FAQ will be stored alongside the rest of Perl's documentation, and one
of these commands (or your local equivalents) should let you read the FAQ.
perldoc perlfaq
man perlfaq
If a recent version of Perl is not properly installed on your system,
you should ask your system administrator or local expert to help. If you
find that a recent Perl distribution is lacking the FAQ or other important
documentation, be sure to complain to that distribution's author.
If you have a web connection, the first and foremost source for all things
Perl, including the FAQ, is the Comprehensive Perl Archive Network (CPAN).
CPAN also includes the Perl source code, pre-compiled binaries for many
platforms, and a large collection of freely usable modules, among its
560_986_526 bytes (give or take a little) of super-cool (give or take
a little) Perl resources.
http://cpan.perl.org/
http://www.perl.com/CPAN/
http://cpan.perl.org/doc/FAQs/FAQ/html/
http://www.perl.com/CPAN/doc/FAQs/FAQ/html/
You may wish or need to access CPAN via anonymous FTP. (Within CPAN,
you will find the FAQ in the /doc/FAQs/FAQ directory. If none of these
selected FTP sites is especially good for you, a full list of CPAN sites
is in the SITES file within CPAN.)
California ftp://ftp.cdrom.com/pub/perl/CPAN/
Texas ftp://ftp.metronet.com/pub/perl/
South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
Japan ftp://ftp.dti.ad.jp/pub/lang/CPAN/
Australia ftp://cpan.topend.com.au/pub/CPAN/
Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
Switzerland ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
Chile ftp://ftp.ing.puc.cl/pub/unix/perl/CPAN/
If you have no connection to the Internet at all (so sad!) you may wish
to purchase one of the commercial Perl distributions on CD-Rom or other
media. Your local bookstore should be able to help you to find one.
Another possibility is to use one of the FTP-via-email services; for
more information on doing that, send mail to <mail-server@rtfm.mit.edu>
(not to me!) with these lines in the body of the message, flush left:
setdir usenet-by-group/news.announce.newusers
send Anonymous_FTP:_Frequently_Asked_Questions_(FAQ)_List
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
Comments and suggestions on the contents of this document
are always welcome. Please send them to the author at
<pfaq&finding*comments*@redcat.com>. Of course, comments on
the docs and FAQs mentioned here should go to their respective
maintainers.
Have fun with Perl!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Fri, 13 Aug 1999 10:02:28 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: A CGI/Perl Question
Message-Id: <FGEEK4.4C7@csc.liv.ac.uk>
In article <MPG.121e6e63344e9f81989c20@news-server>,
elephant@squirrelgroup.com (elephant) writes:
> I hope I'm not the only one who reads Abigail's responses just to make
> themselves giggle .. this one's a classic
You'r not. :-)
>
> you're in fine form today Abigail
Oh I agree:- The one about prepending 19 to any value for the year > 50
from localtime was a scream.
--
Ian J. Garlick
ijg@csc.liv.ac.uk
Real Users hate Real Programmers.
------------------------------
Date: Fri, 13 Aug 1999 12:35:57 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: A CGI/Perl Question
Message-Id: <Pine.HPP.3.95a.990813123416.8178C-100000@hpplus03.cern.ch>
On Fri, 13 Aug 1999, Jody Fedor made the following appear:
> $referring_url = $ENV{^ÑHTTP_REFERER^Ò};
Somehow I don't think Perl is going to like that.
------------------------------
Date: Fri, 13 Aug 1999 22:37:11 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: A CGI/Perl Question
Message-Id: <MPG.121ebc83fd4f0402989c22@news-server>
I.J. Garlick writes ..
>Oh I agree:- The one about prepending 19 to any value for the year > 50
>from localtime was a scream.
oh yeah .. with the cron job each century to remind her when to change
the code *8^) .. there should be a repository for these Abigailisms ..
perhaps Abisms for short *8^)
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: 13 Aug 1999 11:37:00 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: array and file processing
Message-Id: <7p100s$s87$1@lublin.zrz.tu-berlin.de>
Teacher Guy <habfan2@my-deja.com> wrote in comp.lang.perl.misc:
>In article <37B0780D.2C1B8C0C@cisco.REMOVETHIS.com>,
> Makarand Kulkarni <makkulka@cisco.REMOVETHIS.com> wrote:
>
>
>> Do you want to find the top ten students and the average score
>> of these top ten students for EACH course offered? If not
>> then how are these results going to make sense.
>> --
>
>
>Hello. Sorry about confusion. My data is as follows:
>structure : $name,$score,$testtotal,$course
>Tom|40|50|science
>Joe|12|45|math
>Cindy|5|10|english
>...... etc
>
>I want to load data from file. Calculate test averages for each record
>and sort results, including average, to show the top ten test
>averages. It is important to maintain integrity of each record.
Calculating an average for a single record doesn't make much sense.
You still haven't answered Makarand's question: Do you want to
compare Tom's results in science with Joe's in math and Cindy's in
english to come up with the top ten students in any course? This
would give you dubious results. Or are there going to be more
records for each student with results in the other subjects? If so,
are you going to average Tom's (say) results in all courses, then
Joe's and Cindy's to arrive at some "mean performance" for every
student? Still a dubious statistical practice in my opinion; you
are implicitly assigning weights to the courses which you don't
control. Or do you want to extract the ten top science students,
the ten top math students and so on? I believe the last option
is the only one that makes statistical sense.
In any case, statistical sense or nonsense aside, you can of course
to all of the above, though the data structures you'd use would
be different for the different tasks.
>Processing the data structure is the problem. I can't seem to
>visualize how Perl processes the data.
Why, Perl processes the data the way you want it to process the
data. If the records are as well-behaved as your examples seem
to indicate, you'd get the data simply by doing
( $name, $score, $testtotal, $course ) = split m/\|/, $record;
for each record (in case this hasn't been mentioned in this thread
before). How to go on depends on what you really want to do,
which isn't quite clear yet.
Anno
------------------------------
Date: 13 Aug 1999 12:18:26 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Fastest form of an 'if'
Message-Id: <7p12ei$sc4$1@lublin.zrz.tu-berlin.de>
Andrew Fry <andrewf@beausys.freeserve.co.uk> wrote in comp.lang.perl.misc:
>In article <slrn7r79p4.e7v.abigail@alexandra.delanet.com>, Abigail
><abigail@delanet.com> writes
>>Andrew Fry (andrewf@beausys.freeserve.co.uk) wrote on MMCLXXI September
>>MCMXCIII in <URL:news:gIL3XCAjNes3EwAE@beausys.freeserve.co.uk>:
>>{} Which of these 3 forms of 'if a then b' is faster ?...
>>{} 1. if (a) { b; }
>>{} 2. b if (a);
>>{} 3. a && b;
>>{} ... or isnt there enough in it to worry about ?
>>
>>If you are kept awake at nights worrying about such things, consider
>>removing Perl from your system, and start using C, or perhaps assembler.
>>
>>Abigail
>
>What a bloody stupid remark. Up to your usual standard.
>
>I was just curious, that's all.
So benchmark it. Why bother the newsgroup? It's not *that*
interesting.
Anno
------------------------------
Date: 13 Aug 1999 08:44:13 -0400
From: elflord@news.newsguy.com (Donovan Rebbechi)
Subject: Re: ftp changed files in a directory tree?
Message-Id: <slrn7r84os.a6f.elflord@panix3.panix.com>
On Fri, 13 Aug 1999 23:13:59 -0700, C.W.Holeman II wrote:
>I am looking for some perl that will transfer a file tree from my hard drive
>to a web server using ftp. I would like it to only send the files that
>are new or changed.
You need to use Net::FTP. If you are on some kind of UNIX, you can
use a simple find command to get a list of new files.
find $dir -mtime -1
If you are on windows, you might still be able to download a find
utility from somewhere.
Otherwise, you could try using File::Find to get a list of files.
--
Donovan
------------------------------
Date: Fri, 13 Aug 1999 10:22:53 GMT
From: ijg@connect.org.uk (I.J. Garlick)
Subject: Re: Looking for a good Perl Book
Message-Id: <FGEFI5.4rx@csc.liv.ac.uk>
In article <uRJs3.151$lx1.4167@nsw.nnrp.telstra.net>,
mgjv@comdyn.com.au (Martien Verbruggen) writes:
> In article <37B35F8C.6FFDE598@connect.org.uk>,
> Ian Garlick <ijg@connect.org.uk> writes:
>
> I believe that the 5.005 version included the first perldoc that
> accepted the -q flag. I'm pretty certain that the 5.004_04 version
> didn't.
It doesn't. Ah well I really will have to upgrade to 5.005_03. Now if only
didn't have to recompile all your installed CPAN modules and could have
both versions of perl available I would have done it already.
I just know everything will break when I do it.
>
> perldoc isn't great, but it's the most universally accessible tool to
> find info in the pods. But grep still beats it :)
I agree but all the pods are not in the same place on the network in work
and you can't grep the modules pods too easily anyway.
Ah well I will soldier on with cd and grep then.
Thanks Martien.
--
Ian J. Garlick
ijg@csc.liv.ac.uk
Real Users hate Real Programmers.
------------------------------
Date: Fri, 13 Aug 1999 03:50:42 -0800
From: Kit <hykit@jps.net>
To: Michael Prendergast <mprender@virtualis.com>
Subject: Re: Looking for a good Perl Book
Message-Id: <130819990350425801%hykit@jps.net>
[[ This message was both posted and mailed: see
the "To," "Cc," and "Newsgroups" headers for details. ]]
In article <37AFE1C0.BF1239E5@virtualis.com>, Michael Prendergast
<mprender@virtualis.com> wrote:
> Hello everyone,
>
> I'm new to this forum, so none of you will probably recognise me.
>
> I'm looking for a good Perl book to learn from. I do have programming
> experience and I was wondering if any of you have a suggestion as to
> which is a good book to introduce me to the Perl language. I'm not
> *just* looking for an intro book though, I mean one with depth also, and
> some assignments/quizzes also.
>
> Plus, does anyone know of a good online school to learn Perl/Unix?
> Preferably one with begginer and advanced Perl courses.
>
> Thanks in advance,
> Michael Prendergast
If you are just starting to learn Perl, I recommend "Learning Perl" (O'
Reilly) by Randal L. Schwartz & Tom Christiansen and also "Perl: from
the Ground Up" (Osborne McGraw-Hill) by Michael McMillan.
For Perl references, I suggest "Programming Perl" (O' Reilly) and "Perl
Cookbook" (O' Reilly). "Perl Cookbook" answer a lot of questions that
are being ask here and is well worth the price.
I have "Programming Perl" and "Perl Cookbook" for sale if you are
interested. They are practically brand new and has never been used.
Mistakenly got two orders of these books. Willing to part will them
for $40 total (for two books), 50% of the retail price.
email me if you are interested: hykit@jps.net
------------------------------
Date: 13 Aug 1999 06:12:25 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <37b40ba9@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
abigail@delanet.com writes:
:I use:
: my $century = $year > 50 ? 19 : 20;
Funny, I always thought we were in the 20th century already,
and that in a few years, we'd be in the 21st century. :-)
--tom
--
Anyone can be taught to sculpt.
Michaelangleo would have had to have been taught how not to.
The same is true of great programmers.
------------------------------
Date: 13 Aug 1999 06:38:17 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Looking for a solution to the problem localtime and the century mark.
Message-Id: <37b411b9@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Jack Alexander" <Jack.Alexander@digital.com> writes:
: I use Perl 5.0 42 on Windows NT and UNIX. I'm looking for a solution to
:the problem of localtime only returning a year value (99) and not a century
:value (19 -or- 20).
.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\"
.\" References consulted:
.\" Linux libc source code
.\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
.\" 386BSD man pages
.\" Modified Sat Jul 24 19:49:27 1993 by Rik Faith (faith@cs.unc.edu)
.\" Modified Fri Apr 26 12:38:55 MET DST 1996 by Martin Schulze (joey@linux.de)
.\"
.TH CTIME 3 "April 26, 1996" "BSD" "Linux Programmer's Manual"
.SH NAME
asctime, ctime, gmtime, localtime, mktime \- transform binary date and time
to ASCII
.SH SYNOPSIS
.nf
.B #include <time.h>
.sp
.BI "char *asctime(const struct tm *" timeptr );
.sp
.BI "char *ctime(const time_t *" timep );
.sp
.BI "struct tm *gmtime(const time_t *" timep );
.sp
.BI "struct tm *localtime(const time_t *" timep );
.sp
.BI "time_t mktime(struct tm *" timeptr );
.sp
.BI "extern char *" tzname [2];
.BI "long int " timezone ;
.BI "extern int " daylight ;
.fi
.SH DESCRIPTION
The \fBctime()\fP, \fBgmtime()\fP and \fBlocaltime()\fP functions all take
an argument of data type \fItime_t\fP which represents calendar time.
When interpreted as an absolute time value, it represents the number of
seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal
Time (UTC).
.PP
The \fBasctime()\fP and \fBmktime()\fP functions both take an argument
representing broken-down time which is a binary representation
separated into year, month, day, etc. Broken-down time is stored
in the structure \fItm\fP which is defined in \fI<time.h>\fP as follows:
.sp
.RS
.nf
.ne 12
.ta 8n 16n 32n
struct tm
{
int tm_sec; /* seconds */
int tm_min; /* minutes */
int tm_hour; /* hours */
int tm_mday; /* day of the month */
int tm_mon; /* month */
int tm_year; /* year */
int tm_wday; /* day of the week */
int tm_yday; /* day in the year */
int tm_isdst; /* daylight saving time */
};
.ta
.fi
.RE
.PP
The members of the \fItm\fP structure are:
.TP
.I tm_sec
The number of seconds after the minute, normally in the range 0 to 59,
but can be up to 61 to allow for leap seconds.
.TP
.I tm_min
The number of minutes after the hour, in the range 0 to 59.
.TP
.I tm_hour
The number of hours past midnight, in the range 0 to 23.
.TP
.I tm_mday
The day of the month, in the range 1 to 31.
.TP
.I tm_mon
The number of months since January, in the range 0 to 11.
.TP
.I tm_year
The number of years since 1900.
.TP
.I tm_wday
The number of days since Sunday, in the range 0 to 6.
.TP
.I tm_yday
The number of days since January 1, in the range 0 to 365.
.TP
.I tm_isdst
A flag that indicates whether daylight saving time is in effect at the
time described. The value is positive if daylight saving time is in
effect, zero if it is not, and negative if the information is not
available.
.PP
The \fBctime()\fP function converts the calendar time \fItimep\fP into a
string of the form
.sp
.RS
"Wed Jun 30 21:49:08 1993\\n"
.RE
.sp
The abbreviations for the days of the week are `Sun', `Mon', `Tue', `Wed',
`Thu', `Fri', and `Sat'. The abbreviations for the months are `Jan',
`Feb', `Mar', `Apr', `May', `Jun', `Jul', `Aug', `Sep', `Oct', `Nov', and
`Dec'. The return value points to a statically allocated string which
might be overwritten by subsequent calls to any of the date and time
functions. The function also sets the external variable \fItzname\fP
with information about the current time zone.
.PP
The \fBgmtime()\fP function converts the calendar time \fItimep\fP to
broken-down time representation, expressed in Coordinated Universal Time
(UTC).
.PP
The \fBlocaltime()\fP function converts the calendar time \fItimep\fP to
broken-time representation, expressed relative to the user's specified
time zone. The function sets the external variables \fItzname\fP with
information about the current time zone, \fItimezone\fP with the difference
between Coordinated Universal Time (UTC) and local standard time in
seconds, and \fIdaylight\fP to a non-zero value if standard US daylight
savings time rules apply.
.PP
The \fBasctime()\fP function converts the broken-down time value
\fItimeptr\fP into a string with the same format as \fBctime()\fP.
The return value points to a statically allocated string which might be
overwritten by subsequent calls to any of the date and time functions.
.PP
The \fBmktime()\fP function converts a broken-down time structure, expressed
as local time, to
calendar time representation. The function ignores the specified contents
of the structure members \fItm_wday\fP and \fItm_yday\fP and recomputes
them from the other information in the broken-down time structure.
Calling \fBmktime()\fP also sets the external variable \fItzname\fP with
information about the current time zone. If the specified broken-down
time cannot be represented as calendar time, \fBmktime()\fP returns a
value of (time_t)(\-1) and does not alter the \fItm_wday\fP and \fItm_yday\fP
members of the broken-down time structure.
.SH "CONFORMING TO"
SVID 3, POSIX, BSD 4.3, ISO 9899
.SH "SEE ALSO"
.BR date "(1), " gettimeofday "(2), " time "(2), " tzset (3),
.BR difftime (3),
.BR strftime (3),
.BR newctime (3).
--
BTL didn't really have a distribution policy in the early days,
you got a disk with a note: Here's your rk05, Love Dennis. If Unix
crapped on your rk05, you'd write to Dennis for another.
--Andy Tannenbaum, "Politics of Unix," Washington, DC USENIX Conference, 1984
------------------------------
Date: Fri, 13 Aug 1999 19:30:50 +0930
From: "Brett" <vyking@iweb.net.au>
Subject: Newbie Qu. on Databases
Message-Id: <newscache$xreegf$tl$1@news.iweb.net.au>
Greetings!
I'm trying to learn Perl at the moment. I've been asked to connect an ODBC
Access database to the net, while making it searchable and am a little
stumped as where to begin.
I've been going through a tutorial on Win32 Perl, and will continue to do so
as I'm having a great time. I've been researching on a stack of sites such
as www.perl.com
I've found very little and am wondering if anyone can point me in the right
direction. I realise that what I am trying to do is beyond the scope of a
beginner. I'm not asking for someone to hand the answer to me on a platter
either as it's a great opportunity to learn.
Any help would be appreciated.
Brett
------------------------------
Date: Fri, 13 Aug 1999 11:34:45 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Newbie Qu. on Databases
Message-Id: <37B3F4C5.70832282@hotmail.com>
Brett wrote:
>
> Greetings!
>
> I'm trying to learn Perl at the moment. I've been asked to connect an ODBC
> Access database to the net, while making it searchable and am a little
> stumped as where to begin.
>
> I've been going through a tutorial on Win32 Perl, and will continue to do so
> as I'm having a great time. I've been researching on a stack of sites such
> as www.perl.com
>
> I've found very little and am wondering if anyone can point me in the right
> direction. I realise that what I am trying to do is beyond the scope of a
> beginner. I'm not asking for someone to hand the answer to me on a platter
> either as it's a great opportunity to learn.
>
> Any help would be appreciated.
>
> Brett
you cant have looked very hard??? though www.perl.com is a good place to
start, go to the dropdown at the top-right and select databases! :-)
Look for Win32::ODBC module or
DBD::ODBC and DBI modules available from CPAN, the docs may help.
try:
http://www.symbolstone.org/technology/perl/index.html
Richard H
------------------------------
Date: 13 Aug 1999 11:25:05 GMT
From: billynospam@mirror.bt.co.uk (Graham Ashton)
Subject: Re: Newbie Qu. on Databases
Message-Id: <slrn7r804i.e51.billynospam@wing.mirror.bt.co.uk>
In article <newscache$xreegf$tl$1@news.iweb.net.au>, Brett wrote:
>
>I'm trying to learn Perl at the moment.
Good luck. It's quite good fun, especially when you really get into it.
>I've been asked to connect an ODBC Access database to the net, while
>making it searchable and am a little stumped as where to begin.
I've never connected to an ODBC database myself (I use MySQL on Linux),
but the suggested method is to use the DBI module, a database
independent module that provides generic database access and control
methods. It has different drivers (DBD modules) for connecting to
different types of database (e.g. DBD:mysql, DBD::ODBC).
http://www.symbolstone.org/technology/perl/DBI/index.html
It's a very good way of writing "database portable" Perl.
>I've been going through a tutorial on Win32 Perl, and will continue to
>do so as I'm having a great time.
The Win32 version of the Learning Perl book by O'Reilly might be a good
investment in that case. You'll find it at http://perl.oreilly.com/
>I realise that what I am trying to do is beyond the scope of a
>beginner.
Possibly, but with the right info at hand you should be able to pick it
up quite quickly. Obviously, the more you do the more your code will
improve, but getting a connection going shouldn't be too hard with a
little help.
Try getting something simple working first, then work up to your
searchable stuff later.
>I'm not asking for someone to hand the answer to me on a platter either
>as it's a great opportunity to learn.
A refreshing attitude! Enjoy...
--
Graham
P.S. <billynospam@mirror.bt.co.uk> is a fully working address...
------------------------------
Date: Fri, 13 Aug 1999 13:02:39 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Newbie Qu. on Databases
Message-Id: <Pine.HPP.3.95a.990813130044.8178E-100000@hpplus03.cern.ch>
On Fri, 13 Aug 1999, Richard H wrote:
> Brett wrote:
> >
> > Greetings!
[...comprehensive quote...]
> > Any help would be appreciated.
> >
> > Brett
Are we having problems finding our newsreader's delete function?
------------------------------
Date: Fri, 13 Aug 1999 11:50:17 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Newbie Qu. on Databases
Message-Id: <37B3F869.C133CC9E@hotmail.com>
Brett wrote:
>
> Greetings!
>
> I'm trying to learn Perl at the moment. I've been asked to connect an ODBC
> Access database to the net, while making it searchable and am a little
> stumped as where to begin.
>
> I've been going through a tutorial on Win32 Perl, and will continue to do so
> as I'm having a great time. I've been researching on a stack of sites such
> as www.perl.com
>
> I've found very little and am wondering if anyone can point me in the right
> direction. I realise that what I am trying to do is beyond the scope of a
> beginner. I'm not asking for someone to hand the answer to me on a platter
> either as it's a great opportunity to learn.
>
> Any help would be appreciated.
>
> Brett
you cant have looked very hard on www.perl.com, a good place to
start, go to the dropdown at the top-right and select databases! :-)
Look for Win32::ODBC module:
http://www.roth.net/perl/odbc/
DBD::ODBC and DBI modules available from CPAN, the docs may help.
try:
http://www.symbolstone.org/technology/perl/index.html
Richard H
------------------------------
Date: Fri, 13 Aug 1999 08:59:43 -0500
From: Jonathan Epstein <Jonathan_Epstein@nih.gov>
Subject: Re: obtaining local IP address in ActivePerl
Message-Id: <37B424CF.65F6A626@nih.gov>
Thanks to all for your help. This works like a charm:
#!/usr/bin/perl
use Sys::Hostname;
use Socket;
$ip=gethostbyname(hostname());print inet_ntoa($ip);
- Jonathan
Charles DeRykus wrote:
> In article <37B1AD0B.4C65BD49@nih.gov>,
> Jonathan Epstein <Jonathan_Epstein@nih.gov> wrote:
> >Given the lack of getnetbyname() on ActivePerl (Win32) and the apparent
> >lack of hostname() when running it under Win95, what tricks do people
> >use to obtain their local IP address?
> >
> >Perhaps there's some trick of connecting to a well-known web server, and
> >reading back your own IP address from that server?
> >
> >I'm familiar with the pseudo-IP address 127.0.0.1 which always refers to
> >the local host, but that isn't going to cut it in this case ... I need
> >the real IP address.
> >
>
> You mean the following which works on NT doesn't work on Win32/95...
>
> perl -MSocket 'my $ip=gethostbyname("my_host");print inet_ntoa($ip),"\n"'
>
> There's also a command line `ipconfig' though I'm unsure about
> Win32/95 availability.
>
> hth,
> --
> Charles DeRykus
------------------------------
Date: Fri, 13 Aug 1999 08:35:28 -0400
From: Jeff Miller <jeffm641@ibm.net>
Subject: Perl sort question/help
Message-Id: <37B41110.89161E68@ibm.net>
I have a sort question/help request - I have read the FAQ and all its
pointers, but some of the sort information is just not clicking (HUGE
abuse opening). I want to sort a dataset on different fields, and have
been able to sort on the second field, but don't completly understand
why it works, and how to modify to sort on different fields. Sample line
of dataset to be sorted below, each line is similar structure
2873652:1999:ford:taurus:12995
Just to clarify, I would only want to sort on one field at a time. Below
is the Perl that sorts on the second (Date) field...
Dataset "jfilein" is opened above...
@linep = <jfilein>;
@idx = ();
for (@linep) {
($item) = /\d+\s*(\S+)/;
push @idx, uc($item);
}
@sorted = @linep[ sort { $idx[$a] cmp $idx[$b] } 0 .. $#idx ];
foreach $line (@sorted) {
@bdat = split (/:/, $line); # Splits at :(colon)
Printing information below....
This should look familure as some was cut and pasted from FAQ and
Docs...My biggest question is what exactly is the ($item) =
/\d+\s*(\S+)/; doing. If I understood this I believe that I may be
able to modify this to do the sorting of other fields (then again, maybe
not).
Thanks, Jeff Miller
------------------------------
Date: Fri, 13 Aug 1999 11:27:22 +0100
From: Richard H <rhrh@hotmail.com>
Subject: Re: Please help, DBI : statement handler
Message-Id: <37B3F30A.61619652@hotmail.com>
amita_rohatgi@my-deja.com wrote:
>
> Hi,
>
> I am executing the following piece of code which is a part of my
> program accessing the Oracle database.
> This code fetches only one id from the table though there are five ids
> it should fetch.
>
The problem I imagine is in your use of split,
I haven't tested it as you haven't said what is in $scalar.
Your problem may lie with not having quotes in the right places, the
code below yours works on my machine, have a look.
> $sth3 = $dbh->prepare(q(select id from table where (name = ?))) ||
<snip>
> But when I hardcode the values of name in the array like this
> @arr = ("Sanjose", "SantaClara", "Sunnyvale", "Fremont", "Cupertino");
> I get all the five ids of the cities from the table. Please help.
try this:
use DBI;
use strict;
my $dbh = DBI->connect("dbi:ODBC:db1.mdb") || die "cant connect
$DBI::errstr \n";
my $sth = $dbh->prepare("select * from Author where author = ?") || die
"cant prepare $DBI::errstr \n";
my @arr = ("Sunnyvale", "Fremont", "Cupertino");
or use this
## my $scalar = "Sunnyvale,Fremont,Cupertino";
## my @arr = split(/,/,$scalar);
print "The cities are @arr \n";
for (@arr) {
my $item = $_;
$sth->execute($item) || die $sth->errstr;
while (@_ = $sth->fetchrow()) {
print "Channel ID is : @_ \n";
}
}
$sth->finish() || die "$DBI::errstr \n";
die $sth->errstr if $sth->err;
$dbh->disconnect;
Hope that Helps
Richard H.
------------------------------
Date: 13 Aug 1999 11:55:07 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: searching complex data structure
Message-Id: <7p112r$s9t$1@lublin.zrz.tu-berlin.de>
Abigail <abigail@delanet.com> wrote in comp.lang.perl.misc:
>John Porter (jdporter@min.net) wrote on MMCLXXII September MCMXCIII in
><URL:news:slrn7r5u5c.ggv.jdporter@min.net>:
>!! Just FYI: the singular of "criteria" is "criterion".
>
>
>Not in Dutch.
No, in Dutch is "critterium", the place where the ugly konijns hide.
Anno
------------------------------
Date: Fri, 13 Aug 1999 11:05:12 +0100
From: "Mujakporue, Trey" <tmujak@wcom.co.uk>
To: "'comp.lang.perl.misc@list.deja.com'" <comp.lang.perl.misc@list.deja.com>
Subject: SMS PAGING MODULE
Message-Id: <11020643E71FD311ACAA0008C7C563F3AF22D5@gblon1c3ex1.wcom.co.uk>
Does anyone know if such a thing exists for perl?? i have checked CPAN but
joy??
----------------------
CONFIDENTIALITY NOTICE
This communication contains information which is confidential and may also be
privileged. It is for the exclusive use of the intended recipient(s). If you
are not the intended recipient(s), please note that any distribution, copying
or use of this communication or the information in it is strictly prohibited.
If you have received this communication in error, please notify us immediately
by telephone on +44 171 675 5000 and then destroy the email and any copies of
it. This communication is from MCI WorldCom Limited whose registered office is
at 14 Gray's Inn Road, London WC1X 8HN. Registered number 2776038.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Fri, 13 Aug 1999 07:53:21 -0400
From: -Sneex- <wcjones@fccj.org>
Subject: Re: Tom Christiansen "Perl Cookbook"
Message-Id: <37B40726.3C0D13C6@fccj.org>
elephant wrote:
>
> -Sneex- writes ..
> >On Date: Thu, 12 Aug 1999 22:24:08 GMT
> >support@gethits.com wrote -
> >
> >> pages 650-3 in "Perl Cookbook" has a recipe
> >> for using the Mail::Mailer module to send email
> >> through another machine's mail server.
> >
> >Hmmm, I don't see that. Which page is this statement on?
>
> page 652
> "
> Here's how to use SMTP with the machine mail.myisp.com as the mail
> server:
>
> $mailer = Mail::Mailer->new( "smtp", "mail.myisp.com");
How do YOU get "through another machine's mail server" from that???
The fact they reference 'myisp' menas they are in the
'authenticated group' - or I wouldn't be able to post this ;-)
> >What Nat & Tom do state, on pg 653, is that WinBlows doesn't normally
> >support sending mail from itself, so you have to find a server that is
> >-
> >
> >1) Configured wrong by the mail admin and allows relaying, or
> >2) Buy a real mail server platform - IE, Unix :) OR
> >3) Get your upstream provider to allow you to spam the free world...
>
> I suppose we should be grateful that you didn't put quotes around that
> little gem .. the author's meaning on page 653 doesn't come across as
> even closely aligned with your interpretation
I left out wonderful Macs on purpose (spam baiting...)
>
> "Some ports of Perl (Windows and Mac particularly) don't have sendmail
> or mail to use. In these cases, you should find an SMTP server you can
> send mail through."
>
> which - I assume - most of us have .. and clearly the originator has
> because they were able to get it working with different syntax
I don't see that - what I see is a bunch of BS where people want to
send mail (anonymously) thru whatever hapless server they can get their
crummy hands on...
BTW: In case most of the newbies reading this group didn't know -
You can have an SMTP server on both Macs and WinBlows.
But that would be off-topic. ;-)
HTHYMTIDM,
-Sneex-
____________________________________________________
MS Windows Sux! "It has to be good at something..."
------------------------------
Date: 13 Aug 1999 12:10:09 GMT
From: M.Ray@ulcc.ac.uk (Malcolm Ray)
Subject: Re: Tom Christiansen "Perl Cookbook"
Message-Id: <slrn7r82p1.9ku.M.Ray@carlova.ulcc.ac.uk>
On Fri, 13 Aug 1999 07:53:21 -0400, -Sneex- <wcjones@fccj.org> wrote:
>elephant wrote:
>>
>> -Sneex- writes ..
>> >On Date: Thu, 12 Aug 1999 22:24:08 GMT
>> >support@gethits.com wrote -
>> >
>> >> pages 650-3 in "Perl Cookbook" has a recipe
>> >> for using the Mail::Mailer module to send email
>> >> through another machine's mail server.
>> >
>> >Hmmm, I don't see that. Which page is this statement on?
>>
>> page 652
>> "
>> Here's how to use SMTP with the machine mail.myisp.com as the mail
>> server:
>>
>> $mailer = Mail::Mailer->new( "smtp", "mail.myisp.com");
>
>
>How do YOU get "through another machine's mail server" from that???
Well, uh, if, for example, the above line were run on, say,
www.myisp.com, and www.myisp.com is, like, a different machine
from mail.myisp.com, then, you know, it would be using another machine's
mail server, wouldn't it?
[snip]
>> "Some ports of Perl (Windows and Mac particularly) don't have sendmail
>> or mail to use. In these cases, you should find an SMTP server you can
>> send mail through."
>>
>> which - I assume - most of us have .. and clearly the originator has
>> because they were able to get it working with different syntax
>
>
>I don't see that - what I see is a bunch of BS where people want to
>send mail (anonymously) thru whatever hapless server they can get their
>crummy hands on...
That's a bizarre interpretation. Are you sure you're reading the right
article?
--
Malcolm Ray University of London Computer Centre
------------------------------
Date: 13 Aug 1999 12:31:32 +0200
From: Kvan <kvan@dis.dk>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <uzozwynsr.fsf@dis.dk>
Ian Clarke <I.Clarke@NOSPAM.strs.co.uk> writes:
> Because of my experience of Ml, I do not feel that limitations imposed
> on the programmer by a language are nescessarily a bad thing, and maybe,
> deep down, that is why I love Python.
That's funny: I happen to love both ML and Perl, but don't at all care
for C or Java, and probably wouldn't enjoy Python (I'll check it out,
when I find the time, but I can almost guess what the outcome will
be). ML is structured and logical because functional programming is
structured and logical, which means that a language for it has to be
concise and have an "abstract feel".
Imperative programming, however, is so much more like we usually think
(do this, then that), that I personally feel a vastly different
approach is necessary. In this category, Perl approaches the domain of
imperative programming as similar to that of speaking or acting in the
real world, and is accordingly as expressive as many spoken
languages. Python, on the other hand, tries to do something more along
the lines of ML--an approach which I personally don't think is
fitting.
Again, neither language is objectively superior. It's solely a
question of taste, and that means that your question isn't very
relevant, I'm afraid.
Kvan.
--
-------Casper Kvan Clausen------ | 'A *person* is smart. People are
---------<kvan@dis.dk>---------- | dumb, panicky, dangerous animals
| and you know it.'
| - "K" in Men in Black.
------------------------------
Date: 13 Aug 1999 06:46:57 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b413c1@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Ian Clarke <I.Clarke@strs.co.uk> writes:
:It is strange that you launch straight into a nit-picking attack of
:Python's syntax, seemingly designed to provoke exactly the type of debate
:that, by your own admission, is of no benefit.
You certainly have a peculiar definition, or at least use,
of "nit-picking". You asked about benefits, and I gave you a few.
I could have written 10x as much, because there are many other features
and foibles not shared in common. That I should have indicated one of
Python's perceived weaknesses is hardly a matter of nit-picking, for it
was no less than this that you yourself solicited from us.
It's difficult to avoid nit-picking in a world filled with nitwits.
--tom
--
"It's later than you don't think." --Larry Wall
------------------------------
Date: 13 Aug 1999 06:51:35 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b414d7@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Ian Clarke <I.Clarke@strs.co.uk> writes:
:I have, however, noticed a difference in perspective, which probably
:typifies a split in opinion going through most of computer science. The
:Python advocate is willing to tolerate limits placed on what they can do
:and write if it means that it makes code more readable for others, and
:other's code more readable to them (trusting Guido to make intelligent
:decisions on their behalf).
Legibility is purely subjective.
How legible do you find Greek, Arabic, Russian, or Chinese? And what
does the character set actually have to do with any inherent complexity
of the grammar or richness of expressive vocabulary?
Answer: nothing whatsoever.
--tom
--
"The tree of liberty must be watered periodically with the blood of tyrants
and patriots alike. It is its natural manure." --Thomas Jefferson
------------------------------
Date: 13 Aug 1999 07:04:32 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b417e0@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, Ian Clarke <I.Clarke@strs.co.uk> writes:
:Because of my experience of Ml, I do not feel that limitations imposed
:on the programmer by a language are nescessarily [sic] a bad thing,
:and maybe, deep down, that is why I love Python.
It is ironic that Larry, the product of generations of protestant
ministers and of Belgian extraction (Flemish, I believe) should be the
one who tries so very hard to respect the intelligence and judgment of
his audience and bends over backwards to avoid telling people what to do,
whereas Guido, obviously a Dutchman, finds it perfectly acceptable to
set up a world with rules and regulations, which either cannot be broken,
or whose penalty for doing so is immediate death via a fatal exception.
It is no wonder that many chafe at servile adherence to rules that someone
else decided would be good for them. Being told in a patronizing tone
that "Father knows best" evokes feelings of resentment and rebellion
that are entirely understandable. Eventually, you have to advance
out of kindergarten and develop your own personal laws and morality.
The world might be safer if it were filled with robots, but it would be
rather more dull and disheartening as well.
Recipe for a productive, post-kindergarten workplace of adults:
1) Assume competence.
2) Train the ignorant.
3) Fire the stupid.
--tom
--
I'm sure that that could be indented more readably, but I'm scared of
the awk parser. --Larry Wall in <6849@jpl-devvax.JPL.NASA.GOV>
------------------------------
Date: 13 Aug 1999 11:02:33 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Work around for signal handler crashes
Message-Id: <7p0u09$s6e$1@lublin.zrz.tu-berlin.de>
Tom Christiansen <tchrist@mox.perl.com> wrote in comp.lang.perl.misc:
> [courtesy cc of this posting mailed to cited author]
>--
>If a `religion' is defined to be a system of ideas that contains unprovable
>statements, then Goedel taught us that mathematics is not only a religion,
>it is the only religion that can prove itself to be one.
> -- John Barrow
I like it. Who is John Barrow?
Anno
------------------------------
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 499
*************************************