[18742] in Perl-Users-Digest
Perl-Users Digest, Issue: 910 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 15 21:06:07 2001
Date: Tue, 15 May 2001 18:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <989975114-v10-i910@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 15 May 2001 Volume: 10 Number: 910
Today's topics:
Re: AND-connected search (Craig Berry)
Bits and bytes (James Weisberg)
Re: Decoding Net::SNMP get_request return <carlos@plant.student.utwente.nl>
Re: Http REFFERER -> IP ADDR <i.m.knight@btinternet.com>
Re: Locking acces to files (Craig Berry)
Re: Need SNPP Perl CLI interface for NT <carvdawg@patriot.net>
Re: Net::FTP and timeout ! HELP (Charles DeRykus)
Newbie needing help... <james@houston73.freeserve.co.uk>
Re: Newbie needing help... (Clinton A. Pierce)
Re: parent code halts browser display until child proce (David Efflandt)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <godzilla@stomp.stomp.tokyo>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (John Stanley)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <ayeretsk@arm.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <ayeretsk@arm.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Mark Jason Dominus)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Mark Jason Dominus)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (E.Chang)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi <godzilla@stomp.stomp.tokyo>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Andrew J. Perrin)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Andrew J. Perrin)
Re: Sending wav-file through perl-script <godzilla@stomp.stomp.tokyo>
Re: Socket: sysread <uri@sysarch.com>
Re: Socket: sysread <bart.lateur@skynet.be>
Re: Socket: sysread nobull@mail.com
SSI - Changing the Hour in Date_Local <olm@sprynet.com>
Re: SSI - Changing the Hour in Date_Local (Abigail)
Re: Stumped on $?, duplicate output (Mark Jason Dominus)
To compress and uncompress text files ? <nosabi@snospamabi.com>
Re: To compress and uncompress text files ? <kstep@pepsdesign.com>
Re: Urgent: CGI program wanted <michael@stroeck.com>
Re: What is wrong with my Regular Expression? <godzilla@stomp.stomp.tokyo>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 16 May 2001 00:39:42 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: AND-connected search
Message-Id: <tg3j2efmmc573a@corp.supernews.com>
nobull@mail.com wrote:
: > \E is not required if the \Q region extends to the end of the
: > pattern.
:
: s/pattern/quoted construct/
My bad. Somehow failed to notice the context.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "God becomes as we are that we may be as he is."
| - William Blake
------------------------------
Date: Tue, 15 May 2001 23:11:53 GMT
From: chadbour@wwa.com (James Weisberg)
Subject: Bits and bytes
Message-Id: <ZIiM6.5246$DW1.235134@iad-read.news.verio.net>
Below is a simple program which creates a 32bit vector for long integer
storage:
#! /usr/local/bin/perl -w
my $vector= 0; vec($vector, 0, 32) = $ARGV[0];
my $value = decode($vector);
print "integer value is: $value\n";
sub decode {
my @s = reverse split //, unpack("B32", shift); # portable? fast?
$" = ""; print "[$#s] bitstr: (@s)\n";
my($i, $j, $v, $p);
for( $i = $j = $v = 0, $p = 1; $j < $#s; $j++, $p <<= 1 ) {
$v|= $p if($s[$i++]); # fiddle 2^p
}
return $v;
}
I have a bunch of records that I want to pack into bits and then pull them
back out as values. I have several questions about the inner-workings of
what I've written above.
First, turning a vector into a bitstring for which I know how to calculate
its values is extremely ugly. I'm not even sure if what I've written there
is portable. Can someone comment on why:
my @s = reverse split //, unpack("B32", shift);
creates an ordered string of increasing powers of 2:
# -> ./bitstoval.pl 65535
[31] bitstr: (11111111111111110000000000000000)
integer value is: 65535
Are there any high/low byte and word order assumptions inherent in
those instructions?
Also, a vector will be dozens of bytes wide, and will contain instructions
on how subsequent values are coded. For instance, somewhere in the vector
I might have an instruction to read the next 8 bits and turn them into
an integer value. Another instruction might require reading the next
16 bits for a value. However many bits are needed, I want to make sure
the values are all encoded the same way, hence the use of increasing
powers of 2. In C, the entire vector would be converted into a bitstring
and the pointer which walks along it would first get an instruction and
then procede N slots while calculating a value. There would be no step
to split the string into an array as I am doing above. Presumably, I could
use substr() to achieve the same result without the array, but that seems
like it would be a slow endeavor as well.
Any pointers? ;-\
--
World's Greatest Living Poster
------------------------------
Date: Wed, 16 May 2001 01:57:04 +0200
From: "carlos" <carlos@plant.student.utwente.nl>
Subject: Re: Decoding Net::SNMP get_request return
Message-Id: <9dsfh2$65p$1@dinkel.civ.utwente.nl>
you need to dereference it: %result = %{$session};
carlos
"joeybach" <jr@stink.cfl.rr.com> wrote in message
news:20010512.125722.1529195746.7254@stink.cfl.rr.com...
> Does some know how I can decode the output of a NET::SNMP get_request
> $session->get_request("1.3.6.1.2.1.1.5.0");
> $result = $session
>
> It returns $result as "Net::SNMP=HASH(0x1a7f118)
>
> the oid returns the hostname of the switch in this case (NYC1-S01-1) with
> a command line snmpget. How can I decode The HASH?
> I tried $result=$session->TRANSLATE_OPAQUE and the others from the docs
> from cpan. Can anyone offer any suggestions ?
------------------------------
Date: Wed, 16 May 2001 01:09:12 +0100
From: "Ian Knight" <i.m.knight@btinternet.com>
Subject: Re: Http REFFERER -> IP ADDR
Message-Id: <9dsgin$euc$1@uranium.btinternet.com>
Cheers for the help people sorted now!
$test=$ENV{'HTTP_REFERER'};
$test=~ m|(\w+)://([^/:]+)(:\d+)?/(.*)|;
$test2=$2;
$our_ip = gethostbyname($test2);
($a,$b,$c,$d) = unpack('C4',$our_ip);
$ip="$a.$b.$c.$d";
------------------------------
Date: Wed, 16 May 2001 00:54:29 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Locking acces to files
Message-Id: <tg3ju54uiu6454@corp.supernews.com>
Karol Nowakowski (karol@imm.org.pl) wrote:
: my system is Unix (i.e. my provider has it)
: what command should I use (I've already sent this question to my provider
: also, but If you have some other opinions)?
I think the language barrier may be in our way again. What do you mean by
"which command should I use"? You use the 'perl' executable (often found
in /usr/bin/perl) to run your scripts. In these scripts, you use the
flock function ('perldoc -f flock' for documentation) to lock files.
: My next question is also general.
: There is program "one" which is actually doing some changes in the file and
: locks it with LOCK_EX. And there is a program "two" which also want's to do
: some changes in the same file. Will the program "two" wait for possibility
: to write, or will it write the message, that he was unable to write because
: of other lock. I don't think it is clearly written, but I hope You'll
: understand.
By default, a process will wait for a lock forever. You can change this
by setting the LOCK_NB bit in the mode argument to flock. See the
documentation mentioned above for details.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "God becomes as we are that we may be as he is."
| - William Blake
------------------------------
Date: Tue, 15 May 2001 19:10:50 -0400
From: H C <carvdawg@patriot.net>
Subject: Re: Need SNPP Perl CLI interface for NT
Message-Id: <3B01B77A.7F06BB12@patriot.net>
You might want to check out this:
http://www.simplewire.com/downloads/index.html
Scroll down to the section on Perl...
".CTS." wrote:
> I need to call SNPP (Simple Network Pager Protocol) from the NT command
> line. I've got a sample Perl script and libraries for UNIX, which I should
> be able to adapt to NT if had the right socket.pm for NT. Any help using
> this approach or other recommendations would be appreciated.
>
> Chuck
------------------------------
Date: Tue, 15 May 2001 21:58:33 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: Net::FTP and timeout ! HELP
Message-Id: <GDED1L.2qA@news.boeing.com>
In article <3aff8c59@feednews.internext.fr>,
David Bordas <bordas@jeuxvideo.com> wrote:
>
>Hi all,
>
>But a few days ago we have moved from sun servers to linux redhat 6.2
>servers.
>...
>Here is my code :
>$ftp = Net::FTP->new("$host",Timeout => '20') || die "can't connect" ;
>...
>And the problem is that i can't specify a timeout.
><< Timeout => '20' >>
>would be 20 sec but in fact the timeout is allways of 750 secs :(
You may need to upgrade to the IO-1.20 (socket timeouts
were broken before this, I believe).
http://search.cpan.org/search?dist=IO
hth,
--
Charles DeRykus
------------------------------
Date: Tue, 15 May 2001 23:08:51 +0100
From: "J Houston" <james@houston73.freeserve.co.uk>
Subject: Newbie needing help...
Message-Id: <9ds9fu$fa6$1@newsg3.svr.pol.co.uk>
I have downloaded and installed ActivePerl
and setup Personal Web Server.
When I try to run a .pl file through this, I get a
window briefly popping up which displays the
following message;
"Cant locate subparseform.lib in @INC (@INC contains
H:/perl/lib H:/perl/site/lib .) at C:\Inetpub\wwwroot\cgi-bin\testing2.pl
line 2."
Perl is installed on my (partitioned) H: drive and testing2.pl is the
file I'm trying to run. This file runs fine on my Colleges unix
server, but I'm lost with this stuff. Please email me if you
can help. Thanks in advance.
JH
------------------------------
Date: Tue, 15 May 2001 22:56:48 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: Newbie needing help...
Message-Id: <QuiM6.32586$V5.6663636@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <9ds9fu$fa6$1@newsg3.svr.pol.co.uk>,
"J Houston" <james@houston73.freeserve.co.uk> writes:
> "Cant locate subparseform.lib in @INC (@INC contains
> H:/perl/lib H:/perl/site/lib .) at C:\Inetpub\wwwroot\cgi-bin\testing2.pl
> line 2."
>
> Perl is installed on my (partitioned) H: drive and testing2.pl is the
> file I'm trying to run. This file runs fine on my Colleges unix
> server, but I'm lost with this stuff. Please email me if you
> can help. Thanks in advance.
Apparently your college's unix server has this file installed and your
perl script is require'ing or use'ing it (probably at line 2). This isn't
a core module, and it's misnamed for a module. Find the file, install
it and try again.
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary -- May 2001
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Wed, 16 May 2001 00:59:28 +0000 (UTC)
From: see-sig@from.invalid (David Efflandt)
Subject: Re: parent code halts browser display until child process finishes
Message-Id: <slrn9g3k7g.49g.see-sig@typhoon.xnet.com>
On Tue, 15 May 2001, Mark Phillips <mark.l.phillips@bt.com> wrote:
>
> I have written some PERL/CGI, running on IIS 4.0, using an IE browser.
> The parent perl code calls a process (using
> Win32::Process::Create(...DETACHED_PROCESS...)) which lasts for approx. 5
> minutes. I want the parent code to display some sort of waiting text.
> The parent code will not display any HTML text until after the child process
> has finished. Is there a simple solution?
>
> I have had a look around the net and the answers seem confusing :
> Some say close the STDOUT handle in the child - how??? I have tried
> close(STDOUT).
> Others suggest using fork().
'perldoc perlipc' explains how to daemonize a process. It works for CGI
on Linux and Unix servers, but my only access to NT and IIS4 is via
FrontPage or FTP, and I don't even know how to tell if they have Perl or
are set up for CGI scripts (donated company server). But it might at
least give you an idea.
--
David Efflandt (Reply-To is valid) http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Tue, 15 May 2001 15:16:55 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3B01AAD7.8B60FF3E@stomp.stomp.tokyo>
David Coppit wrote:
> On Tue, 15 May 2001, Godzilla! wrote:
> > > BTW, all the posts I've seen (besides those of Godzilla!) are in favor
> > > of the document, or suggest slight rewording.
> > This is untrue. I am reading increasing amounts of strong
> > objection to this document.
> Hm... I guess I missed that. Besides you, I didn't see anyone who
> disagreed with the basic idea that some group of cplm regulars
> could/should suggest/dictate how others should post to the group.
I have tiny blue monkeys flying out of my big butt.
> Admittedly, I probably don't read the newsgroup as closely as you do.
Nor do you equal my talent with language, in both reading and writing.
> > Possibly you face challenges in reading comprehension or, are being
> > masquer deceitful?
> Have I done something to deserve this comment? I try to treat other
> people with respect, and would appreciate the same unless I
> demonstrate myself unworthy of it.
Ahhh... po' boy. You are breaking my wittle heart.
"Reality is a harsh mistress, few are willing to bed."
- Kira
Reality is my constant bed companion. She has taught
me the nature of reality and how to speak realistically.
She is also absolutely stunning in bed!
Give her a toss sometime, if you have the needed bravado.
Think of me as the egg which sticks to your teflon pan.
Godzilla!
------------------------------
Date: 15 May 2001 22:21:54 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <9dsa62$f1r$1@news.orst.edu>
In article <Pine.SUN.4.33.0105151727180.18238-100000@mamba.cs.Virginia.EDU>,
David Coppit <newspost@coppit.org> wrote:
>Hm... I guess I missed that. Besides you, I didn't see anyone who
>disagreed with the basic idea that some group of cplm regulars
>could/should suggest/dictate how others should post to the group.
When you get to the word "dictate", everyone should disagree. Suggest,
yes, dictate, no.
But this is not the issue. The issue is the use of the word "must" in an
otherwise very good document.
------------------------------
Date: Tue, 15 May 2001 17:28:41 -0500
From: Andrew Yeretsky <ayeretsk@arm.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3B01AD99.ABA73570@arm.com>
This document you are arguing about is ridiculous. As someone who posted to
this newsgroup for the first and probably the last time today, I have to say I
agree with Godzilla. If some newbie comes and posts a question that could be
answered in the perl FAQ, then politely tell them in a quick message. Don't
tell me you guys don't have the time. Some of you post to this newsgroup every
ten minutes. The document is extremely rude and has a very pretentious tone to
it. You "experts" are very kind to answer the questions you do, but you don't
have to negate that kindness with an insulting document. Just be a nice person
and either politely let a newcomer know he is doing something he wrong or don't
reply to the message at all.
-andrew
"Randal L. Schwartz" wrote:
> >>>>> "David" == David Coppit <newspost@coppit.org> writes:
>
> David> BTW, all the posts I've seen (besides those of Godzilla!) are in favor
> David> of the document, or suggest slight rewording. Assuming that the people
> David> who haven't commented hold no strong opinion, doesn't that make a
> David> consensus (as in "judgment arrived at by most of those concerned")?
>
> Maybe everyone disagreeing with Tad have already killfiled him.
>
> :-)
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 15 May 2001 18:03:30 -0500
From: Andrew Yeretsky <ayeretsk@arm.com>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3B01B5C2.416DC679@arm.com>
If you are set on making this document "law", then it would be lot better if you
used the word please. There's a reason why it's called the magic word. I don't
know about you, but I'm 100 times more likely to do something if I hear the word
"please" than if I hear the words, "do this or else." Even my boss, who has a good
deal of control over me, says please and thank you. It's common courtesy. As a
completely objective person, I am just saying that if you use forceful words you
are keeping a lot of people like myself from coming to the newsgroup. If that is
your intention, so be it. But if you want this document to make the newgroup a
happier place, where people feel comfortable asking their questions, give us
guidelines in a nice way. I am just giving you my input, but I would be much more
inclined to follow the guidelines if it said please instead of must.
Andrew Yeretsky wrote:
> This document you are arguing about is ridiculous. As someone who posted to
> this newsgroup for the first and probably the last time today, I have to say I
> agree with Godzilla. If some newbie comes and posts a question that could be
> answered in the perl FAQ, then politely tell them in a quick message. Don't
> tell me you guys don't have the time. Some of you post to this newsgroup every
> ten minutes. The document is extremely rude and has a very pretentious tone to
> it. You "experts" are very kind to answer the questions you do, but you don't
> have to negate that kindness with an insulting document. Just be a nice person
> and either politely let a newcomer know he is doing something he wrong or don't
> reply to the message at all.
>
> -andrew
>
> "Randal L. Schwartz" wrote:
>
> > >>>>> "David" == David Coppit <newspost@coppit.org> writes:
> >
> > David> BTW, all the posts I've seen (besides those of Godzilla!) are in favor
> > David> of the document, or suggest slight rewording. Assuming that the people
> > David> who haven't commented hold no strong opinion, doesn't that make a
> > David> consensus (as in "judgment arrived at by most of those concerned")?
> >
> > Maybe everyone disagreeing with Tad have already killfiled him.
> >
> > :-)
> >
> > --
> > Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> > <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> > Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> > See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Tue, 15 May 2001 23:51:13 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3b01c0f0.8f3$c4@news.op.net>
In article <9dppmc$j5l$1@news.orst.edu>,
John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>Amost all of this is very good advice. I've only got a problem with the
>imperatives that are being used.
I agree. 'Must' is inappropriate, and only serves to make the authors
look foolish.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Tue, 15 May 2001 23:54:09 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3b01c1a1.906$4f@news.op.net>
In article <slrn9g24b6.jmt.tadmc@tadmc26.august.net>,
Tad McClellan <tadmc@augustmail.com> wrote:
>The whole point of the guidelines is to _state_ what is expected,
>rather than having them discover it for themselves.
Just so. But 'must' communicates a requirement, not an expectation.
If the document said "Almost everyone here will expect you to..."
then I would have no argument with it.
As it is, the title 'guidelines' is inaccurate. Have you considered
changing it to say 'commandments'?
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Wed, 16 May 2001 00:09:16 GMT
From: echang@netstorm.net (E.Chang)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <Xns90A2CD177CEFCechangnetstormnet@207.106.92.86>
mjd@plover.com (Mark Jason Dominus) wrote in
<3b01c0f0.8f3$c4@news.op.net>:
>In article <9dppmc$j5l$1@news.orst.edu>,
>John Stanley <stanley@skyking.OCE.ORST.EDU> wrote:
>> Amost all of this is very good advice. I've only got a problem
>> with the imperatives that are being used.
>
>I agree. 'Must' is inappropriate, and only serves to make the
>authors look foolish.
I like the the guidelines in general, but also find "must" too strong.
A heading such as "Things to do *before* you post a question to
comp.lang.perl.misc" would get the point across without the "Achtung!"
tone.
--
EBC
------------------------------
Date: Tue, 15 May 2001 17:24:55 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <3B01C8D7.DAD208FA@stomp.stomp.tokyo>
Andrew Yeretsky wrote:
(snipped and a mild topic change)
> ...If some newbie comes and posts a question that could be
> answered in the perl FAQ, then politely tell them in a quick message.
> Don't tell me you guys don't have the time.
I tried an experiment last night. A poster inquired about
resetting variables. An answer was provided to look at
perl documentation on reset, a good answer. I wanted to
add my own thoughts, as well.
So, this time, before posting a response, I opened a DOS
window, switched to my Perl directory, inquired about
reset, copied the documentation and added it to my post.
In total, this took about a minute and one-half to
two minutes of time, to simply include documentation,
total time, start to finish.
My personal decision is if I feel a reference to Perl
documentation is in order and this documentation is
not really long, I am going to take a little extra time
and actually post the documentation rather than post
a simple referral.
Doing this performs two beneficial functions for all.
An author is provided an instant answer, a good answer
direct from Perl documentation. This also provides others
a chance to read this documentation. In a sense, this is
like random postings of Perl documentation for all to read!
I will urge you, the reader, to give this some thought.
This is not something which can cause any harm and it
only takes a minute or so.
Godzilla!
------------------------------
Date: 15 May 2001 20:06:52 -0500
From: andrew_perrin@unc.edu (Andrew J. Perrin)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <87wv7i5cgj.fsf@nujoma.perrins>
David Coppit <newspost@coppit.org> writes:
> On Tue, 15 May 2001, Godzilla! wrote:
> > Possibly you face challenges in reading comprehension or, are being
> > masquer deceitful?
>
> Have I done something to deserve this comment? I try to treat other
> people with respect, and would appreciate the same unless I
> demonstrate myself unworthy of it.
It's definitely a mistake to be hurt or insulted by something
Godzilla! spews - just say a little prayer of thanks that you don't
know her/him/it in any context other than 'net. S/he/it enjoys trolling.
--
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology
(Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill)
andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
------------------------------
Date: 15 May 2001 20:09:26 -0500
From: andrew_perrin@unc.edu (Andrew J. Perrin)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <87sni65cc9.fsf@nujoma.perrins>
Andrew Yeretsky <ayeretsk@arm.com> writes:
> Don't
> tell me you guys don't have the time.
I'm quite sure many of them don't. What time they do have, I'm sure
they'd prefer to spend responding to questions that *can't* be
answered in three minutes' searching. Furthermore, the *group*
benefits when the level of discourse is raised to the point that new
and interesting issues are considered instead of simply rehashing old
answers to old questions. Signal-to-noise ratio is important, and the
behavior the document seeks to encourage improves said ratio.
--
----------------------------------------------------------------------
Andrew J Perrin - Ph.D. Candidate, UC Berkeley, Dept. of Sociology
(Soon: Asst Professor of Sociology, U of North Carolina, Chapel Hill)
andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
------------------------------
Date: Tue, 15 May 2001 15:21:42 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Sending wav-file through perl-script
Message-Id: <3B01ABF6.B48243C4@stomp.stomp.tokyo>
Tim Lauterborn wrote:
> I would like to send a wav-file "through" a perl-script. Reading and
> printing in binary mode is no problem.
> Unfortunately "Content-type: audio/wav\n\n" does not work. The browser does
> not recognize the file as a wav-file.
> Does someone know the right content-type description?
You have the right content type. Actually there are two
types but yours should be recognized by most browsers.
audio/x-wav
audio/wav
Yours seems the most often used.
In a generic nutshell....
There is an inherent problem, least with Mozilla. A browser
downloads a sound file, wav, midi, au, whatever, then stores
it in a browser cache. Unfortunately, .pl and .cgi files
are not stored in a cache, not in a true sense, there is
no related extension in most cases, which is really how
it should be. A browser downloads an audio file via a script
just fine but does not assign an audio extension because it
originates through a script. A helper application is executed
and is referenced to this sound file in cache, but there is no
extension or, in rare cases, a wrong extension. It cannot be
played; the sound application cannot recognize what type of
audio file is present. Most often, this results in a download
"unknown type" dialog message box.
All which happens is clearly more technical but this will give
you a simplified overview. If you look close at your error message,
look in your cache and look at your location bar when this happens,
you can better surmise events; your browser is confused on what
it should do, there is an extension conflict.
I use a work around which might be of help. If your intent
is to have a user remain at the same page, or similar, you
can print a location redirect. However, for a sound file,
no true redirect takes place. A browser remains where it
is and, loads the sound file via a helper application,
with a page remaining in the background, unless one of
those "dumb" plug-ins like Crescendo is used, which pops
an annoying new window.
Try this as an experiment. Be patient, all of my midi files
are files I personally recorded here at home, and are a bit
on the large size. This should take a little less than a
minute for an average server.
Include this in a test script and decide if this will
satisfy your unique needs,
print "Location: http://la.znet.com/~callgirl3/bornwild.mid\n\n";
You are welcomed to download this midi file and use it
on your local system for testing, if you wish.
A word of caution. A print location method is not compatible
with an html print nor any other print which is preceeded by
a Content-type print. You cannot mix Content-type with a
Location print. You can call a script via Server Side Includes
which can print a Content-type or Location. This is the method
I use described above. Another problem comes into play though,
you cannot make a SSI call via script printed html.
Final analysis, consider using a standard html embed tag to
include sounds in your page. This is quick and easy. Takes
less than a minute to type in needed tags and url location.
You might want to look at options for this, such as size and
style of player, looping, volume and so forth. Works nice!
Read about and research, Content-type, Location, Server
Side Includes and browser protocal, if you wish to jump
into hardcore details on this most annoying problem.
Godzilla!
------------------------------
Date: Tue, 15 May 2001 22:11:16 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Socket: sysread
Message-Id: <x7wv7i8dq3.fsf@home.sysarch.com>
>>>>> "RV" == Ramesh Vadlapatla <vadlapat@ecst.csuchico.edu> writes:
RV> $dsize = sysread($socket, $input, 1024); It sometimes just
RV> waits(blocks) on the socket for more data. (and the server does
RV> not return a null or a new line or anything like that for me to
RV> check end of data)
RV> Is there some kind of peek function that I can use to see if the
RV> socket is going to send more data? How do I handle this situation?
read perlipc. the perl cookbook has several sections on IPC with sockets.
RV> Also, is there any concept of threads in Perl(on unix) like Java
RV> where I can have 1 thread waiting(blocking) on the socket and the
RV> other thread writing to the socket? If so, any url pointers would
RV> help.
also look into io::select, event.pm, POE or Stem. your problem has been
solved many time already.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info: http://www.sysarch.com/perl/OOP_class.html
------------------------------
Date: Tue, 15 May 2001 22:11:37 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Socket: sysread
Message-Id: <1n93gtsdq3te01evqu5ktgrb6l0kduii94@4ax.com>
Ramesh Vadlapatla wrote:
>Is there some kind of peek function that I can use to see if the socket is
>going to send more data? How do I handle this situation?
The 4 argument select()?
Or, since you're already using IO::socket, use the blocking() method
inherited from IO::Handle, to make the socket non-blocking.
--
Bart.
------------------------------
Date: 15 May 2001 22:58:26 +0100
From: nobull@mail.com
Subject: Re: Socket: sysread
Message-Id: <u93da6gtq5.fsf@wcl-l.bham.ac.uk>
Ramesh Vadlapatla <vadlapat@ecst.csuchico.edu> writes:
> $dsize = sysread($socket, $input, 1024);
> It sometimes just waits(blocks) on the socket for more data.
> (and the server does not return a null or a new line or anything like that
> for me to check end of data)
>
> Is there some kind of peek function that I can use to see if the socket is
> going to send more data?
Yep, it is called select().
> Also, is there any concept of threads in Perl(on unix) like Java where I
> can have 1 thread waiting(blocking) on the socket and the other thread
> writing to the socket? If so, any url pointers would help.
AFIAK thread support in Perl is not really ready for the mainstream
yet.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 15 May 2001 20:18:42 -0400
From: Webby <olm@sprynet.com>
Subject: SSI - Changing the Hour in Date_Local
Message-Id: <3B01C762.E65@sprynet.com>
Maybe this isn't the right group for this question, but I do see some
SSI questions here. If there's a better group for this question, please
point me to it.
The following SSI works fine:
<!--#config timefmt="%I:%M%p %A, %b %d, 20%y"-->
<!--#echo var="DATE_LOCAL"-->
But, the server is in California (Pacific Time) and I want to display
Mountain Time (an hour earlier) on the web page. Can it be done?
Thanks,
Webby
------------------------------
Date: Wed, 16 May 2001 00:31:52 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: SSI - Changing the Hour in Date_Local
Message-Id: <slrn9g3ijo.q6f.abigail@tsathoggua.rlyeh.net>
Webby (olm@sprynet.com) wrote on MMDCCCXV September MCMXCIII in
<URL:news:3B01C762.E65@sprynet.com>:
## Maybe this isn't the right group for this question, but I do see some
## SSI questions here. If there's a better group for this question, please
## point me to it.
##
## The following SSI works fine:
##
## <!--#config timefmt="%I:%M%p %A, %b %d, 20%y"-->
## <!--#echo var="DATE_LOCAL"-->
##
## But, the server is in California (Pacific Time) and I want to display
## Mountain Time (an hour earlier) on the web page. Can it be done?
Who knows? This group is about Perl, not about SSI.
And no, don't expect me to know which of the other 70,000 is best
suited for your questions. Try alt.teensex.
Abigail
--
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
. "\162\1548\110\141\143\153\145\162\0128\177" and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}
------------------------------
Date: Wed, 16 May 2001 00:09:18 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: Stumped on $?, duplicate output
Message-Id: <3b01c52d.94a$19@news.op.net>
In article <3B016BAE.FB6AC6EF@uswest.com>,
Mr. Sunray <djberge@uswest.com> wrote:
>I'm trying to test for the success or failure of a local ping-like
>program that's simply "pcdfg -v". On success, it prints out "MyProgram
>Version 1.0". I want to test for success, failure or a hang. Problem
>is, its reporting both success AND failure. Any ideas?
>
>I looked at perlvar and the docs on "open" (p.194, 2nd ed camel book).
>I'm obviously missing something....
Yeah, but it's hard for me to tell you the right thing, because I
don't know just what pcsfg is supposed to do.
Thanks for including code, however. I see a number of serious problems.
> open(PDCFG, "pdcfg -v |");
This means that you are going to read the standard output of the
'pdcfg' command; you will read it soutput from the PDCFG handle.
> PDCFG->autoflush(1); # Tried with and without
autoflush is only meaningful for *output* handles. get rid of this.
> print $?, "\n"; # prints -1
> print $? >> 8, "\n"; # prints 16777215
> print $? & 127, "\n"; # prints 127
> print $? & 128, "\n"; # prints 128
This is all meaningless because $? has not been set yet. pdcfg is
still running, so you cannot possibly get the exit status.
> close(PDCFG);
*this* line is what sets $? . You check $? *after* you do the close.
But since you don't seem to care about the output of pdcfg, I wonder
why you are bothering with open/close. I suggest:
system("pdcfg -v");
if ($? == 0) { print "success" } else { print "failure" }
'system()' runs the command and waits for it to complete. When
system() is finished, $? is set.
Also, I hope you remembered to put
$SIG{ALRM} = sub { die "timeout" }
at the top of your program; if not, the timeout will not work correctly.
I hope this helps. If it's not what you want, please say how it differs.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Tue, 15 May 2001 18:49:36 -0400
From: "nosabi" <nosabi@snospamabi.com>
Subject: To compress and uncompress text files ?
Message-Id: <9dsc7u$abk$1@sshuraab-i-1.production.compuserve.com>
How are you doing ?
I have this perl script running a bullitn board for free postings of ads.
After someone submits an ad the email address, ad subject, ad message,
date&time, #of months to display ad,
is comma separated into an array and appended to a text file. Then saved.
This file is accessed using perl to display ads.
Since this is a popular feature on my board. The text file is becoming
large. Is there a built in feature of PERL to
compress and uncompress these text files "On The Fly"?
Or what should I be looking at to upgrade it to the Next Level ?
All sugestions are greatly appreciated,
Thanks,
The Kid
------------------------------
Date: Tue, 15 May 2001 20:33:22 -0400
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: To compress and uncompress text files ?
Message-Id: <9dshsk$teo$1@slb7.atl.mindspring.net>
"nosabi" <nosabi@snospamabi.com> wrote in message
news:9dsc7u$abk$1@sshuraab-i-1.production.compuserve.com...
> How are you doing ?
>
> I have this perl script running a bullitn board for free postings of ads.
> After someone submits an ad the email address, ad subject, ad message,
> date&time, #of months to display ad,
> is comma separated into an array and appended to a text file. Then saved.
> This file is accessed using perl to display ads.
>
> Since this is a popular feature on my board. The text file is becoming
> large. Is there a built in feature of PERL to
> compress and uncompress these text files "On The Fly"?
> Or what should I be looking at to upgrade it to the Next Level ?
The 'Next Level' would be a real DBMS such as MySQL. With a flat text
database, I would worry more about sluggish performance as the file grows
than I would about eating up disk space. Adding a compression/extraction
pass to each access would slow things down even further.
You should check with your hosting provider to find out what databases are
supported, then use the DBI module with the appropriate drivers. These may
already be installed on your system. The DBI documentation is fairly
complete, and includes links to other sites with FAQs, tutorials and such.
To answer your original question, check out the Compress::Zlib or
Archive::Zip modules on CPAN if you still think that compression is the way
to go.
HTH,
Kurt Stephens
------------------------------
Date: Wed, 16 May 2001 00:18:19 +0200
From: "Michael Ströck" <michael@stroeck.com>
Subject: Re: Urgent: CGI program wanted
Message-Id: <3b01ab01$1@e-post.inode.at>
<snip>
> > BTW: If you use a fake mail-adress, use one I that people won't
> > try to email :-) Like TRY_AND_SPAM_MEaccount@domain.com :-)
>
> Don't use fake email addresses that end in valid top-level domains.
> (The reasons should be obvious). If you really must, then use
> .invalid as the TLD.
>
> (We now return you to your normal programming on this group...)
Thanks for pointing that out :-) Had missed it even after reading that
twice...
Michael Ströck
------------------------------
Date: Tue, 15 May 2001 15:19:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: What is wrong with my Regular Expression?
Message-Id: <3B01AB8A.10C850A7@stomp.stomp.tokyo>
Tad McClellan wrote:
> Godzilla! wrote:
(minor snippage)
> >of "Tad" and post a hateful expression with each
^^^^
> >and every post?
> ^^^^^^^^^^^^^^
> It is not "each and every post". I only attached it to two posts,
> both of them followups to you (it appears I don't follow my own
> advice very well).
Nor the advice of others. Don't flatter yourself. You had
no choice but to discontinue this sociopathic behavior.
I had you dead to rights on this, as always.
> It is not hateful. I do not hate you.
> "Will not listen to you" does not imply "hate you".
Visit your local community college and enroll in
a classic Bonehead English class. There is a very
distinct difference between hateful and hate.
> I just find you a waste of time. Don't take offense, there are
> still plenty of targets left.
You view participants here as targets. Such a novel approach
to social interaction.
Godzilla!
------------------------------
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 910
**************************************