[25080] in Perl-Users-Digest
Perl-Users Digest, Issue: 7330 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 28 09:05:49 2004
Date: Thu, 28 Oct 2004 06:05:09 -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 Thu, 28 Oct 2004 Volume: 10 Number: 7330
Today's topics:
Re: A file open and close that doesnt modify a timestam (gumby)
Re: Am *I* allowed to make a suggestion for PG <cwilbur@mithril.chromatico.net>
Re: Am *I* allowed to make a suggestion for PG <flavell@ph.gla.ac.uk>
Re: browser output <nospam@nospam.com>
Re: browser output <cwilbur@mithril.chromatico.net>
Re: browser output <toreau@gmail.com>
Re: Compress::Zlib vs. external gzip call (Anno Siegel)
Extending the line input (angle) operator (Andrew Dunbar)
Re: Extending the line input (angle) operator <wyzelli@yahoo.com>
FAQ 2.17: Where do I send bug reports? <comdog@panix.com>
Re: Get Win32 Total Physical Memory & Available Physica <kuujinbo@hotmail.com>
Re: goto (was browser output) <tintin@invalid.invalid>
Re: goto (was browser output) (Anno Siegel)
Re: How's my logic? <peter@semantico.com>
Re: interpolation question: <nobull@mail.com>
Is there a wholly Perl Database equivalent to say MySQL <david@tvisnospam.co.uk>
Re: Is there a wholly Perl Database equivalent to say M <toreau@gmail.com>
Re: Is there a wholly Perl Database equivalent to say M <peter@semantico.com>
Re: Is there a wholly Perl Database equivalent to say M <ebohlman@omsdev.com>
Re: Is there a wholly Perl Database equivalent to say M <david@tvisnospam.co.uk>
Re: MAIL recommendation <nospam@nospam.com>
Re: MAP question <do-not-use@invalid.net>
Re: open-perl-ide qustion (Anno Siegel)
Re: Parallel/ Multithreading /Forking? (Anno Siegel)
Re: removin \n from only part of a string <toreau@gmail.com>
Re: removin \n from only part of a string <do-not-use@invalid.net>
Re: Should I use BEGIN, CHECK, or INIT? <peter@semantico.com>
Re: Should I use BEGIN, CHECK, or INIT? (Anno Siegel)
Re: Should I use BEGIN, CHECK, or INIT? <dug@plusthree.com>
Stubborn regex :-( <frosty@nilspamos.iinet.net.au>
Re: Stubborn regex :-( <do-not-use@invalid.net>
Re: Stubborn regex :-( <frosty@nilspamos.iinet.net.au>
Re: Stubborn regex :-( <mritty@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 28 Oct 2004 04:15:04 -0700
From: georgeziv@hotmail.com (gumby)
Subject: Re: A file open and close that doesnt modify a timestamp
Message-Id: <878baabf.0410280315.589dd88@posting.google.com>
Jim Gibson <jgibson@mail.arc.nasa.gov> wrote in message news:<271020041700435107%jgibson@mail.arc.nasa.gov>...
> In article <878baabf.0410271214.698835e7@posting.google.com>, gumby
> <georgeziv@hotmail.com> wrote:
>
> > I need to be able to open a file, read a file, then close a file with
> > out perl rewriting the TimeStamp on the file. I was able to do this
> > in C++ but not perl, and currently we are rewriting our old C code to
> > perl.
> >
>
>
> What operating system and version of Perl are you using? On my system
> (Mac OS 10.3, perl 5.8.5), opening and reading a file changes none of
> the file times atime, mtime, nor ctime.
We are currently using AIX. We have two file structures in place AFS,
and DFS. On the AIX system I have verfied that an open will change
the last modified time stamp on the file, where if i just ez the file
it wont change the last modified time stamp unless you save and exit.
I will look up some more info on the utime and how it works with AIX.
Thanks for the help.
------------------------------
Date: Thu, 28 Oct 2004 10:01:34 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: Am *I* allowed to make a suggestion for PG
Message-Id: <87lldrf9k6.fsf@mithril.chromatico.net>
>>>>> "lazy fuckwit" == daniel kaplan <nospam@nospam.com> writes:
(in response to Michael Carman)
>> Once you learn the rules, this is a wonderfully helpful and
>> perfectly freindly place.
lazy fuckwit> my sincere response is, if the regulars know the
lazy fuckwit> rules, and know what happens next , shouldn't they
lazy fuckwit> lead the way via example?
WHY ON EARTH do you think so many people pointed you at the Posting
Guidelines?
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Thu, 28 Oct 2004 13:27:15 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Am *I* allowed to make a suggestion for PG
Message-Id: <Pine.LNX.4.61.0410281325390.19356@ppepc56.ph.gla.ac.uk>
On Thu, 28 Oct 2004, Charlton Wilbur exposed to more-selective
readers that:
> >>>>> "lazy fuckwit" == daniel kaplan <nospam@nospam.com> writes:
>
> lazy fuckwit> my sincere response is, if the regulars know the
> lazy fuckwit> rules, and know what happens next , shouldn't they
> lazy fuckwit> lead the way via example?
>
> WHY ON EARTH do you think so many people pointed you at the Posting
> Guidelines?
Isn't it time to finally bring to an end this troll-feeding frenzy?
------------------------------
Date: Thu, 28 Oct 2004 03:21:44 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: browser output
Message-Id: <1098948155.136996@nntp.acecape.com>
"Uri Guttman" <uguttman@athenahealth.com> wrote in message
news:m3oeinyl4v.fsf@linux.local...
> she didn't say that so i won't assume it. there are uses for that as
> well.
>
> typical cult coder. goto is not 'needed' but it does have its uses. but
> that is beyond laura's vision. she needs to learn much more before she
> can make claims like that.
>
well, still new to Perl, but have found only one "for" which is refered to
in all the Perl books, and FAQ, with a "do not use" warning...so when she
says "why do they say 'never use goto!' and then put it in the language
anyway?" i knew which she meant.
------------------------------
Date: Thu, 28 Oct 2004 07:34:06 GMT
From: Charlton Wilbur <cwilbur@mithril.chromatico.net>
Subject: Re: browser output
Message-Id: <871xfjgvip.fsf@mithril.chromatico.net>
>>>>> "L" == Laura <lwt0301@bellsouth.net> writes:
L> goto is the one you should never ever use. no need for it
L> ever. why do they say 'never use goto!' and then put it in the
L> language anyway?
Because it very occasionally is the right thing to do. It is simpler
to tell newbies "never ever use goto," and then, when they have
attained a certain level of mastery, to show them where goto can make
code simpler, than to tell newbies "there are occasional good uses for
goto," and then say "no, this isn't one of them" thousands of times.
Not all language features are aimed at know-nothing idiots.
Charlton
--
cwilbur at chromatico dot net
cwilbur at mac dot com
------------------------------
Date: Thu, 28 Oct 2004 10:40:40 +0200
From: Tore Aursand <toreau@gmail.com>
Subject: Re: browser output
Message-Id: <pan.2004.10.28.08.40.40.57262@gmail.com>
On Wed, 27 Oct 2004 15:34:01 -0400, daniel kaplan wrote:
> with regards to your EXIT comment, if i hear correctly , just make sure
> your script is at the bottom of the file (subroutines on top) and just
> let it run through?
No. It - normally - doesn't matter where your subroutines are, and in
"traditional" CGI programming you should _never_ use 'exit'.
Why do you need to use exit? A CGI program runs from A to Z, then it's
done, right? Why do you need to exit at - for instance - F og M in the
script?
If you show me your code, I will show you what is wrong.
--
Tore Aursand <toreau@gmail.com>
"The purpose of all war is ultimately peace." (Saint Augustine)
------------------------------
Date: 28 Oct 2004 10:35:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Compress::Zlib vs. external gzip call
Message-Id: <clqi1q$jfh$1@mamenchi.zrz.TU-Berlin.DE>
odigity <ofer@netapt.com> wrote in comp.lang.perl.misc:
> I'm writing a script that needs to run in as fast a time as possible.
> Every minute counts. The script crawls a tree of gzipped files
> totalling about 30gb. Originally I was calling open() with "gzip
> $file |", but I hate making external calls - it requires a fork, and
> you have very limited communication with the process for catching
> errors and such. I always like using perl functions and modules when
> possible over external calls. However, I wanted to make sure I
> wouldn't take a performance hit before switching to Compress::Zlib.
>
> I picked one of the bigger files (75mb) and ran some benchmarking on
> it, comparing Compress::Zlib to an exernal call to the gzip utility.
> Here's the code:
>
> #!/usr/bin/perl -w
> use strict;
> use Benchmark qw( cmpthese );
> use Compress::Zlib;
> use IO::File;
>
> my $file = 'sample.gz';
>
> print "warming up the file...\n";
> system( "zcat $file > /dev/null" );
>
> print "starting comparison...\n";
> cmpthese( 3, {
> 'ext_gzip' => \&ext_gzip,
> 'compress_zlib' => \&compress_zlib,
> });
>
>
> sub ext_gzip
> {
> my $fh = IO::File->new( "gzip -cd $file |" ) or die( "could not gzip
> -cd '$file' for reading: $!" );
> my $lines = 0;
> while ( defined(my $line = $fh->getline()) ) {
> $lines++;
> }
> $fh->close();
> print "ext_gzip: $lines lines\n";
> }
>
>
> sub compress_zlib
> {
> my $gz = gzopen( $file, 'rb' ) or die( "could not gzopen '$file' for
> reading: $!" );
> my $line;
> my $lines = 0;
> while ( ( my $bytes = $gz->gzreadline( $line ) ) > 0 ) {
> die( $gz->gzerror ) if ( $bytes == -1 );
> $lines++;
> }
> $gz->gzclose();
> print "compress_zlib: $lines lines\n";
> }
>
> Here's the output:
>
> warming up the file...
> starting comparison...
> compress_zlib: 15185003 lines
> compress_zlib: 15185003 lines
> compress_zlib: 15185003 lines
> (warning: too few iterations for a reliable count)
> ext_gzip: 15185003 lines
> ext_gzip: 15185003 lines
> ext_gzip: 15185003 lines
> (warning: too few iterations for a reliable count)
> s/iter compress_zlib ext_gzip
> compress_zlib 68.6 -- -23%
> ext_gzip 52.8 30% --
>
> Now, this wasn't the best possible benchmarking test, but I still
> think I am justified in being concerned.
I'm afraid the benchmark is useless. Benchmark doesn't count the
CPU time spent in children, so you're not catching the interesting
part in ext_gzip.
Anno
------------------------------
Date: 28 Oct 2004 01:49:16 -0700
From: hippytrail@gmail.com (Andrew Dunbar)
Subject: Extending the line input (angle) operator
Message-Id: <ba1b6b9f.0410280049.2cbce46b@posting.google.com>
I would like to extend the line input operator to treat something
other than CR/LF/CRLF as the end of line character.
I'm scanning very very large structured files which contain very few
end of line characters yet the structure is such that another set
string of characters has the same semantics "),(" in this case.
Naturally I could use fgetc or buffered reads or link to a C routine
but this seems like exactly the kind of thing Perl usually allows
insteading of needing to reivent.
Is there a way to extend this operator in current Perl?
If not, is there a module which offers what I want?
If not, would anybody care to recommend the quickest, most effective
way to reach my goal of a line-reading function in Perl which thinks
of a "line" as ending with "),(" rather than \n?
------------------------------
Date: Thu, 28 Oct 2004 09:00:46 GMT
From: "Peter Wyzl" <wyzelli@yahoo.com>
Subject: Re: Extending the line input (angle) operator
Message-Id: <2z2gd.1590$K7.578@news-server.bigpond.net.au>
"Andrew Dunbar" <hippytrail@gmail.com> wrote in message
news:ba1b6b9f.0410280049.2cbce46b@posting.google.com...
>I would like to extend the line input operator to treat something
> other than CR/LF/CRLF as the end of line character.
>
> I'm scanning very very large structured files which contain very few
> end of line characters yet the structure is such that another set
> string of characters has the same semantics "),(" in this case.
>
> Naturally I could use fgetc or buffered reads or link to a C routine
> but this seems like exactly the kind of thing Perl usually allows
> insteading of needing to reivent.
>
> Is there a way to extend this operator in current Perl?
> If not, is there a module which offers what I want?
> If not, would anybody care to recommend the quickest, most effective
> way to reach my goal of a line-reading function in Perl which thinks
> of a "line" as ending with "),(" rather than \n?
The standard variable $/ is what you are looking for.
set $/ to be what you want (before the read)...
$/ = '),(';
Even better, localise it within a block.
$/ is "\n" here...
{
local $/ = '),(';
#read with <> here...
}
$/ back to default "\n" here...
Check it out in perlvar (INPUT_RECORD_SEPARATOR)
--
Wyzelli
print map{++$_;y{0-9A-Za-mn-z;}
{0-9A-Za-no-y z;}ds;$_}split '',
reverse 'qdjbzGykqdOyqdgsnmzysrtI';
------------------------------
Date: Thu, 28 Oct 2004 10:03:01 +0000 (UTC)
From: PerlFAQ Server <comdog@panix.com>
Subject: FAQ 2.17: Where do I send bug reports?
Message-Id: <clqg4l$8ad$1@reader1.panix.com>
This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with Perl.
--------------------------------------------------------------------
2.17: Where do I send bug reports?
If you are reporting a bug in the perl interpreter or the modules
shipped with Perl, use the *perlbug* program in the Perl distribution or
mail your report to perlbug@perl.org .
If you are posting a bug with a non-standard port (see the answer to
"What platforms is Perl available for?"), a binary distribution, or a
non-standard module (such as Tk, CGI, etc), then please see the
documentation that came with it to determine the correct place to post
bugs.
Read the perlbug(1) man page (perl5.004 or later) for more information.
--------------------------------------------------------------------
Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short. They represent an important
part of the Usenet tradition. They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.
If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile. If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.
Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release. It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.
The perlfaq manual page contains the following copyright notice.
AUTHOR AND COPYRIGHT
Copyright (c) 1997-2002 Tom Christiansen and Nathan
Torkington, and other contributors as noted. All rights
reserved.
This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.
------------------------------
Date: Thu, 28 Oct 2004 18:39:19 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Get Win32 Total Physical Memory & Available Physical Memory stats
Message-Id: <2ubt50F292pceU1@uni-berlin.de>
KWall wrote:
> "ko" <kuujinbo@hotmail.com> wrote in message
[snip code]
> I noticed "my $host = $ARGV[0]". I assumed that this was a target remote
> server. However, I get "Too many parameters" error when I run SCRIPT.PL
> SERVERNAME. Is this what you intended?
> Thanks,
> Karim
>
Yes, that's how it works. Don't know why you're having problems, check
perldiag against the exact error you're getting. Tested with ActiveState
Perl 5.8.4, Win32::OLE 0.1701 and Cygwin Perl 5.8.2, Win32::OLE 0.1502.
Try hard-coding the hostname/IP and see if that works. You said that you
have plenty of hosts to query, so I assume that you're either going to
get a list of hosts from a text file or database lookup anyway.
HTH - keith
------------------------------
Date: Thu, 28 Oct 2004 21:15:50 +1300
From: "Tintin" <tintin@invalid.invalid>
Subject: Re: goto (was browser output)
Message-Id: <2ubo3fF27cah6U1@uni-berlin.de>
"Michael Carman" <mjcarman@mchsi.com> wrote in message
news:clousn$9421@onews.rockwellcollins.com...
> Laura wrote:
>>
>> goto is the one you should never ever use. no need for it ever. why
>> do they say 'never use goto!' and then put it in the language anyway?
>
> There *are* occasions when goto is necessary, just like there are
> occasions when using symbolic references is necessary. Both situations
> are very rare, but it does happen.
>
> That said, Perl has three flavors of goto, which are not all the same:
>
> goto LABEL
> goto EXPR
> goto &NAME
>
> The first two are the traditional "jump to someplace else" that's
> generally considered bad. goto &NAME is very different: it replaces the
> current subroutine with the one referenced. While the first two forms
> are shunned, the third is quite common (e.g. in an AUTOLOAD).
I notice that File::Compare and File::Copy both make extensive use of goto
LABEL.
Anyone care to comment on whether it's really needed in these modules?
------------------------------
Date: 28 Oct 2004 11:48:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: goto (was browser output)
Message-Id: <clqm9i$m3q$1@mamenchi.zrz.TU-Berlin.DE>
Tintin <tintin@invalid.invalid> wrote in comp.lang.perl.misc:
>
> "Michael Carman" <mjcarman@mchsi.com> wrote in message
> news:clousn$9421@onews.rockwellcollins.com...
> > Laura wrote:
> >>
> >> goto is the one you should never ever use. no need for it ever. why
> >> do they say 'never use goto!' and then put it in the language anyway?
> >
> > There *are* occasions when goto is necessary, just like there are
> > occasions when using symbolic references is necessary. Both situations
> > are very rare, but it does happen.
> >
> > That said, Perl has three flavors of goto, which are not all the same:
> >
> > goto LABEL
> > goto EXPR
> > goto &NAME
> >
> > The first two are the traditional "jump to someplace else" that's
> > generally considered bad. goto &NAME is very different: it replaces the
> > current subroutine with the one referenced. While the first two forms
> > are shunned, the third is quite common (e.g. in an AUTOLOAD).
>
> I notice that File::Compare and File::Copy both make extensive use of goto
> LABEL.
>
> Anyone care to comment on whether it's really needed in these modules?
The question is not if it's needed, but if it is used reasonably.
Goto is evil when used as the primary means of flow control. At the
time Dijkstra mounted his campaign against "goto", there were
languages (most notably Fortran), that *had* no other large-scale
flow control ("if" only worked on one statement). That used to make
a mess of programs. The campaign wasn't so much against the use of
"goto" by individual programmers (they often had no choice), but
to foster the design of "structured" languages that didn't force
"goto" upon their users.
These days there are no more mainstream languages that aren't
"structured", so nobody talks about "structured programming" anymore,
but everyone does it. In that framework, the occasional "goto" is
no big deal, and it can be the operation of choice.
Anno
------------------------------
Date: Thu, 28 Oct 2004 09:14:23 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: How's my logic?
Message-Id: <4180aa5f$0$29249$afc38c87@news.easynet.co.uk>
Paul Lalli wrote:
> Much prefered (IMHO, of course) would be to abandon the use of and/or as
> control-flow operators in this case, and use the normal if/else syntax:
> if ($ftp->login($user, $pass){
> print "Success...";
> } else {
> print "Problem...";
> }
This is also much easier to read!
------------------------------
Date: Thu, 28 Oct 2004 12:20:43 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: interpolation question:
Message-Id: <clqkdj$7q6$1@sun3.bham.ac.uk>
c186282 wrote:
[ snip FAQ: "How can I expand variables in text strings?" ]
You are supposed to check the FAQ before you post.
But see also numerous previous thread discussing this FAQ (simply seach
for the exact string "How can I expand variables in text strings?
") because I think the answer in the FAQ is incompete.
------------------------------
Date: Thu, 28 Oct 2004 10:40:02 GMT
From: zzapper <david@tvisnospam.co.uk>
Subject: Is there a wholly Perl Database equivalent to say MySQL?
Message-Id: <lki1o0d8uditjfpsbc0583o6g5t4cqm5io@4ax.com>
Hi,
I find with horror that I have to do a "Membership" project without access to MYSQL. Is there a
wholly Perl Mini-Database Module/Application you would care to recommend. It would just require
standard database facilities ie search,insert,update,remove
All ideas (desperately) welcome
passme
approve
--
zzapper (vim, cygwin, wiki & zsh)
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & life tips
------------------------------
Date: Thu, 28 Oct 2004 12:47:59 +0200
From: Tore Aursand <toreau@gmail.com>
Subject: Re: Is there a wholly Perl Database equivalent to say MySQL?
Message-Id: <pan.2004.10.28.10.47.59.51926@gmail.com>
On Thu, 28 Oct 2004 10:40:02 +0000, zzapper wrote:
> I find with horror that I have to do a "Membership" project without
> access to MYSQL. Is there a wholly Perl Mini-Database Module/Application
> you would care to recommend. It would just require standard database
> facilities ie search,insert,update,remove
Did you search CPAN? There are a lot of solutions to choose between, but
if you need to stay with SQL, you should have a look at the different DBD
drivers out there (there are drivers for CSV files etc).
My personal favourite is DBD::SQLite;
<http://search.cpan.org/~msergeant/DBD-SQLite-1.07/>
--
Tore Aursand <toreau@gmail.com>
"Daring ideas are like chessmen moved forward; they may be beaten, but
they may start a winning game." (Johann Wolfgang von Goethe)
------------------------------
Date: Thu, 28 Oct 2004 11:53:04 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Is there a wholly Perl Database equivalent to say MySQL?
Message-Id: <4180cf91$0$1370$afc38c87@news.easynet.co.uk>
zzapper wrote:
> Hi,
> I find with horror that I have to do a "Membership" project without access to MYSQL. Is there a
> wholly Perl Mini-Database Module/Application you would care to recommend. It would just require
> standard database facilities ie search,insert,update,remove
>
> All ideas (desperately) welcome
>
> passme
> approve
>
>
Well there is the DBD::CSV database driver that allows you to use the perl DBI
but stores all the tables within text files. Later you could upgrade to MySQL or
Postgres without (much) change to your code.
Not used it much as I have access to Postgres
------------------------------
Date: 28 Oct 2004 12:14:11 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: Is there a wholly Perl Database equivalent to say MySQL?
Message-Id: <Xns95904A9CDEA3Febohlmanomsdevcom@130.133.1.4>
zzapper <david@tvisnospam.co.uk> wrote in
news:lki1o0d8uditjfpsbc0583o6g5t4cqm5io@4ax.com:
> I find with horror that I have to do a "Membership" project without
> access to MYSQL. Is there a wholly Perl Mini-Database
> Module/Application you would care to recommend. It would just require
> standard database facilities ie search,insert,update,remove
Please clarify what you mean by "wholly Perl." If you mean "doesn't
require a separate server process" then I'd strongly second the
recommendation for DBD::SQLite. If you mean "doesn't require any compiled
code" then your options are much more limited; DBD::Sprite comes to mind.
I'm guessing, possibly wrongly, that this is a Web application hosted on a
shared server. If that's the case, then remember that all of these
alternatives store data in regular files that need to be accessible to your
code, which means you have to pay more attention to security (e.g. keep the
files out of your publicly accessible directories).
Once again, if whoever is in charge of the host system is willing to
install modules for you, I'd say go with DBD::SQLite. If you're limited to
installing modules in your own space and don't have the ability to compile
on the host system, then see if there's a pre-compiled binary available.
------------------------------
Date: Thu, 28 Oct 2004 12:35:54 GMT
From: zzapper <david@tvisnospam.co.uk>
Subject: Re: Is there a wholly Perl Database equivalent to say MySQL?
Message-Id: <h6p1o0dca8h6a0st7jogu4kjpprk3u28ai@4ax.com>
On 28 Oct 2004 12:14:11 GMT, wrote:
>zzapper <david@tvisnospam.co.uk> wrote in
>news:lki1o0d8uditjfpsbc0583o6g5t4cqm5io@4ax.com:
>
>
>Once again, if whoever is in charge of the host system is willing to
>install modules for you, I'd say go with DBD::SQLite. If you're limited to
>installing modules in your own space and don't have the ability to compile
>on the host system, then see if there's a pre-compiled binary available.
Thanx everybody, am looking at SQLite have installed it on my server. looks good so far!
--
zzapper (vim, cygwin, wiki & zsh)
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & life tips
------------------------------
Date: Thu, 28 Oct 2004 03:04:59 -0400
From: "daniel kaplan" <nospam@nospam.com>
Subject: Re: MAIL recommendation
Message-Id: <1098947149.952750@nntp.acecape.com>
"Michele Dondi" <bik.mido@tiscalinet.it> wrote in message
news:vu70o05l9b35krvu0jurcpr1s0cth65hoh@4ax.com...
> So... dingalingaling!! Doesn't this suggest that there may be
> something wrong in *your* attitude?
>
> However the two subjects are indeed similar, but not just the same,
> and the differences *can* justify the different treatments.
well if you go by the first FOUR posts, an exchange between myself an
wilbur, no...i see little difference....if it's cool with you i think i say
it all in "Am *I* allowed to make a suggestion for PG" which suprising has
led to very little noise...i can't sit here and say everythig i say is
right, somewhere my mother is wrong, and i have to be in error....but i can
only hope it makes it clear.
have a fantastic day!
------------------------------
Date: 28 Oct 2004 09:37:03 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: MAP question
Message-Id: <yzdr7nj2t0g.fsf@invalid.net>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) writes:
> A. Sinan Unur <1usa@llenroc.ude.invalid> wrote in comp.lang.perl.misc:
> > Arndt Jonasson <do-not-use@invalid.net> wrote in
> > news:yzdvfcw2nue.fsf@invalid.net:
> >
> > > You seem to be talking about a hash table with no values in it. This
> > > does make sense, if you want the hash table to just be a collection of
> > > strings that allows for fast lookup whether a given string is present
> > > or not.
> > >
> > > The line below constructs a hash table with keys as given in @_tem,
> > > with the "undefined value" as value for them. It does this by
> > > specifiying a hash slice (of a hash table that doesn't exist yet, but
> > > that's Perl).
> > >
> > > @allReleases{@_tem} = undef;
> > >
> > > If you do want to associate the keys with values in your hash table,
> > > you need to let the values enter the computation somewhere.
> >
> > The above is misleading in that it creates the impression that one could
> > replace the undef above with anything else and still use it this way.
>
> Yup, misleading also to a casual reader of the program. It explicitly
> assigns undef() to one hash element and leaves the others alone for no
> good reason. While the effect is the same, the correct way of writing
> this is to leave all elements unspecified:
>
> @allReleases{@_tem} = ();
This is much better, of course. Thanks for correcting me. (Going by mere
impressions is of course not a good thing to do.)
------------------------------
Date: 28 Oct 2004 09:06:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: open-perl-ide qustion
Message-Id: <clqcqu$ddn$1@mamenchi.zrz.TU-Berlin.DE>
daniel kaplan <nospam@nospam.com> wrote in comp.lang.perl.misc:
> "Anno Siegel" <anno4000@lublin.zrz.tu-berlin.de> wrote in message
> news:clnsc5$n7i$1@mamenchi.zrz.TU-Berlin.DE...
>
> > Then why did you post it? It has zero informative content.
>
> merely replying to someone who posted a nuetral/unnegative resposne...
Thanks for the warning. I'll try not to post unnegative responses
to you.
> i see ted posted a reply too. any chance he read the FAQ which he wrote (i
> asumme many authors and he typed it) and waited the alloted "don't answer
> angry rule"?
Sounds more resigned than angry to me.
Anno
------------------------------
Date: 28 Oct 2004 11:08:42 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Parallel/ Multithreading /Forking?
Message-Id: <clqjvq$jfh$2@mamenchi.zrz.TU-Berlin.DE>
<ctcgag@hotmail.com> wrote in comp.lang.perl.misc:
> Prab_kar@hotmail.com (Prabh) wrote:
> > Hi,
> > My task involves searching a huge number of files on filesystem and
> > based on the filetype perform some function. e.g. if file is ".java"
> > perform a particular routine, if its ".pl" perform another.
> >
> > As the no. of files is quite huge, I thought it'd be most efficient if
> > I used any parallel-processing techinique.
>
> The easiest way to parallel process directory tree is just to run
> the program multiple times independently, each one operating from
> a different root node.
>
> perl do_stuff.pl /opt/partition1/mystuff &
> perl do_stuff.pl /opt/partition1/yourstuff &
> perl do_stuff.pl /opt/partition2 &
>
> etc.
>
> But that doesn't do load balancing very well (if one program finishes much
> ealier than the others, it will just exit, rather that start working on
> whatever the slower ones haven't gotten to yet.)
If there are symlinks criss-crossing the file system there is also
the possibility that it does part of the tree repeatedly.
Anno
------------------------------
Date: Thu, 28 Oct 2004 10:50:21 +0200
From: Tore Aursand <toreau@gmail.com>
Subject: Re: removin \n from only part of a string
Message-Id: <pan.2004.10.28.08.50.21.152671@gmail.com>
On Wed, 27 Oct 2004 23:12:50 +0200, Gunnar Hjalmarsson wrote:
> $string =~ s/(<[^>]+>)/ ( my $tmp = $1 ) =~ s!\n!!g; $tmp /eg;
How about this one?
1 while ( $string =~ s,(<.*?)\n(.*?>),$1$2,sg );
--
Tore Aursand <toreau@gmail.com>
"Writing modules is easy. Naming modules is hard." (Anno Siegel, on
comp.lang.perl.misc)
------------------------------
Date: 28 Oct 2004 12:05:10 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: removin \n from only part of a string
Message-Id: <yzdis8v2m5l.fsf@invalid.net>
Tore Aursand <toreau@gmail.com> writes:
> On Wed, 27 Oct 2004 23:12:50 +0200, Gunnar Hjalmarsson wrote:
> > $string =~ s/(<[^>]+>)/ ( my $tmp = $1 ) =~ s!\n!!g; $tmp /eg;
>
> How about this one?
>
> 1 while ( $string =~ s,(<.*?)\n(.*?>),$1$2,sg );
It fails if there are several <> groupings in the string. Try
$string = "A\nB\n< one\nline\n>\nC\nD<one\nmore\nline\n>\nE\n";
You could say it ignores the "^>" part in the other solution.
------------------------------
Date: Thu, 28 Oct 2004 09:22:18 +0100
From: Peter Hickman <peter@semantico.com>
Subject: Re: Should I use BEGIN, CHECK, or INIT?
Message-Id: <4180ac3c$0$1399$afc38c87@news.easynet.co.uk>
J. Romano wrote:
> And my second question: If it is a good idea to automatically call
> the init() function for the programmer, should I:
>
> a) put the init() statement in a BEGIN block
> b) put the init() statement in a CHECK block
> c) put the init() statement in an INIT block
> d) put the init() statement as the last statement executed
> in the module
> or
> e) it's not a good idea, so just let the programmer who uses
> my module call it in his/her own code
I would put it in the BEGIN block and if I was really worried about the init()
function being called only once I would make that a closure.
BEGIN { init(); }
{
my $called = 0;
sub init {
unless( $called ) {
print "Called init for the first time\n";
$called = 1;
} else {
print "Init has already been called\n";
}
}
}
I would not put it in the CHECK block in case there were any side effects of
calling it such as opening database connections, files or the like. As, I
believe, that CHECK is called when you do...
perl -c Module.pm
where as BEGIN is not.
I think, can anyone confirm this. I am only on my first cup to tea.
------------------------------
Date: 28 Oct 2004 09:48:34 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Should I use BEGIN, CHECK, or INIT?
Message-Id: <clqf9i$ddn$2@mamenchi.zrz.TU-Berlin.DE>
J. Romano <jl_post@hotmail.com> wrote in comp.lang.perl.misc:
> Greetings,
>
> I have a couple of questions and I would like to know the opinions
> of the Perl community.
>
> I while ago, I wrote a Perl module which is now practically
> finished. Its exact contents aren't important for my questions,
> except for the fact that it is a package and its functions are called
> like:
>
> use MyPackage;
> MyPackage::init();
> MyPackage::f1();
> MyPackage::f2($var1, $var2);
[...]
> And my second question: If it is a good idea to automatically call
> the init() function for the programmer, should I:
>
> a) put the init() statement in a BEGIN block
> b) put the init() statement in a CHECK block
> c) put the init() statement in an INIT block
> d) put the init() statement as the last statement executed
> in the module
> or
> e) it's not a good idea, so just let the programmer who uses
> my module call it in his/her own code
I have little to add to Tassilo's thorough discussion of the issue,
except still another alternative:
f) rename the init() function as import() (or call it from
the import() function)
That (import()) will be called after the last executable statement
of your module, but before "use" returns to the caller, so it is
basically equivalent to d). The difference is that the user has
the choice to suppress the call to import() and call it on their
own.
> The only difference I see between BEGIN, CHECK, and INIT (besides
> the facts that BEGIN statments happen before CHECK statements which
> happen before INIT statements and that CHECK statements happen in
Another difference is that BEGIN and CHECK are executed when the
module in question is loaded. INIT (and END) are collected and
not executed before all compile-time activity is done, so if more
modules are loaded, INIT only runs after that has happened.
Anno
------------------------------
Date: Thu, 28 Oct 2004 08:23:36 -0400
From: Douglas Hunter <dug@plusthree.com>
Subject: Re: Should I use BEGIN, CHECK, or INIT?
Message-Id: <clqoc2$qlf$0@pita.alt.net>
Peter Hickman wrote:
> I would not put it in the CHECK block in case there were any side
> effects of calling it such as opening database connections, files or the
> like. As, I believe, that CHECK is called when you do...
>
> perl -c Module.pm
>
> where as BEGIN is not.
>
dug@slurp:~/scratch$ cat A.pm
package A;
BEGIN { warn "begin" }
CHECK { warn "check" }
INIT { warn "init" }
END { warn "end" }
1;
dug@slurp:~/scratch$ perl -c A.pm
begin at A.pm line 3.
check at A.pm line 4.
A.pm syntax OK
dug@slurp:~/scratch$ perl A.pm
begin at A.pm line 3.
check at A.pm line 4.
init at A.pm line 5.
end at A.pm line 6.
See perlmod for more details.
> I think, can anyone confirm this. I am only on my first cup to tea.
Whereas I have the luxury of being well into my second cup of coffee {grin}.
-- Douglas Hunter
------------------------------
Date: Thu, 28 Oct 2004 17:58:00 +1000
From: "Frostillicus" <frosty@nilspamos.iinet.net.au>
Subject: Stubborn regex :-(
Message-Id: <4180a689$0$13746$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
I'm having trouble getting a regex to evaluate to true, even though it looks
plainly obvious to me that it should be. Here's what I'm doing...
print "find=" . $form{'find'} . ";name=" . $hashref->{'name'};
This line of code prints the following for an example set of data...
find=ant;name=The Ant's Pants.
Here's the code...
my $temp = $hashref->{'name'};
if ($form{'find'} =~ /$temp/i) {
print "Found record!";
}
You might say that I shouldn't need to stuff the hashref into a $temp
variable, but I did that in desperation in case some bizarre problem has
preventing me from matching on a value inside a reference to a hash.
------------------------------
Date: 28 Oct 2004 10:17:44 +0200
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Stubborn regex :-(
Message-Id: <yzdmzy72r4n.fsf@invalid.net>
"Frostillicus" <frosty@nilspamos.iinet.net.au> writes:
> I'm having trouble getting a regex to evaluate to true, even though it looks
> plainly obvious to me that it should be. Here's what I'm doing...
>
> print "find=" . $form{'find'} . ";name=" . $hashref->{'name'};
>
>
> This line of code prints the following for an example set of data...
>
> find=ant;name=The Ant's Pants.
>
>
> Here's the code...
>
> my $temp = $hashref->{'name'};
>
> if ($form{'find'} =~ /$temp/i) {
> print "Found record!";
> }
I think you want the operands of =~ the other way around. What the
above amounts to is
if ("ant" =~ /The Ant's Pants/i) {
print "Found record!";
}
------------------------------
Date: Thu, 28 Oct 2004 18:16:36 +1000
From: "Frostillicus" <frosty@nilspamos.iinet.net.au>
Subject: Re: Stubborn regex :-(
Message-Id: <4180aae7$0$13762$5a62ac22@per-qv1-newsreader-01.iinet.net.au>
Hmm, my bad... If I swap the variables around, voilas! Grrrrr!
"Frostillicus" <frosty@nilspamos.iinet.net.au> wrote in message
news:4180a689$0$13746$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
> I'm having trouble getting a regex to evaluate to true, even though it
looks
> plainly obvious to me that it should be. Here's what I'm doing...
>
> print "find=" . $form{'find'} . ";name=" . $hashref->{'name'};
>
>
> This line of code prints the following for an example set of data...
>
> find=ant;name=The Ant's Pants.
>
>
> Here's the code...
>
> my $temp = $hashref->{'name'};
>
> if ($form{'find'} =~ /$temp/i) {
> print "Found record!";
> }
>
>
>
> You might say that I shouldn't need to stuff the hashref into a $temp
> variable, but I did that in desperation in case some bizarre problem has
> preventing me from matching on a value inside a reference to a hash.
>
>
------------------------------
Date: Thu, 28 Oct 2004 06:34:49 -0400
From: Paul Lalli <mritty@gmail.com>
Subject: Re: Stubborn regex :-(
Message-Id: <clqi0i$sra$1@misc-cct.server.rpi.edu>
Frostillicus wrote:
> "Frostillicus" <frosty@nilspamos.iinet.net.au> wrote in message
> news:4180a689$0$13746$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
>
>>
>>print "find=" . $form{'find'} . ";name=" . $hashref->{'name'};
>>
>>This line of code prints the following for an example set of data...
>>find=ant;name=The Ant's Pants.
>>
>>
>>Here's the code...
>>
>>my $temp = $hashref->{'name'};
>>
>>if ($form{'find'} =~ /$temp/i) {
>> print "Found record!";
>>}
>>
>>You might say that I shouldn't need to stuff the hashref into a $temp
>>variable, but I did that in desperation in case some bizarre problem has
>>preventing me from matching on a value inside a reference to a hash.
>>
> Hmm, my bad... If I swap the variables around, voilas! Grrrrr!
For future reference, it is sometimes helpful to read the =~ as
"contains" rather than "matches". If you do that, your original
statement reads:
if 'ant' contains "The Ant's Pants" then print 'Found Record!'.
If you read it allowed like this, it becomes obvious that the
'containment' is reversed.
Paul Lalli
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 7330
***************************************