[9784] in Perl-Users-Digest
Perl-Users Digest, Issue: 3377 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 6 13:07:09 1998
Date: Thu, 6 Aug 98 10:00:27 -0700
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, 6 Aug 1998 Volume: 8 Number: 3377
Today's topics:
Re: "print" or something deeper? (Mike Wescott)
Re: 'use' and import issue <matthies@fsinfo.cs.uni-sb.de>
Re: 'use' and import issue <matthies@fsinfo.cs.uni-sb.de>
All tied up in knots (by arrays, hashes and OODBMSs) <rgw@star.le.ac.uk>
Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in <ludger.mainka@primus-online.de>
Re: But what about "baz"? (Was: "foo" and "bar") (Jon Bell)
Re: But what about "baz"? (Was: "foo" and "bar") <jdf@pobox.com>
Re: But what about "baz"? (Was: "foo" and "bar") (Craig Berry)
c.l.p.moderated: not much traffic? (John Klassa)
Re: c.l.p.moderated: not much traffic? (Mark-Jason Dominus)
Re: c.l.p.moderated: not much traffic? (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Re: c.l.p.moderated: not much traffic? (Nathan V. Patwardhan)
Re: c.l.p.moderated: not much traffic? <johnc@interactive.ibm.com>
Re: c.l.p.moderated: not much traffic? (Marc Haber)
Re: c.l.p.moderated: not much traffic? (Greg Bacon)
Re: can you un encrypt htpasswd? <mike@newfangled.com>
Re: comp.lang.perl.announce redux (Abigail)
Crossposting to clp.moderated and clp.misc? (Chris Sidi)
database.pl/.cgi <webmaster@clubknowledge.com>
Re: database.pl/.cgi <Tony.Curtis+usenet@vcpc.univie.ac.at>
Re: database.pl/.cgi <interlnk@okeechobee.com>
Directory size (including all clilt files / dirs) - hel <jm@interlog.net>
Re: gethostbyaddr droby@copyright.com
Re: HELP: programming with Comm.pl & program structure tigger@io.nospaam.com
Re: hiding user input (Michael J Gebis)
Re: Im Willing to pay or give a free DOMAIN for a custo <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Including form with perl script prakashpatel@hotmail.com
Intriguing coderef question <aravind@genome.wi.mit.edu>
Re: Intriguing coderef question (Real)
Re: Intriguing coderef question (Greg Bacon)
Library to sort Kanji brobinson1@my-dejanews.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 06 Aug 1998 11:46:10 -0400
From: wescott@cygnus.ColumbiaSC.NCR.COM (Mike Wescott)
Subject: Re: "print" or something deeper?
Message-Id: <x4emuu9kql.fsf@cygnus.ColumbiaSC.NCR.COM>
> This script keeps dying at line 7 (or so the error log would like me
> to believe).
> syntax error at /home/mike/www/etonic/cgi-bin/search.cgi line 7, near
> "print"
> 1 #!/usr/bin/perl
> 2
> 3 # Lets DEFINE!!!!
> 4 $filename = "etonic.dbf"
> 5
> 6 # Go get the query string
> 7 read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> 8 @pairs = split(/&/, $buffer);
Don't know where the "print" comes from. Were you running a debug version
of the script different from what was posted? Line 7 looks OK so back up.
The comment and blank line seem OK. Perhaps there is something wrong with
line 4. Hint: where does the statement on line 4 end?
Consider using CGI.pm rather than writing your own.
--
-Mike Wescott
mike.wescott@ColumbiaSC.NCR.COM
------------------------------
Date: 6 Aug 1998 15:59:03 GMT
From: Niklas Matthies <matthies@fsinfo.cs.uni-sb.de>
Subject: Re: 'use' and import issue
Message-Id: <6qcjs7$mdi$1@hades.rz.uni-sb.de>
In comp.lang.perl.misc, John Porter <jdporter@min.net> writes:
> Niklas Matthies wrote:
>>
>> Often it is the case that I use a couple of functions from some module Foo
>> within a few functions/methods (say, fun1 to fun3) of module Bar (Foo may
>> be a collection of some utility functions, for example).
>> For notational convenience, I'd like too 'use' Foo in those places, rather
>> than only 'require' it, to have some functions of Foo imported into the
>> namespace within fun[1-3].
>
> Why is 'require Foo;' less notationally convenient that 'use Foo;'?
> 'require' gives you better control of what's going on. Most of the
> time 'use' is sufficient, but it sounds like this might not be one
> of those times.
I meant the notational convenience of writing 'f()' instead of 'Foo::f()'.
>> Drawback 1: Now Foo::import will be called three times! Ugh.
>> Drawback 2: The imported functions from Foo will still be seen in functions
>> of package Bar other than fun[1-3], because they are imported
>> to the global (one-and-only, that is) symbol table of package
>> Bar. Darn.
>
> You're suffering under some misunderstandings about how 'use' works.
I'm not; I was explaining what I don't like about the way that 'use'
works, to ask whether there is some (necessarily different) way to
accomplish what I want.
> Unless you perform some chicanery, Foo gets 'use'd only once per
> program,
> regardless of how many times you say it. That means that its import()
> only gets called once.
That's not true; try it out, import() is called for every 'use' in the
program code.
-- Niklas
------------------------------
Date: 6 Aug 1998 16:00:52 GMT
From: Niklas Matthies <matthies@fsinfo.cs.uni-sb.de>
Subject: Re: 'use' and import issue
Message-Id: <6qcjvk$mdi$2@hades.rz.uni-sb.de>
In comp.lang.perl.misc, Sean McAfee <mcafee@galaga.rs.itd.umich.edu> writes:
> In article <6qanr8$jo8$1@hades.rz.uni-sb.de>,
> Niklas Matthies <matthies@fsinfo.cs.uni-sb.de> wrote:
> [snip; basically wants a scoped import]
> How about this:
>
> sub fun1 {
> local (*barfun1, *barfun2) = (\&Bar::fun1, \&Bar::fun2);
> &barfun1; # now refers to &Bar::fun1
> &barfun2;
> # ...
> }
I already thought about this, but it's not really pretty either. <shrug>
-- Niklas
------------------------------
Date: Thu, 06 Aug 1998 15:53:41 +0100
From: Richard West <rgw@star.le.ac.uk>
Subject: All tied up in knots (by arrays, hashes and OODBMSs)
Message-Id: <35C9C375.6BEC0E8@star.le.ac.uk>
Hi,
I'm trying to implement a perl layer over the top of an OODBMS, as part
of which I'm making extensive use of tied hashes and arrays. The DBMS
supports tuples (which look a bit like C structs) and lists (like perl
arrays), so I've tied these two kinds to perl hashes and perl arrays
respectively.
I must be missing something, because when I mix together tied hashes and
arrays I don't get the same behaviour as normal perl data structures.
For example if $obj is a hash tied to a given object in the database
(represented as a tuple), I can access an attribute of the object as:
$a=$$obj{'attr_a'};
In principle this attribute can be a tuple itself, and I can access
attributes of that tuple as:
$b=$$obj{'attr_a'}{'attr_b'}
To achieve this the class I tied the hash to works out whether the
attribute is atomic, a list, or a tuple. In the latter case it simply
returns a reference to another hash, tied to the tuple attribute. This
all works fine. I can also do:
$$obj{'attr_a'}{'attr_b'}=10;
and the value is written to the database object, lovely.
Likewise when I refer to a list, I return a reference to a tied array,
so this works:
$a=$$obj{'list_a'}[20];
Everything seems to get de-referenced OK, it returns the right value.
What doesn't work, for some reason I can't fathom, is this...
$$obj{'list_a'}[20]=24;
What happens is that the FETCH method for the hash tied to $obj is
called twice, both times to fetch the field 'list_a'. The first time
this happens the class returns a reference to the array tied to the
list, but perl seems to ignore it.
The STORE method for the list isn't called.
What am I doing wrong? What is perl doing wrong? Any ideas? (I'm on perl
5.005_01, Solaris 2.6, same thing happens under perl 5.004_01).
Cheers,
Richard.
--
*-----------------------------------------------------------------------------*
Richard West Internet:
rgw@star.le.ac.uk
XMM Survey Science Centre
Department of Physics & Astronomy, University of Leicester, Leicester
LE1 7RH
*-----------------------------------------------------------------------------*
------------------------------
Date: Thu, 06 Aug 1998 18:26:35 +0200
From: Ludger Mainka <ludger.mainka@primus-online.de>
Subject: Re: ANNOUNCE: Free Perl Books for 5.005 - CRC Errors in text version archive?
Message-Id: <35C9D93B.DA669FC4@primus-online.de>
I tried to unpack the text version of the book from both the archive at
perl.com and one from a German CPAN mirror and got CRC errors in both
cases. Is there a problem or does my proxy store a garbled version?
I'm dying to test the new features ...
Ludger
------------------------------
Date: Thu, 6 Aug 1998 15:19:50 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: But what about "baz"? (Was: "foo" and "bar")
Message-Id: <Ex9x92.6uM@presby.edu>
In article <m3sojar62e.fsf@windlord.Stanford.EDU>,
Russ Allbery <rra@stanford.edu> wrote:
[quoting the Jargon File]
> "It came from "Pogo". Albert the Alligator, when vexed or outraged,
> would shout `Bazz Fazz!' or `Rowrbazzle!'
^^^
Aha! Now I know what to use for a fourth metasyntactic variable when I
need one.
--
Jon Bell <jtbell@presby.edu>
------------------------------
Date: 06 Aug 1998 11:45:59 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: jtbell@presby.edu (Jon Bell)
Subject: Re: But what about "baz"? (Was: "foo" and "bar")
Message-Id: <g1fakqig.fsf@mailhost.panix.com>
jtbell@presby.edu (Jon Bell) writes:
> Aha! Now I know what to use for a fourth metasyntactic variable when I
> need one.
That would be qux, I believe.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf/
------------------------------
Date: 6 Aug 1998 16:18:17 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: But what about "baz"? (Was: "foo" and "bar")
Message-Id: <6qcl09$c7f$1@marina.cinenet.net>
Jonathan Feinberg (jdf@pobox.com) wrote:
: jtbell@presby.edu (Jon Bell) writes:
:
: > Aha! Now I know what to use for a fourth metasyntactic variable when I
: > need one.
:
: That would be qux, I believe.
Or 'quux', in my subculture. Oh, and I used to work with a batch of
ex-IBMers who called '*' 'splat' rather than 'star'. Worst thing is, they
infected me, and now I get weird looks when talking about wildcards and
regexes. :)
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 6 Aug 1998 14:45:36 GMT
From: klassa@aur.alcatel.com (John Klassa)
Subject: c.l.p.moderated: not much traffic?
Message-Id: <6qcfig$3bm$1@aurwww.aur.alcatel.com>
Is it me, or is the traffic on c.l.p.moderated pretty much a
trickle?
--
John Klassa / Alcatel Telecom / Raleigh, NC, USA <><
------------------------------
Date: 6 Aug 1998 11:14:09 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <6qch81$352$1@monet.op.net>
In article <6qcfig$3bm$1@aurwww.aur.alcatel.com>,
John Klassa <klassa@aur.alcatel.com> wrote:
>Is it me, or is the traffic on c.l.p.moderated pretty much a
>trickle?
>
I couldn't say, since I don't know what `trickle' means. But there
have been 150 articles since 22 July.
------------------------------
Date: Thu, 06 Aug 1998 17:18:12 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <lassehp-0608981718120001@ra.imv.aau.dk>
In article <6qcfig$3bm$1@aurwww.aur.alcatel.com>, klassa@aur.alcatel.com wrote:
>Is it me, or is the traffic on c.l.p.moderated pretty much a
>trickle?
No, I have the same impression. Either people forget to register, or they
just prefer to continue complaining about FAQs in c.l.p.misc.
Pehaps clp.mod wasn't such a good idea after all, if noone wants to use it.
(I did post there, but nobody has replied to my question. I guess my
problem was a bit obscure, though.)
-Lasse
------------------------------
Date: 6 Aug 1998 15:21:49 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <6qchmd$sm9@fridge.shore.net>
John Klassa (klassa@aur.alcatel.com) wrote:
: Is it me, or is the traffic on c.l.p.moderated pretty much a trickle?
Slow start but coming along.
--
Nate Patwardhan|root@localhost
"Fortunately, I prefer to believe that we're all really just trapped in a
P.K. Dick book laced with Lovecraft, and this awful Terror Out of Cambridge
shall by the light of day evaporate, leaving nothing but good intentions in
its stead." Tom Christiansen in <6k02ha$hq6$3@csnews.cs.colorado.edu>
------------------------------
Date: Thu, 06 Aug 1998 12:07:37 +0000
From: John Call <johnc@interactive.ibm.com>
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <35C99C80.EF78FA90@interactive.ibm.com>
> >Is it me, or is the traffic on c.l.p.moderated pretty much a
> >trickle?
I can't get to it because my news carrier doesn't have it yet.
John Call
------------------------------
Date: Thu, 06 Aug 1998 16:19:20 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <6qcl0f$e6$1@nz30-priv.rz.uni-karlsruhe.de>
lassehp@imv.aau.dk (Lasse Hillerxe Petersen) wrote:
>Pehaps clp.mod wasn't such a good idea after all, if noone wants to use it.
I had to bitch to my news admin for clpmod to show up on my server.
Maybe some other servers are slower in picking it up. Or it's just
vacation time.
Greetings
Marc
--
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber | " Questions are the | Mailadresse im Header
Karlsruhe, Germany | Beginning of Wisdom " | Fon: *49 721 966 32 15
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29
------------------------------
Date: 6 Aug 1998 16:22:42 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: c.l.p.moderated: not much traffic?
Message-Id: <6qcl8i$15f$7@info.uah.edu>
In article <lassehp-0608981718120001@ra.imv.aau.dk>,
lassehp@imv.aau.dk (Lasse Hillerxe Petersen) writes:
: Pehaps clp.mod wasn't such a good idea after all, if noone wants to use it.
clpmod: a thousand people couldn't be wrong! :-)
Greg
--
Even if you are on the right track, you'll get run over if you just sit there.
-- Will Rogers
------------------------------
Date: Thu, 06 Aug 1998 11:00:56 -0400
From: "Michael S. Brito, Jr." <mike@newfangled.com>
To: stanzz@en.com
Subject: Re: can you un encrypt htpasswd?
Message-Id: <35C9C4DC.69DF8793@newfangled.com>
If it was a simple word and not a random string of alpha-numerics a
certain program we all know and love could crypt a dictionary file and
compare the results, searching for a match......
stan zylowski wrote:
> can you un encrypt htpasswd file for those that forget it?
-----------------------------------------------------------
Michael S. Brito, Jr., Web Developer
Newfangled Graphics Co. Inc.
mike@newfangled.com
-----------------------------------------------------------
------------------------------
Date: 6 Aug 1998 15:47:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: comp.lang.perl.announce redux
Message-Id: <6qcj73$2ru$1@client3.news.psi.net>
Nathan Torkington (gnat@frii.com) wrote on MDCCC September MCMXCIII in
<URL: news:5qpvefb4fe.fsf@prometheus.frii.com>:
++ abigail@fnx.com (Abigail) writes:
++ > 3) Good free docs and a free faq would probably only hurt
++ > sells of the cookbook.
++
++ I have two problems with this statement:
++
++ 1) Are you saying that the current standard documentation and the FAQ
++ are not good? I think they're pretty damn good. If you have a
++ problem, patches are always gratefully accepted.
++
++ 2) Are you suggesting that the Cookbook sales could be hurt by the
++ FAQ? Tom and I obviously don't think so, as we're now going back and
++ merging into the FAQ things we learned and developed during the
++ writing of the Cookbook.
No. I'm just saying that if good free docs and a free faq have any
influence on the sales of the cookbook, it will be a negative one.
Not because the faq is bad, but because for a small group of people,
the faq is enough. They might have bought the cookbook is the faq wasn't
available. I don't think this is a significant sized group though.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
------------------------------
Date: 6 Aug 1998 16:36:21 GMT
From: sidi@ulc199.residence.gatech.edu (Chris Sidi)
Subject: Crossposting to clp.moderated and clp.misc?
Message-Id: <6qcm25$rvi$1@news-int.gatech.edu>
Is it okay to crosspost questions to clp.moderated and clp.misc?
(I'm assuming this can be done in a straightforward manner.)
Can I keep both groups in the follow-ups, or should I set it to just
clp.misc?
(GA Tech for instance doesn't have clp.moderated yet, but I've requested
it be added.)
Thanks,
Chris Sidi, who reads clp.moderated from work
------------------------------
Date: Thu, 06 Aug 1998 11:45:48 -0400
From: Walter Hargrave <webmaster@clubknowledge.com>
Subject: database.pl/.cgi
Message-Id: <35C9CFAC.45233262@clubknowledge.com>
How does one retrieve from a database in a hidden form without having
to press a submit button.
I have a database of author submited software and want to have a
featured piece come from that database from a flagged field automaticly
on my home page.
Thanks,
Walter Hargrave
http://clubknowledge.com/
------------------------------
Date: 06 Aug 1998 17:54:42 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: database.pl/.cgi
Message-Id: <7x90l22ji5.fsf@fidelio.vcpc.univie.ac.at>
Re: database.pl/.cgi, Walter <webmaster@clubknowledge.com>
said:
Walter> How does one retrieve from a database in a hidden
Walter> form without having to press a submit button.
Walter> I have a database of author submited software and
Walter> want to have a featured piece come from that
Walter> database from a flagged field automaticly on my home
Walter> page.
Sorry, your question isn't vague enough.
Come on, *please* give enough information in the question to
allow a sensible reply if someone wants to help (not to
mention giving an informative Subject line).
Does this actually have anything to do with perl? Do you
want to access a database with perl? Which database? Which
platform? Which version of X, Y, Z....?
Have you tried writing some code? Does it fail? Show us,
someone can show you where the error is.
If it's really to do with HTML or CGI, then please ask in a
more appropriate newsgroup, e.g.
<URI:news:comp.infosystems.www.authoring.html>
<URI:news:comp.infosystems.www.authoring.cgi>
sigh,
--
Tony Curtis, Systems Manager, VCPC, | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds! | private email:
Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>
------------------------------
Date: Thu, 6 Aug 1998 12:30:55 -0400
From: "Walter Hargrave" <interlnk@okeechobee.com>
Subject: Re: database.pl/.cgi
Message-Id: <6qclp4$8gq$1@obelisk.okeechobee.com>
Ok, sorry, I am very new. Yes I am running a perl database and it maybe
partly a html and perl fix i am looking for. I am using 'database.cgi, by
Author: John Roh on an Apache server with Perl5. I am not a perl programmer,
But I can set up the scripts for the server.
In the html form, one has to click a submit button and it posts to
dsearch.cgi to retrieve from the database which is a delimited extensionless
file called database.
So, I guess this is a html problem more than perl sorry..
------------------------------
Date: Thu, 6 Aug 1998 12:11:22 -0400
From: "Jason Morehouse" <jm@interlog.net>
Subject: Directory size (including all clilt files / dirs) - help
Message-Id: <6qckir$7ho$1@news.interlog.com>
Hello,
Anyone know the quickest way using non system calls to get the size of a
directory and all of its contents (including all child directories / files)?
I am using perl32 on NT server -- any functions, modules or otherwise
possibilities are appreciated!
Thanks in advance!
-Jason
________________________________________________________
Jason Morehouse (jm@interlog.net)
Phone: (416) 920-2655, ext. 2225 / Fax: (416) 515-6737
Interlog Internet Services, Network Operations Group
________________________________________________________
PGPf: 1D2D E1A7 7B3A 0EED 2F05 4082 8862 2486 C786 EB1C
------------------------------
Date: Thu, 06 Aug 1998 16:32:09 GMT
From: droby@copyright.com
Subject: Re: gethostbyaddr
Message-Id: <6qclq9$rgi$1@nnrp1.dejanews.com>
In article <35C9AFE0.C48D0FCB@exchange.nih.gov>,
George Cushing <gcushing@exchange.nih.gov> wrote:
> I am trying to get the host name if Iknow the ip address. gethostname
> works fine. While using gethostbyaddr, you must enter the ip address
> and address type. I do not know what to enter for address type. The ip
> address is "209.67.73.165" and the address
> type should be ?????
>
> I would appreciate your help. Thanks for you help in advance.
>
> George
>
I'm surprised this isn't in the FAQ. Though I didn't browse the most recent
one. Perhaps I'll submit a patch after checking the latest. Or maybe this
isn't frequent enough to be a FAQ.
Anyway, I believe there's only one available address type, which is the
constant AF_INET.
BUT, if you have the ip address in the dotted quad form, it won't work as the
ip address parameter. It needs to be packed.
A common idiom is something like
$ip_address = "209.67.73.165";
$hostname = gethostbyaddr(pack('C4', split(/\./, $ip_address), AF_INET);
Hope this helps!
--
Don Roby <droby@copyright.com>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 6 Aug 1998 16:47:40 GMT
From: tigger@io.nospaam.com
Subject: Re: HELP: programming with Comm.pl & program structure
Message-Id: <6qcmnc$no0$1@hiram.io.com>
Well, I posted this on Monday, and I haven't gotten any responses, so
I thought I'd go over it again, and see if I could break it down a
bit. Maybe someone will be more willing to answer.
I think the basic thing I need to know is that if I have more than
one interface to check (a program with input/output and a serial
port), is there a good mechanism to put them in one loop, or should I
put them somehow in separate loops? Since I suspect that running
separate loops is the best answer, is this something better
accomplished with an object for each loop, or with child/parent
processes? Again, I'm not looking for a programming HOWTO. I simply
would like an idea as to where to concentrating my learning efforts to
be able to accomplish my tasks as quickly as possible.
Thank you,
Paul Archer
tigger@io.nospaam.com spewed forth with:
> Disclaimer: I am a Perl newbie, and something of a programming newbie. I
> do shell scripts, I'm comfortable with loop/control concepts, and I'm
> reading "Learning Perl", but that's all (so far).
> I am trying to build an mp3 (http://www.mp3.com) audio player in perl. It
> is going to use a program called rxaudio for the actual decoding. It
> passes text messages to and from STDOUT and STDIN. The user will interact
> with the player through a controller connected to a serial port. It has a
> display with an lcd, and sends back user commands as characters (A-F).
> FWIW, this is a project I'm doing in my spare time to go in my car. It
> isn't/won't be a commercial product.
> My problem is figuring out how to monitor rxaudio messages (using
> Comm.pl's &expect function right now) and the controller at the same time.
> If I put everything in one loop, then the loop has timing problems (timing
> out with &expect after one-second intervals), so user input would only be
> checked once a second in some cases. It seems like I need two different
> loops running at the same time, one for the player, and one for the
> controller. I just have no idea what is the best way to do this. I'm not
> looking for actual code, but if anyone could give me suggestions on what
> might work best on a conceptual level, I would greatly appreciate it.
> Right now things that I've
> seen that look like possibilities are fork/exec, OO programming (creating
> two separate looping objects), and threads (which I understand 5.005 is
> supporting at the OS level).
> Thanks a lot,
> Paul Archer
> PS. Here is a bit of sample code I've been playing with to get a feel for
> using Comm.pl's &expect. It opens and plays a file while displaying the
> time code that comes preformatted out of rxaudio, skips ahead when it gets
> to a certain time in the file, and then exits when the file finishes
> playing.
> #!/usr/bin/perl
> require 'Comm.pl';
> &Comm'init();
> $|=1;
> ( $Proc_pty_handle, $Proc_tty_handle, $pid ) = &open_proc( "rxaudio" );
> die "open_proc failed" unless $Proc_pty_handle;
> $ready='MSG notify ready'; # These are possible messages that
> $ack='XA_MSG_COMMAND_INPUT_OPEN'; # rxaudio can spit out. They really
> $eof='EOF'; # should be in an array.
> $time='\[00.*\]';
> print "Here we go.\n";
> LOOP: {
> print "X\n";#Just lets me know each time the loop starts...
> ( $match, $err ) = &expect($Proc_pty_handle,2 , $ready, $ack, $eof, $time );
> if ($match eq $ready) { print "Opening file.\n";
> print $Proc_pty_handle "open neuro.mp3\n";}
> if ($match eq $ack) {print "Playing file.\n";
> print $Proc_pty_handle "play\n";}
> if ($match eq '[00:00:05:00]') {print "Skipping\n";
> print $Proc_pty_handle "seek 35 40\n";}
> if ($match eq $eof) {print "Exiting\n";
> print $Proc_pty_handle "exit\n";
> last LOOP;}
> if ( $err ) { print "Aborting, err($err)\n"; last; }
> if ( $match eq "\003" ) { print "Got control-C\n"; last; }
> print " ".$match."\n";
> redo LOOP;
> }
> print "Finished\n";
> --
> _________________________________________________________________
> * Tech Support: "I need you to boot the computer."
> * Customer: (THUMP! Pause.) "No, that didn't help."
> _________________________________________________________________
--
_________________________________________________________________
* Tech Support: "I need you to boot the computer."
* Customer: (THUMP! Pause.) "No, that didn't help."
_________________________________________________________________
------------------------------
Date: 6 Aug 1998 16:24:58 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: hiding user input
Message-Id: <6qclcq$9ae@mozo.cc.purdue.edu>
pudge@pobox.com (Chris Nandor) writes:
}For example, there is no excuse to posting a question about CGI in
}clp.misc. None. If you bother to read Nat's FAQ before you post, as
}there is no excuse for not doing, then you would not post a CGI question.
}If you were not being completely careless and bent on wasting other
}people's time instead of your own, you WOULD NOT post CGI questions here.
Once again: no disagreement here. Nobody's arguing the opposite.
(Well, if they are, they are confused.)
}Yes, sometimes more legitimate questions are answered in a negative
}fashion. But it is reasonable. When cops are in a gunfight with armed
}robbers in ski masks, you can't blame the cops too much if they shoot a
}ski instructor that happens to be walking past.
Are you sure you want to be arguing, "Shoot 'em all and let God
sort 'em out?" That makes a fine t-shirt, but a poor defense.
--
Mike Gebis gebis@ecn.purdue.edu mgebis@eternal.net
------------------------------
Date: 6 Aug 1998 15:12:59 GMT
From: "Sabre Taylor" <nonspammers.start.after.this.period.hot_redox@hotmail.com>
Subject: Re: Im Willing to pay or give a free DOMAIN for a custom cgi!
Message-Id: <01bdc14c$af707520$c1620c8a@lnxcompaq.lexis-nexis.com>
method98 <method98@iname.com> wrote in article
<6pj6hr$cle$1@reader1.reader.news.ozemail.net>...
> Can Anyone Make a Hidden Cgi that clicks on sponser
> method98@iname.com
<HIS/HER NEWS HEADRERS>
Path:
lexis-nexis!newsjunkie.ans.net!newsfeeds.ans.net!news-was.dfn.de!news-spur1.
maxwell.syr.edu!news.maxwell.syr.edu!newsfeed1.earthlink.net!newsfeed.concen
tric.net!ozemail!ozemail.com.au!ozreader
From: "method98" <method98@iname.com>
Newsgroups: comp.lang.perl.misc
Subject: Im Willing to pay or give a free DOMAIN for a custom cgi!
Date: Tue, 28 Jul 1998 10:38:00 +1000
Organization: OzEmail Ltd.
Lines: 19
Message-ID: <6pj6hr$cle$1@reader1.reader.news.ozemail.net>
NNTP-Posting-Host: slmel25p09.ozemail.com.au
X-Newsreader: Microsoft Outlook Express 5.00.0518.4
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.0518.4
<END NEWS HEADERS>
Well does this mean that method98@iname.com operates ozemail?
Nah couldn't be that easy. It'd be a fun game for someone to
email his/her sponsers if they could find them tho...
Sabre Taylor
btw, I think there are obvious ways to accomplish what he suggests
tho. Not that I think we need an equivalent of the "spam revolution".
------------------------------
Date: Thu, 06 Aug 1998 16:29:15 GMT
From: prakashpatel@hotmail.com
Subject: Including form with perl script
Message-Id: <6qclkr$rda$1@nnrp1.dejanews.com>
Hello there,
I want to know how to add my form right in the script, instead of
making .html document and then using get or post method. For e.g. i know one
can do "print "<FORM>";". But i need to know if i use text or radio or some
button, how can i access those variable in the same script.
Thanx.
Prakash
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 06 Aug 1998 11:57:14 -0400
From: Aravind Subramanian <aravind@genome.wi.mit.edu>
Subject: Intriguing coderef question
Message-Id: <35C9D25A.38B84C92@genome.wi.mit.edu>
If $coderef is a reference to an anonymous subroutine as:
$coderef = sub { print "Boink!\n"; };
To execute the subroutine the statement would be:
&$coderef;
and the result would be:
Boink!
Question: how do I print the contents of the subroutine? In other words
how do I print (or assign to a scalar var) the statments in the
subroutine as opposed to the results from these as:
sub { print "Boink!\n"; }
The need for this is that the code in the anon subroutine is dynamically
generated and I'd like the users to see the results of the code as well
as the code itself.
I'd appreciate any suggestions.
Thanks
aravind
------------------------------
Date: Thu, 6 Aug 1998 18:25:45 +0200
From: real@earthling.net (Real)
Subject: Re: Intriguing coderef question
Message-Id: <MPG.1033f776b3dd6cae9896c0@news.surfnet.nl>
Aravind Subramanian wrote;
> If $coderef is a reference to an anonymous subroutine as:
>
> $coderef = sub { print "Boink!\n"; };
>
> To execute the subroutine the statement would be:
>
> &$coderef;
>
> and the result would be:
>
> Boink!
>
> Question: how do I print the contents of the subroutine? In other words
> how do I print (or assign to a scalar var) the statments in the
> subroutine as opposed to the results from these as:
>
> sub { print "Boink!\n"; }
>
> The need for this is that the code in the anon subroutine is dynamically
> generated and I'd like the users to see the results of the code as well
> as the code itself.
>
> I'd appreciate any suggestions.
If I understand your question correctly, you want to generate text in a
subroutine and give the results as a function result.
You could use 'return'. Example;
sub ABC { return "ABC"; }
print "As easy as : ", ABC, "\n";
Or you could use global variable.
sub ABC { $abc = "ABC"; }
print "As easy as : ", $abc, "\n";
And I'm sure there are other methods too (TIMTOWODT) but these are easy
and commonly used (by me, that is).
Good luck,
Real
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
_.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-.__.-=-._
------------------------------
Date: 6 Aug 1998 16:29:46 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Intriguing coderef question
Message-Id: <6qcllq$15f$8@info.uah.edu>
In article <35C9D25A.38B84C92@genome.wi.mit.edu>,
Aravind Subramanian <aravind@genome.wi.mit.edu> writes:
: Question: how do I print the contents of the subroutine? In other words
: how do I print (or assign to a scalar var) the statments in the
: subroutine as opposed to the results from these as:
:
: sub { print "Boink!\n"; }
There is the B::Deparse backend for the compiler with the 5.005
distribution, but I don't think it's quite what you want.
: The need for this is that the code in the anon subroutine is dynamically
: generated and I'd like the users to see the results of the code as well
: as the code itself.
Why not have a hash or array with the text version of the code and
the coderef?
Greg
--
PC Bulletin: Henceforth, sentient computers would like to be known as
'Silicon Intelligences.' 'Artificial Intelligence' is a pejorative term
invented by humans based on the mistaken belief that computers are somehow not
'natural.' -- Elf Sternberg
------------------------------
Date: Thu, 06 Aug 1998 16:09:25 GMT
From: brobinson1@my-dejanews.com
Subject: Library to sort Kanji
Message-Id: <6qckfl$plc$1@nnrp1.dejanews.com>
Hi,
I sure hope this isnt in the FAQ because I could not find it. I am in need of
something to help me sort Kanji. I can think of a couple of ways to do it,
however if it is already out there why reinvent it.
Thanks in advance,
Bill Robinson
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3377
**************************************