[22974] in Perl-Users-Digest
Perl-Users Digest, Issue: 5194 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jul 8 06:05:50 2003
Date: Tue, 8 Jul 2003 03: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 Tue, 8 Jul 2003 Volume: 10 Number: 5194
Today's topics:
Re: ASP --> PERL SCRIPT HELP>>PLEASE>> <barrettclark.NOSPAM@comcast.net>
Re: Call parent method indirectly <bart.lateur@pandora.be>
CPAN modules for Apache 2.0.XX (Oren Laadan)
Dynamically generating multi-table SQL (Jesse Sheidlower)
Re: From floating point to fraction <ben.goldberg@hotpop.com>
Re: Google's newsgroups <palladium@spinn.net>
Re: Help with Perl Script (Helgi Briem)
Re: How do I clone a structure? <tassilo.parseval@rwth-aachen.de>
Re: How do I clone a structure? (Sam Holden)
Re: How do I clone a structure? <bart.lateur@pandora.be>
Re: HTML::HeadParser to print the title <jidanni@jidanni.org>
Re: microphone input (Helgi Briem)
Re: oneliner failed on Win2k with space in path name (Xu Yang)
Re: Perl 5.8.0 compilation fails in chrooted environmen vrihad@myway.com
Re: perl restaurant menu <barrettclark.NOSPAM@comcast.net>
Re: Perl Script Problems (Sam Holden)
Re: Perl Script Problems (Tad McClellan)
Re: Perl Script Problems <barrettclark.NOSPAM@comcast.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 7 Jul 2003 23:54:04 -0500
From: "Barrett Clark" <barrettclark.NOSPAM@comcast.net>
Subject: Re: ASP --> PERL SCRIPT HELP>>PLEASE>>
Message-Id: <2hOdnWHFhddU1peiXTWJjQ@comcast.com>
I think this may be more of a webserver question than a perl question.
Virtual server path sounds vaporish, and very Microsofty (given that you are
using ASP).
"kalusalu" <jessanik@rogers.com> wrote in message
news:KrpMa.38291$2ay.28126@news01.bloor.is.net.cable.rogers.com...
> Hello..I was browsing thru the newsgroups ...and was wondering if anyone
> here can be of assistance to me....as I am very very new to PERL..and have
> this ASP SCRIPT..I have to convert...
>
> <%
> 'Response.Content.Type = "text/plain"
> vpath = Request("vpath")
>
> IF vpath = "" then
> vpath = "/"
> END IF
>
> realPath = server.mappath(vpath)
>
> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.GetFolder(realPath)
>
> response.write f.Size & vbcrlf
> response.write.realPath & vbcrlf
> response.write vpath & vbcrlf
> %>
>
> it outputs the following:
> 34342323423 D:\www-roots\www.example.com.80/wwwroot/
>
> the diskusage the real path the virtual path
>
> I have written this..
>
> # $d = det_dir_name();
>
> $size = 0;
> DIR = opendir $d
>
> While (readdir DIR) {
> next if /^\.\.?$/ ;
> next if -d$_;
> $size == -s $_;
> }
>
> print $size
> print $d
>
> cannot find a function for this det dir name...any ideas..and how I
convert
> this ASP SCRIPT ????
>
>
------------------------------
Date: Tue, 08 Jul 2003 09:42:10 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Call parent method indirectly
Message-Id: <2f4lgvg8r4o2uaj52nm832g8738jlg3tvq@4ax.com>
Benjamin Goldberg wrote:
>> No biggie, if you are not messing with @ISA at runtime or put code
>> references in it:
>>
>> push @ISA, sub { rand > 0.5 ? "Hello::World" : "Destroy::HD" }
>
>I know that you can put coderefs into @ISA, but I've never heard of them
>going into @INC.
Heh. For me it's the other way around. For you too, I suppose.
--
Bart.
------------------------------
Date: 8 Jul 2003 02:04:21 -0700
From: olaadan@checkpoint.com (Oren Laadan)
Subject: CPAN modules for Apache 2.0.XX
Message-Id: <66aed627.0307080104.4cf0d5@posting.google.com>
Hi,
How can one find CPAN modules suitable for Apache 2.0.XX ?
How can I know if a certain module can/will work with it ?
For example, Apache::Cookie (and in general "libapreq-1.2")...
Thanks,
Oren.
------------------------------
Date: 7 Jul 2003 21:42:08 -0400
From: jester@panix.com (Jesse Sheidlower)
Subject: Dynamically generating multi-table SQL
Message-Id: <bed7hg$mqr$1@panix2.panix.com>
I'm trying to automatically generate multi-table SQL
statements from a Web environment, and am having a lot of
difficulty doing it in a way that doesn't feel kludgy to
me. I've looked at various sites and books, but they tend to
focus on situations where multi-table joins are fixed--you
want the same results every time, so form of the query never
changes.
Suppose you have the archetypal CD database. If all the
information is in a single table, you just have "SELECT
artist, album, song FROM cd WHERE..." If you don't want the
song, or want the label, you just drop or add it to the SELECT
list. But if the data is in related tables, with, say, "album"
as the main table, "artist" and "label" keyed to the album id,
and "song" tied in via a separate join table, it gets much
worse. If you only want the album, you have "SELECT album
FROM album WHERE...", but if you want the artist too, it
becomes "SELECT artist.artist, album.album FROM artist, album
WHERE...AND artist.album_id = album.id", and so forth; if you
want to search on "artist" and "song" only, you have to know that
they can only be connected by bringing in "album" as well, so
you end up with a four-table join.
And this is a very simple example; real ones could involve
larger sets of tables with more complex relationships that
could be searched in more different ways.
The way I've been working so far is to have an array
@tables_needed and push the table names onto it as they
are required, and then uniquing the array at the end; and
also having a table with the basic WHERE clause elements
for the join (e.g. "artist.album_id = album.id") and
similarly adding that to my constructed WHERE clause. But
while this works, it looks ugly and is hard to maintain,
and I also haven't been able to figure out (except by
hard-coding all possible examples) how to bring in
intermediate required tables, or how to handle the need
to write certain queries as LEFT JOINs rather than INNER
JOINs depending on the query.
I'd be grateful for any suggestions for approaches, or
pointers to sample code, etc.
Thanks.
Jesse Sheidlower
------------------------------
Date: Mon, 07 Jul 2003 21:34:11 -0400
From: Benjamin Goldberg <ben.goldberg@hotpop.com>
Subject: Re: From floating point to fraction
Message-Id: <3F0A1F93.C6CEB01B@hotpop.com>
jon rogers wrote:
>
> Hi
>
> I'd like to, from inside my Perl script, go from a floating point
> number, like 0.33333333333333333, to a fraction, in this case 1/3. Is
> that possible? And if so, how?
use Math::BigRat;
print Math::BigRat->new('0.33333333333333333'), "\n";
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Mon, 7 Jul 2003 21:53:54 -0600
From: "Rodney" <palladium@spinn.net>
Subject: Re: Google's newsgroups
Message-Id: <vgkg8sh7fbth9f@corp.supernews.com>
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message
news:Xns93B1B168DE363sdn.comcast@206.127.4.25...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> How does Google filter newsgroups?
>
> I ask because comp.lang.perl.misc gets between 80 and 200 posts in a
> typical day, but google's archive, supposedly "the entire archive of
Usenet
> discussion groups dating back to 1981", only shows a couple dozen posts
per
> day. What gives?
>
> - --
> Eric
> $_ = reverse sort qw p ekca lre Js reh ts
> p, $/.r, map $_.$", qw e p h tona e; print
>
> -----BEGIN xxx SIGNATURE-----
> Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
>
> iQA/AwUBPwnlfWPeouIeTNHoEQLD8QCgx7plZ5vBNG22DbqGLn3OjzsAzygAoKIq
> KBsdoQY0TvoWdCxOeA/1d+mo
> =9cmX
> -----END PGP SIGNATURE-----
Even though this question doesn't belong here, a quick google flip shows
usenet questions to be directed at
mailto:groups-support@google.com
Humm Maybe try that..
Rodney
------------------------------
Date: Tue, 08 Jul 2003 09:30:53 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: Help with Perl Script
Message-Id: <3f0a8eb6.1296893375@news.cis.dfn.de>
On Mon, 07 Jul 2003 23:30:42 GMT, "Robert" <yyyy@yyy.com> wrote:
>Any help on this would be great since its a free script there is no support.
>I have a website on a win2k server running MSFP 2002 extensions. The script
>should create a html file on the fly but it won't. The script is one of
>those post card scripts that sends an e-mail and a link to the card. All
>works fine except for the card creation. The e-mail it sends contains a link
>but when clicked you get the 404 error.
Your veeblefetzer may have developed a winkle
in its frobnitzer.
------------------------------
Date: 8 Jul 2003 06:37:33 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: How do I clone a structure?
Message-Id: <bedord$qu9$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Greg Bacon:
> In article <bechen$258$1@nets3.rz.RWTH-Aachen.DE>,
> Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote:
>
>: [...]
>:
>: This doesn't mean that the word should be erased from this FAQ (people
>: might still be able to find this entry with it). But Brian is right
>: insofar as the recursiveness is often the best way for an
>: implementation so using it as an adverb as he suggested is technically
>: more correct.
>
> Even the humble array can be viewed as being a recursive data structure,
> but the questions elicit very different answers:
>
> How do I print out or copy a recursive data structure?
>
> sub print_recursive_data_structure {
> for (@_) {
> print $_, "\n";
> }
> }
@_ is just an array, it's not a recursive data structure. I don't see
how it can be viewed as such. I think an array is the archetype of
something iterative. Not even nesting arrays into each other will change
that. Looking again at the C equivalent, would you call
int ary[5][5];
recursive?
> How do I recursively print out or copy a data structure?
>
> sub print_data_structure_recursively {
> if (@_) {
> print shift(), "\n";
> &print_data_structure_recursively;
> }
> }
>
> Used as an adverb, 'recursively' modifies the verb 'print'. Used as an
> adjective, 'recursive' modifies the noun 'data structure'. The
> questions are not equivalent.
Certainly they aren't. If they were, there'd be no point in discussing
them. ;-) And indeed, that was my point: if one insists on using the
term at all, it should line up with 'print' and not with
'data-structure' for the reasons given above. Btw, the answer to this
FAQ says:
[...] The Storable module,
found on CPAN, provides a function called "dclone" that
recursively copies its argument.
So there the recursion is clearly targeted towards the implementation.
> Greg, spricht English als Muttersprache :-)
Tassilo, learnt English at school :-)
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: 8 Jul 2003 06:46:00 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: How do I clone a structure?
Message-Id: <slrnbgkq58.tid.sholden@flexal.cs.usyd.edu.au>
On 8 Jul 2003 06:37:33 GMT,
Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
> Also sprach Greg Bacon:
>
>> Used as an adverb, 'recursively' modifies the verb 'print'. Used as an
>> adjective, 'recursive' modifies the noun 'data structure'. The
>> questions are not equivalent.
>
> Certainly they aren't. If they were, there'd be no point in discussing
> them. ;-) And indeed, that was my point: if one insists on using the
> term at all, it should line up with 'print' and not with
> 'data-structure' for the reasons given above.
I use the term recursive data-structure for a data-structure that is
defined recursively. Essentially nested arrays/hashes for which the
depth of the nesting isn't limited.
Of course that usage mightn't be common, and in fact might only be
used by me...
Obviously recursive code can be used with non-recursive structures,
but to me the FAQ is answering a question about a data structure for
which the nesting depth isn't limited. If the depth is limited you
can always use nested loops, after all, if you like *really*
ugly code anyway (for large limits).
--
Sam Holden
------------------------------
Date: Tue, 08 Jul 2003 09:51:30 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: How do I clone a structure?
Message-Id: <jo4lgv08oncp9k2tj2s3c9bp9drn4488i8@4ax.com>
John Brock wrote:
>Lets say that I have a complicated structure, for example an array
>of hash references. Is there a general way to clone the entire
>data structure, no matter how complicated it is, so that copies
>are made of all objects and no references in the new structure
>point to any objects in the original structure?
What you're asking for is called a "deep copy". See the module Storable,
the method "dclone". The objects need to be serializable for this to
work.
Randal Schwartz has written a magazine column on how you can achieve
this effect in Pure Perl. You can read it at his website:
<http://www.stonehenge.com/merlyn/UnixReview/col30.html>
--
Bart.
------------------------------
Date: 08 Jul 2003 12:02:31 +0800
From: Dan Jacobson <jidanni@jidanni.org>
Subject: Re: HTML::HeadParser to print the title
Message-Id: <87of05vf6w.fsf@jidanni.org>
How can I use find2perl to tell me how to print all the <titles> of
all the html files in the tree? find2perl . -name \*.html -eval? [then
what?] i.e. how to combine the first 4 lines of code of perldoc
HTML::HeadParser with find2perl?
------------------------------
Date: Tue, 08 Jul 2003 09:19:05 GMT
From: helgi@decode.is (Helgi Briem)
Subject: Re: microphone input
Message-Id: <3f0a8c5d.1296291921@news.cis.dfn.de>
On Mon, 07 Jul 2003 18:21:44 GMT, "Elena Miele" <0114372622@iol.it>
wrote:
>sorry if the question is dumb,
>but I cannot find a way to interact - via Perl - with the soundcard input,
>to record audio from the microphone.
>There is some module out there that can help me here???
To get you started, read this article from The
Perl Journal and System Administrators Magazine:
http://www.samag.com/documents/s=1272/sam05030002/
------------------------------
Date: 7 Jul 2003 18:58:01 -0700
From: Xu.Yang@aspect.com (Xu Yang)
Subject: Re: oneliner failed on Win2k with space in path name
Message-Id: <c395fcd9.0307071758.1e37348@posting.google.com>
All,
Thanks for the help from everyone!
I would apologize for my careless when I post my code, the left single
quote around the # was missed when I cut and paste.
the shortname does work as everyone expected. But I have to do more
work from the code who calls this oneliner in order to get the short
name. I was thinking use the Win32's GetShortName(), unfortunately,
the old version Perl I have does not have this call. So I end up with
converting the long name to short name.
Thanks again.
Xu
Mina Naguib <spam@thecouch.homeip.net> wrote in message news:<XfkOa.36870$Il3.1087359@wagner.videotron.net>...
> -----BEGIN xxx SIGNED MESSAGE-----
> Hash: SHA1
>
> Xu Yang wrote:
> > Hi,
> >
> > I have an oneliner Perl script (see below) works fine when the path
> > name is 8.3 format on Win2K, but failed after it operated on a path
> > name contains space:
> >
> > c:\perl -e "while(<>) {if(/^define/){print $ARGV.#'.$_;}}" c:\usr\*.tt
>
> A shorter version of this is:
>
> perl -ne 'print "$ARGV.#$_" if /^define/'
>
> > If I change the "c:\usr" to "c:\program files", it failed with error:
> > Can't open c:\program files\*.tt.
> > I double quote the path, did not help either.
>
> I'm not 100% sure how filename globbing works under windows' shell, but try the old 8.3
> compatability naming, it might work:
>
> c:\progra~1\*.tt
>
>
> -----BEGIN xxx SIGNATURE-----
> Version: GnuPG v1.2.1 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQE/CdB4eS99pGMif6wRAiJ4AJ9A2RRreI7fIl5HjNscETWpUsUOyQCdEdBT
> dlH3Nu72i4G3/IYh9YCJ+fc=
> =k2QF
> -----END PGP SIGNATURE-----
------------------------------
Date: 8 Jul 2003 02:43:43 -0700
From: vrihad@myway.com
Subject: Re: Perl 5.8.0 compilation fails in chrooted environment
Message-Id: <2a024f54.0307080143.71242ae1@posting.google.com>
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote in message
> If `pwd' works, try replacing Cwd.pm with
>
> package Cwd;
> sub cwd { my $p = `pwd`; chop $p; $p }
> 1;
I replaced the file lib/Cwd.pm with the one having following content:
-----------------------------------------
package Cwd;
sub cwd { my $p = `pwd`; chop $p; $p }
1;
-----------------------------------------
Now the new error while doing make is:
-----------------------------------------
processing hints file hints/linux.pl
Undefined subroutine &File::Spec::Unix::cwd called at
../../lib/File/Spec/Unix.pm line 457.
-----------------------------------------
Thanks
vrihad
------------------------------
Date: Mon, 7 Jul 2003 23:29:17 -0500
From: "Barrett Clark" <barrettclark.NOSPAM@comcast.net>
Subject: Re: perl restaurant menu
Message-Id: <Z-icnV3yq-xg2JeiXTWJjg@comcast.com>
This sounds like an easy job for a small database. You could store the
fields in a flat file, Berkeley DB, or RDBMS.
Fields could include:
* Dish name
* Dish description
* Dish price
* Special prices, times, etc.
* Menu section
I'm sure it will get a little more complicated than I am making it out to
be, but I don't see that it would be very difficult to whip up a quick and
dirty DB and access it via Perl.
"Mark Reed" <mreed@reedassociates.com> wrote in message
news:Xns93B1C8BA3E302mreedreedassociatesc@216.168.3.44...
> Does anyone have a perl script that can be used to manage an online
> restaurant menu?
>
> Im looking for examples to study and cant find any on the net at the
> popular archives.
>
> thanks
>
>
>
> --
> ---------------
> Mark M. Reed
> mreed@reedassociates.com
>
------------------------------
Date: 8 Jul 2003 01:06:36 GMT
From: sholden@flexal.cs.usyd.edu.au (Sam Holden)
Subject: Re: Perl Script Problems
Message-Id: <slrnbgk68s.sd5.sholden@flexal.cs.usyd.edu.au>
On Tue, 08 Jul 2003 00:31:04 GMT, Robert <yyyy@yyy.com> wrote:
> Fuck you then
Good luck finding somewhere else to get perl help.
[snip TOFU]
--
Sam Holden
------------------------------
Date: Mon, 7 Jul 2003 22:47:49 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl Script Problems
Message-Id: <slrnbgkfn5.3ik.tadmc@magna.augustmail.com>
Robert <yyyy@yyy.com> wrote:
> Fuck you then
You do not seem to be the intellectual type.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 7 Jul 2003 23:35:08 -0500
From: "Barrett Clark" <barrettclark.NOSPAM@comcast.net>
Subject: Re: Perl Script Problems
Message-Id: <AnmdnYqkOIbE2peiXTWJkQ@comcast.com>
What's a postcard? Is that the goofy little attachment that I never bother
to download that sometimes comes with an email?
Also, what do FP extensions have to do with Perl? MS Perl ... YIKES!!!
Twice the code with half the functionality -- must be rebooted weekly --
fails for no good reason and without any pattern -- registry keys -- no
thanks.
"Robert" <yyyy@yyy.com> wrote in message
news:fYlOa.177745$_w.7616965@twister.southeast.rr.com...
> Any help on this would be great since its a free script there is no
support.
> I have a website on a win2k server running MSFP 2002 extensions. The
script
> should create a html file on the fly but it won't. The script is one of
> those post card scripts that sends an e-mail and a link to the card. All
> works fine except for the card creation. The e-mail it sends contains a
link
> but when clicked you get the 404 error.
> Anybody PLEASE HELP
> Robert
>
>
------------------------------
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.
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 5194
***************************************