[18850] in Perl-Users-Digest
Perl-Users Digest, Issue: 1018 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 30 09:05:38 2001
Date: Wed, 30 May 2001 06: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: <991227913-v10-i1018@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 30 May 2001 Volume: 10 Number: 1018
Today's topics:
Re: $^O value for PERL on a Macintiosh (Guillaume DURR)
Re: $^O value for PERL on a Macintiosh (Bernard El-Hagin)
Re: An Example Of A Polite FAQ <07950232225@one2one.net>
Re: An Example Of A Polite FAQ <bart.lateur@skynet.be>
Controlling downloads using CGI and Apache (Dave)
Re: Controlling downloads using CGI and Apache (Rafael Garcia-Suarez)
Re: HELP with IPC (Anno Siegel)
Re: How Can abtain yesterday or nextday (Rafael Garcia-Suarez)
Re: How Can abtain yesterday or nextday nobull@mail.com
Re: How Can abtain yesterday or nextday <pne-news-20010530@newton.digitalspace.net>
Re: How can I migirate installed&configured activeperl5 <bart.lateur@skynet.be>
HTML input box variables? <jonathan.drever@amsjv.com>
Re: manipulating HUGE amounts of text <wyzelli@yahoo.com>
Re: manipulating HUGE amounts of text (Tad McClellan)
Newbie frustrations <noemail@noemail.com>
openning a new browser's window <IlanLL@yahoo.com>
Re: openning a new browser's window <bkennedy99@Home.com>
Re: Perl excercises (Tad McClellan)
Re: Perl for Windows ?? <wyzelli@yahoo.com>
Re: Perl for Windows ?? <bart.lateur@skynet.be>
Re: printing contents of a file to html <bart.lateur@skynet.be>
Re: printing contents of a file to html <pne-news-20010530@newton.digitalspace.net>
Re: Problems with Cookie code <gtoomey@usa.net>
Reading binary data (method and style)? <mitia.nospam@northwestern.edu.invalid>
Re: Reading binary data (method and style)? nobull@mail.com
Re: regexp for triming domainnames (Patrick Erler)
Re: Sending wav-file through perl-script <07950232225@one2one.net>
Re: Sending wav-file through perl-script <bart.lateur@skynet.be>
Re: showtables puts wasteful blanks at end of each line <wyzelli@yahoo.com>
Silly pipe() question <goldbb2@earthlink.net>
Re: Statistics for comp.lang.perl.misc (Tad McClellan)
Re: use Module (if it exists) (Rafael Garcia-Suarez)
using System() and exec() (Le Malet Guillaume)
Re: using System() and exec() (Anno Siegel)
Re: vestale.pl ascii animation (Alain)
Re: Workgrounds for perl2exe ?? (Helgi Briem)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 30 May 2001 13:43:42 +0200
From: g.durr@free.fr (Guillaume DURR)
Subject: Re: $^O value for PERL on a Macintiosh
Message-Id: <1eu83fh.1no41vr9yvxs0N%g.durr@free.fr>
Leona Browning <leona_browning@hotmail.com> wrote:
> Hi
> Anyone know what Print $^O returns for Perl runnin on a Macintosh ?
>
> I've used the above method to trap for a windows machine now I need to
> isolate some code for Macperl and I dont have access to a Mac
>
> Thanks in advance
$0 print the name of the script that is being executed
--
«Pour voir le PC de demain, regardez le Macintosh d'aujourd'hui.»
BYTE, octobre 1995
Guillaume Durr g.durr@free.fr
ICQ N# 29417800 http://g.durr.free.fr
------------------------------
Date: Wed, 30 May 2001 12:00:25 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: $^O value for PERL on a Macintiosh
Message-Id: <slrn9h9nii.2s4.bernard.el-hagin@gdndev25.lido-tech>
On Wed, 30 May 2001 13:43:42 +0200, Guillaume DURR <g.durr@free.fr> wrote:
>Leona Browning <leona_browning@hotmail.com> wrote:
>
>> Hi
>> Anyone know what Print $^O returns for Perl runnin on a Macintosh ?
>>
>> I've used the above method to trap for a windows machine now I need to
>> isolate some code for Macperl and I dont have access to a Mac
>>
>> Thanks in advance
>
>$0 print the name of the script that is being executed
And what the hell does that have to do with $^O?
Cheers,
Bernard
--
perl -le '$#="Just another Perl hacker,"; print print;'
------------------------------
Date: Wed, 30 May 2001 10:41:31 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <3B14C04A.70AEC1B4@one2one.net>
>
> This is a technical newsgroup. The concepts and language here should be
> reflective of that. Having 'polite' links to other docs which may be
> more descriptive and useful for newer users is worth pursuing.
>
> As I've read through the various threads on FAQs and guidelines posted
> in clpm the past few days, I've come to realize that:
> 1. There are folks who just *won't* RTFM
> 2. There are folks who have never programmed in *any* language.
> 3. There are extremely knowledgeable and helpful people in this group.
> 4. There are those who would *like* to learn,
> but are having trouble getting up the slope.
>
> There's nothing to be done about nos. 1 & 2. They're everywhere!
> The people in #3 already know how to use the tools, whether they have
> written the docs or at least
> know how to read them.
> I believe that targeting the guidelines to this last group would be of
> the greatest benefit.
> I *hope* that it would cut down some of the wasted bandwidth.
>
> Dave
A long time ago and under the monika of the Pilgrim I used to regulary post a
document to the comp.infosystems.www.servers.unix group called Please Read This
Before Posting Hear - THIS MEANS YOU.
This document contained a small amount of general info and pointers to various
resources on the net to FAQ's.
Any one who showed willfull ignarance of this document or the links contained in it
was simpley ignored by the regular posters.
John Imrie aka The Pilgrim
------------------------------
Date: Wed, 30 May 2001 11:02:59 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: An Example Of A Polite FAQ
Message-Id: <atk9htcsn5lia0i5k1b7bemf9hticm10ip@4ax.com>
John Imrie wrote:
>A long time ago and under the monika of the Pilgrim I used to regulary post a
>document to the comp.infosystems.www.servers.unix group called Please Read This
>Before Posting Hear - THIS MEANS YOU.
^^^^
Shouldn't that be "Here"?
--
Bart.
------------------------------
Date: 30 May 2001 07:48:39 GMT
From: david.obrien@ssmb.com.au (Dave)
Subject: Controlling downloads using CGI and Apache
Message-Id: <Xns90B1B52E568FBdavidobrienssmbcomau@169.191.103.141>
Hi,
We have a site which will serve as a document repository. We need to
prevent users from getting to the files directly (i.e. type in full URL to
file). One way to prevent this is to redirect the user to a CGI script for
authentication/authorisation. If I do that how do I then serve up the file
to the user (assuming correct authorisation), because the redirection will
take place back to the CGI script! This is obviously a circular reference
any help would be much appreciated
Dave O'Brien
--
"The Sun is not God!"
------------------------------
Date: 30 May 2001 08:05:56 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Controlling downloads using CGI and Apache
Message-Id: <slrn9h9aea.79e.rgarciasuarez@rafael.kazibao.net>
Dave wrote in comp.lang.perl.misc:
}
} We have a site which will serve as a document repository. We need to
} prevent users from getting to the files directly (i.e. type in full URL to
} file). One way to prevent this is to redirect the user to a CGI script for
} authentication/authorisation. If I do that how do I then serve up the file
} to the user (assuming correct authorisation), because the redirection will
} take place back to the CGI script! This is obviously a circular reference
Here's a framework you can use :
Place the files to be downloaded outside of the directories served by
apache. Your CGI script should check user authorisation, and then, if
successful, print the appropriate headers (probably Content-Type:
application/octet-stream) and copy the chosen file to the standard
output.
Note that this can be implemented in many other langages; your question
is not Perl-specific, so I suggest to ask for further info in a more
appropriate newsgroup, such as comp.infosystems.www.authoring.cgi.
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 30 May 2001 08:29:09 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: HELP with IPC
Message-Id: <9f2b0l$lh4$1@mamenchi.zrz.TU-Berlin.DE>
According to Dennis Kowalski <dennis.kowalsk@daytonoh.ncr.com>:
> Here is the code from script #1 which creates the IPC queue.
>
> eval 'sub IPC_CREAT {0001000}' unless defined &IPC_CREAT;
> eval 'sub IPC_NOWAIT {0004000}' unless defined &IPC_NOWAIT;
I'll assume you are doing this only during testing. IPC::SysV
defines these constants.
[snip code that successfully creates a message queue]
> dennis> ipcs -qa | grep dkow
-a (all) overrides -q (queues) in ipcs. you want "ipcs -q".
> q 2004 0x000003e7 --rw-rw-rw- dkowalsk sysarch dkowalsk sysarch 0
> 0
> 65535 0 0 no-entry no-entry 8:39:51
>
>
> Here is the code from script #2 which is trying to send a message to an IPC
> queue which has been created by script #1 which previously ran.
[...]
> eval 'sub IPC_RMID {0}' unless defined &IPC_RMID;
> eval 'sub IPC_NOWAIT {0004000}' unless defined &IPC_NOWAIT;
>
> $key = 999;
> $queue = msgget($key, 0);
>
> # this does return the proper id of the ipc queue
> # $queue contains the id of 2004
>
> $message = pack("La*", 0, "XXXXXX");
^
This is your error. That "0" specifies the message type which
must be > 0.
[snip rest]
Let me add that the only way to find that error is to carefully
look at the pertinent man pages. I did that. Why didn't you?
Anno
------------------------------
Date: 30 May 2001 07:03:56 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: How Can abtain yesterday or nextday
Message-Id: <slrn9h96q2.6nl.rgarciasuarez@rafael.kazibao.net>
seo kyeong chan wrote in comp.lang.perl.misc:
} How can I obtain Yesterday , Tomorrow or
} nowdate + (x)
By using the time() and localtime() functions, described in perlfunc.
If you want more complex date handling routines, search the CPAN for
modules with Date in their names (http://search.cpan.org/).
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 30 May 2001 08:48:23 +0100
From: nobull@mail.com
Subject: Re: How Can abtain yesterday or nextday
Message-Id: <u9vgmjcl33.fsf@wcl-l.bham.ac.uk>
seo kyeong chan <seo@linux.nurine.com> writes:
> How can I obtain Yesterday
See FAQ: "How do I find yesterday's date?"
Please read the FAQ _before_ posting.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 30 May 2001 12:04:42 +0200
From: Philip Newton <pne-news-20010530@newton.digitalspace.net>
Subject: Re: How Can abtain yesterday or nextday
Message-Id: <8bh9htklhc9bm6ocje92mnl6hla3bob68q@4ax.com>
On Wed, 30 May 2001 15:27:03 +0900 (KST), seo kyeong chan
<seo@linux.nurine.com> wrote:
> How can I obtain Yesterday , Tomorrow or
> nowdate + (x)
"Tomorrow's date" is easy. Here's a solution similar to one suggested by
Abigail some time ago:
sub tomorrow's_date {
sleep 86400;
return localtime;
}
This returns a list (from the localtime function) describing tomorrow's
date.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 30 May 2001 09:06:35 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How can I migirate installed&configured activeperl5.6 to another machine
Message-Id: <22e9htkumj2irmdsltjll2f6cjtdjct86h@4ax.com>
Eric Bohlman wrote:
>GArlington <admin@ase-ga.com> wrote:
>> Copy perl directory structure...
>
>Depending on your ActiveState version, you may also have to copy some
>files (e.g. perlcrt.dll for the 500-series builds) which the installer
>puts in /windows/system.
I think that for 5.6, which is what the OP uses according to the subject
line, all DLL's are in Perl's own "bin" directory.
--
Bart.
------------------------------
Date: Wed, 30 May 2001 13:08:19 +0100
From: Jonathan Drever <jonathan.drever@amsjv.com>
Subject: HTML input box variables?
Message-Id: <3B14E2B3.909A94A4@amsjv.com>
Hello,
Does anybody know how to use a perl script to insert a string variable
into an html input box. I can not find any examples anywhere on how to
do this. When you replace value="string" with something like
value=$VARIABLE, the input box just ends up displaying rubbish. Do i
need to use special characters around the variable?
Anyone got any ideas?
Jonathan
------------------------------
Date: Wed, 30 May 2001 16:56:21 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: manipulating HUGE amounts of text
Message-Id: <4e1R6.7$PZ3.1137@vic.nntp.telstra.net>
"Todd Smith" <todd@designsouth.net> wrote in message
news:YX0R6.86838$I5.20535911@news1.rdc1.tn.home.com...
>
> "Martien Verbruggen" <mgjv@tradingpost.com.au> wrote in message
> news:slrn9h8nh7.div.mgjv@verbruggen.comdyn.com.au...
> >
> > It's hard to guess exactly what you want to do,
>
> I used tar files as an example, just because they are usually big and
> (looking at the actual file in vi) appears to humans to be random
> characters. What I want to do is load a file of characters (billions) in
> order but no format, and be able to access each character so I can
traverse
> the line however I want so I can look for patterns.
>
> undef $/;
> @chars = split //, <INPUT>;
> # $#chars could be in the billions
>
> Doing this isn't my question- I'm wondering what's the best way to store
and
> represent that many characters in Perl? I was wondering if there was a
> better way than trying to use such a large array.
You could slurp it into a single scalar and then work on it using substr and
unpack, though I doubt that will help much.
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
$d='$_$a$s$b$w';$e='$_$a$s$b';sub d{$h=shift;$h=~s/\$(\w+)/${$1}/g;return$h}
sub
e{return(shift!=1)?'s':''}for(reverse(1..100)){$s=e($_);$f=d($d);$g=d($e);
$c.="$f\n$g\n$t\n";$_--;$s=e($_);$e=d($d);$c.="$e\n\n";}print"$c*hic*";
------------------------------
Date: Wed, 30 May 2001 07:37:50 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: manipulating HUGE amounts of text
Message-Id: <slrn9h9mse.2gt.tadmc@tadmc26.august.net>
Todd Smith <todd@designsouth.net> wrote:
>What I want to do is load a file of characters (billions) in
>order but no format, and be able to access each character so I can traverse
>the line however I want so I can look for patterns.
>
>undef $/;
>@chars = split //, <INPUT>;
># $#chars could be in the billions
>
>Doing this isn't my question- I'm wondering what's the best way to store and
>represent that many characters in Perl? I was wondering if there was a
>better way than trying to use such a large array.
Would using a large string be "better" than a large array?
while ( s/(.)//s ) {
# do stuff with char in $1
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 30 May 2001 11:46:28 GMT
From: "Thing" <noemail@noemail.com>
Subject: Newbie frustrations
Message-Id: <o45R6.2614$S2.91276@newsread2.prod.itd.earthlink.net>
My goal is to have a test PC where i can Develop in Perl. I am constrained
to Windows 98. I have successfully installed ActivePerl and Apache. The
mod_perl installation is not going as planned, and i think i am missing a
some components im not sure. I am sure however, that i am missing the
knowledge behind what it is i need to do. I think that mod_perl is some
program that was written in C and it changes or extends the Apache web
server to handle certian things like multithreading and such. So
conceptually what i would then need to do is have mod_perl modify the .exe
for apache ? isnt this a hack ? or am i supposed to have source code and
then somehow build the new exe ? or did i just download the wrong thing in
the first place ? how do i know if mod_perl is already running with Apache
? Can someone explain these foriegn Unix-Type concepts of building and
rebuilding stuff to me ?
The ultimate goal when these questions are answered is to connect to a
database and start building my app. After doing searches for ODBC on CPAN i
ran into a thing for win32 type ADO connections. I dont think i want to use
this type of ODBC connection because i think i need to become familiar with
database interaction at a non platform specific level. But the other stuff
i found didnt seem to be what i am looking for. is there a module or
something in perl that just talks ODBC ?
i am starting to think i am a moron after trying to get this all to work.
shouldnt this all be a little more intuitive ? or is it because i am on a
windows test environment ?
------------------------------
Date: Tue, 29 May 2001 18:47:34 +0200
From: "Ilan" <IlanLL@yahoo.com>
Subject: openning a new browser's window
Message-Id: <9f0g3a$kse$1@news.netvision.net.il>
Does anybody know how to open a new browser's window on client side via
server's Perl script ?
Tnx.
------------------------------
Date: Wed, 30 May 2001 13:00:52 GMT
From: "Ben Kennedy" <bkennedy99@Home.com>
Subject: Re: openning a new browser's window
Message-Id: <8a6R6.15063$lP5.7657875@news1.rdc2.pa.home.com>
"Ilan" <IlanLL@yahoo.com> wrote in message
news:9f0g3a$kse$1@news.netvision.net.il...
> Does anybody know how to open a new browser's window on client side via
> server's Perl script ?
> Tnx.
You are most definitely asking a JavaScript question (or a CGI question)
http://developer.netscape.com/tech/javascript/
--Ben Kennedy
------------------------------
Date: Wed, 30 May 2001 07:15:44 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Perl excercises
Message-Id: <slrn9h9lj0.2gt.tadmc@tadmc26.august.net>
dot-comet <cometlinear@yahoo.com> wrote:
>
>Can anyone recommend and websites which have Perl "homework
>assignments" (excercises) for beginner-intermediate level. I've got to
>keep my blade sharp...
I dunno about web sites, but there are newsgroups which daily pose
Perl problems to be solved...
Answer Perl questions here. Help your peers. See how others would
solve the same problem. Get your answers critiqued by many others.
Learn Perl.
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 30 May 2001 16:54:07 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl for Windows ??
Message-Id: <7c1R6.6$PZ3.1241@vic.nntp.telstra.net>
"Ramanathan" <rmuthaia@cisco.com> wrote in message
news:3B149572.A1540D1@cisco.com...
> Hi,
> Can anyone pls. point me to the location(s) to download Perl v5.003_11
> for windows nt ?
www.activestate.com has the current win binary distributions, but I don't
recall one that old.
Wyzelli
--
($a,$b,$w,$t)=(' bottle',' of beer',' on the wall','Take one down, pass it
around');
for(reverse(1..100)){$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n$_$a$s$b\n$t\n";
$_--;$s=($_!=1)?'s':'';$c.="$_$a$s$b$w\n\n";}print"$c*hic*";
------------------------------
Date: Wed, 30 May 2001 08:54:46 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Perl for Windows ??
Message-Id: <esc9htohuv3ce01t6jh4j1qs0lmoud2e8k@4ax.com>
Ramanathan wrote:
> Can anyone pls. point me to the location(s) to download Perl v5.003_11
>for windows nt ?
Why do you want one that old?
If you want an older version, you should stick to something like the
latest 5.005.
And I personally would worry more about binary compatibility, than about
what version of perl you're using. You're unlikely to find many
precompiled XS modules for such an old version.
Anyway, try this for some pointers.
<http://www.cpan.org/ports/#win32>
This list forgot to mention Cygwin. Oh well.
(<http://www.neuro.gatech.edu/users/cwilson/cygutils/>)
And don't give up too easily. It might be worth your while to copy an
URL, strip the file's basename, and see what else is in this directory.
--
Bart.
------------------------------
Date: Wed, 30 May 2001 09:05:07 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: printing contents of a file to html
Message-Id: <krd9ht8lk44m9e53m7csblrveq46n2fjb9@4ax.com>
Philip Newton wrote:
>> I think he's worried about moving the script to different servers.
>
>Then FindBin is probably appropriate.
Question: how does FindBin work? I would expect it to work it out, based
on a combination of $0, the current directory, and $ENV{PATH}. But $0
can be spoofed, or so I've been told, so: how reliable is it,
security-wise?
--
Bart.
------------------------------
Date: Wed, 30 May 2001 11:51:34 +0200
From: Philip Newton <pne-news-20010530@newton.digitalspace.net>
Subject: Re: printing contents of a file to html
Message-Id: <pag9ht8mpgungfaguo071gosd9h53qdbhu@4ax.com>
On Wed, 30 May 2001 09:05:07 GMT, Bart Lateur <bart.lateur@skynet.be>
wrote:
> Question: how does FindBin work?
RTFS :)
> I would expect it to work it out, based
> on a combination of $0, the current directory, and $ENV{PATH}.
Presumably. This is especially likely due to the following:
: KNOWN BUGS
: if perl is invoked as
:
: perl filename
:
: and *filename* does not have executable rights and a program
: called *filename* exists in the users `$ENV{PATH}' which
: satisfies both -x and -T then FindBin assumes that it was
: invoked via the `$ENV{PATH}'.
:
: Workaround is to invoke perl as
:
: perl ./filename
So $ENV{PATH} is definitely involved. See the source for the full scoop.
> But $0 can be spoofed, or so I've been told,
Possibly. Apparently not with the 'system { realname } fakename' syntax,
however (at least, not when I just tried it out: perl 5.7.0 on Linux)
> so: how reliable is it, security-wise?
I'll leave that for others to answer.
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Wed, 30 May 2001 19:22:13 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Problems with Cookie code
Message-Id: <aK2R6.27248$hV3.40778@newsfeeds.bigpond.com>
"Bryan Coon" <bcoon@sequenom.com> wrote in message
news:3B1424FA.B9653228@sequenom.com...
<snip>
Have a look at www.cookiecentral.com for more info on cookies.
The following was posted to this newsgroup by Randal Schwartz a few months
ago and may be of use:
>Why are people always using HTTP::Cookies the hard way? Hasn't
>anyone noticed the LWP::UserAgent method that tells it to use
>a cookie jar?
>
> use LWP::UserAgent;
> use HTTP::Cookies;
> use HTTP::Request::Common;
>
> my $ua = LWP::UserAgent->new;
> $ua->cookie_jar(HTTP::Cookies->new(file => 'cookie_jar', autosave =>
1));
>There... now use $ua as normal. If there are incoming cookies, they'll
>be saved to the jar. If a request matches cookies, they'll be added
>to the request. Just like a browser. No fuss, No muss.
>
>print "Just another Perl hacker,"
>
>--
>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!
gtoomey
------------------------------
Date: Wed, 30 May 2001 02:31:10 -0500
From: Dmitry Epstein <mitia.nospam@northwestern.edu.invalid>
Subject: Reading binary data (method and style)?
Message-Id: <3B14A1BE.B79E2B38@northwestern.edu.invalid>
I need to read formatted binary data from a file. The file contains a
number of fixed-length records, and each record needs to be split into
about two dozen values, such as chars and 16-bit shorts. I am planning
to use read() to read the fixed-length chunks, then unpack() to split
each record into a list of values, which I will use later. Any comments
so far?
I could write the format string for unpack() something like this:
"v2aaaav3a3" etc.
But, since each field has a particular meaning, what I would like to do
is to somehow write this with comments. It would then be easier to read
and modify the code. So, what I would like to do is something like this
(I know the following doesn't work):
"v # foo
v # bar
a # baz
...
Is there a good way to do it?
--
Dmitry Epstein
Northwestern University, Evanston, IL. USA
mitia(at)northwestern(dot)edu
------------------------------
Date: 30 May 2001 08:54:39 +0100
From: nobull@mail.com
Subject: Re: Reading binary data (method and style)?
Message-Id: <u9snhnckqv.fsf@wcl-l.bham.ac.uk>
Dmitry Epstein <mitia.nospam@northwestern.edu.invalid> writes:
> I could write the format string for unpack() something like this:
>
> "v2aaaav3a3" etc.
>
> But, since each field has a particular meaning, what I would like to do
> is to somehow write this with comments.
> (I know the following doesn't work):
>
> "v # foo
> v # bar
> a # baz
You'll kick yourself...
my ($foo,$bar,$baz) = unpack (
'v'. # foo
'v'. # bar
'a', # baz
$record);
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Wed, 30 May 2001 12:51:55 +0200
From: perler@yahoo.com (Patrick Erler)
Subject: Re: regexp for triming domainnames
Message-Id: <Xns90B182DE2A9B9fuyyehcesyrdx@62.153.159.134>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in
news:3B0E8881.D978DAFB@stomp.stomp.tokyo:
> Patrick Erler wrote:
>
>> Godzilla! wrote:
>> > Patrick Erler wrote:
>
> (snipped)
>
>> thanks for your answer. please go and compare them to the answers
>> posted by other people, compare them in style and prejudice from your
>> side, and know why nobody in you neighbourhood realy wants to talk to
>> you...
>
> How illogical.
the problem is, that human relations are not to crasp by your brillant
programmers logic, so you won't get it i'm afraid...
>
> I have compared answers. Not including my own, I tested six
> code examples. Out of those six code examples, only two work.
> Clearly two-thirds of the people whom posted to this thread
> lack sufficient skill to post correct code and, are so careless
> they don't test their code before posting.
next problem is, that even your extraordinary logic didn't prevent, that
you suspected /me/, the one who asked for help, that i smoke stuff which
cotributes to my inability to write the code i asked for to get help with,
not the ones who tried to help me (and may have failed in regard to
perfection). it is no sign of drug addiction not to know everything...
third problem is, that you don't know that quite often you can learn from
the mistakes other people make. this is no examination here, but a
discussion. so wrong answers are /allowed/.
>
> Why would I be concerned about those two-thirds not talking with me?
this is the only point in your posting which is no problem at all. because
these two-thirds are very probably not interested in you to..
>
> A historical examination of articles directed at me in this group
> yields ninty-nine point nine percent of those articles are hateful
> troll articles, as is your article.
this says it all, doesn't it? :))
btw, i consider philip newtons solution superior then yours because of its
simplicity, but thats just MHO, nothing you should care about, God ;))
PAT
------------------------------
Date: Wed, 30 May 2001 13:09:52 +0100
From: John Imrie <07950232225@one2one.net>
Subject: Re: Sending wav-file through perl-script
Message-Id: <3B14E310.97CFA913@one2one.net>
>
> default = text/plain = mangle = dickhead; logical isn't it.
>
> there now that's off my chest I feel better
Im sorry but you are wrong.
text/plain is not mangled by the server its mangled by your stupid M$ OS and
as M$ is the new commer hear they should be the ones to do somthing about it.
------------------------------
Date: Wed, 30 May 2001 12:34:03 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Sending wav-file through perl-script
Message-Id: <76q9ht07llrpslp2bta6cqvpbrg9uvc5mi@4ax.com>
John Imrie wrote:
>text/plain is not mangled by the server its mangled by your stupid M$ OS and
>as M$ is the new commer hear they should be the ones to do somthing about it.
Wrong.
CR+LF was the *age old* way of determining the end of a line. This
predates Unix and C by quite a few numbers of years.
--
Bart.
------------------------------
Date: Wed, 30 May 2001 20:58:56 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: showtables puts wasteful blanks at end of each line
Message-Id: <OG4R6.5$714.834@vic.nntp.telstra.net>
"Dan Jacobson" <jidanni@kimo.FiXcomTHiS.tw> wrote in message
news:m2itijwg58.fsf@dan.jacobson.tw...
> I used $ showtable -ti -t -d' '
> and noticed that there is no way apparently to stop it from putting
> wasteful blanks at the front and back of each line. The ones at the
> front might be acceptable to center a printing a little further away
> from the edge, but the ones at the back just waste file space.
>
> You might want to fix it in the next distribution. Also there are
> blank lines appended.
What version of Perl are you using?
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Wed, 30 May 2001 06:43:24 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Silly pipe() question
Message-Id: <3B14CECC.D80137D3@earthlink.net>
I suppose that this might seem to be a silly question, but...
Why does the builtin function pipe() take two target operands, rather
than taking no arguments and returning a two-element list?
I would prefer to be able to do these:
my ($read_fh, $write_fh) = pipe;
or local (*READER, *WRITER) = pipe;
or my @p = pipe;
or pipe my @p;
Than have to do these:
pipe my($read_fh, $write_fh);
or pipe local(*READER, *WRITER);
or my @p; pipe $p[0], $p[1];
It's such a simple, useful thing, and I don't understand why it wasn't
done. I know where the original syntax comes from... the C function
pipe takes as an argument a pointer to two ints, and fills them in with
filedescriptors... but the only reason it was done that way (AFAIKS) is
that C functions can only return a single value. Perl has no difficulty
at all returning a list with multiple values. Also, it should have no
difficulty differentiating the different number of arguments, to do The
Right Thing.
--
The longer a man is wrong, the surer he is that he's right.
------------------------------
Date: Wed, 30 May 2001 07:25:58 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <slrn9h9m66.2gt.tadmc@tadmc26.august.net>
Philip Newton <pne-news-20010530@newton.digitalspace.net> wrote:
>On Tue, 29 May 2001 15:57:38 -0000, Greg Bacon <gbacon@cs.uah.edu>
>wrote:
>
>> Top 10 Targets for Crossposts
>> =============================
>>
>> Articles Newsgroup
>> -------- ---------
>>
>> 36 alt.perl
>> 29 comp.lang.perl
>
>My goodness. Is this 29 clueless newbies crossposting here, or people
>not bothering to change their "Newsgroups:" line when following up to an
>article with bad headers?
Looks to me like lots of folks helping me automatically reduce
the number of posts that are visible in clp.misc.
I appreciate all the help I can get in that endeavor :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 30 May 2001 07:12:33 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: use Module (if it exists)
Message-Id: <slrn9h97a7.6nl.rgarciasuarez@rafael.kazibao.net>
Todd Smith wrote in comp.lang.perl.misc:
} Is there a way to say:
}
} use String::Approx (if it's installed)
}
} and later:
}
} (if String::Approx is on your system) {
} ...
} }
Why not use require() and wrap it in an eval() ?
#!/usr/local/bin/perl -l
BEGIN {
eval 'require Foo' or print "No module Foo";
eval 'require CGI' or print "No module CGI";
}
--
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: 30 May 2001 03:11:55 -0700
From: guicry@hotmail.com (Le Malet Guillaume)
Subject: using System() and exec()
Message-Id: <d327026.0105300211.3aaf8da2@posting.google.com>
Hi,
I'm executing a perl script in background on a debian distribution,
and in this script I use: `sendsms -d 0$nbappel -m $corps[0],$corps[1] pe245`
to execute a linux command.
But when my script is executed in background, this command doesn't work
anymore.
So, I've tried exec "..."; and I've got the same problem as with ``.
So If you've got an idea please tell me.
THX
Guillaume.
------------------------------
Date: 30 May 2001 10:37:38 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: using System() and exec()
Message-Id: <9f2ihi$m57$1@mamenchi.zrz.TU-Berlin.DE>
According to Le Malet Guillaume <guicry@hotmail.com>:
> Hi,
> I'm executing a perl script in background on a debian distribution,
> and in this script I use: `sendsms -d 0$nbappel -m $corps[0],$corps[1] pe245`
> to execute a linux command.
It doesn't look like you are using the return value of ``. If so, you
don't want backticks but system(). See "perldoc -q backticks" for
the reason.
> But when my script is executed in background, this command doesn't work
> anymore.
> So, I've tried exec "..."; and I've got the same problem as with ``.
It is unlikely that you want exec() here, as it would end your
program. perldoc -f exec.
> So If you've got an idea please tell me.
Very probably your program doesn't use the same command path when
running in the background, so the "sendsms" command isn't found.
Use a fully qualified name or set the path yourself in the script.
Anno
------------------------------
Date: 30 May 2001 04:39:16 -0700
From: alain_s75@hotmail.com (Alain)
Subject: Re: vestale.pl ascii animation
Message-Id: <329469e4.0105300339.65010060@posting.google.com>
Trying again ...
alain_s75@hotmail.com (Alain) wrote in message news:<329469e4.0105250016.56b597eb@posting.google.com>...
> Hello all,
>
> I am looking for an ascii animation that was posted here around 94/95,
> it was in the form of a simple VT file and of a self compressed 3 or 4
> pages perl program.
> The title of the animation was "vestale sous contraintes, exercice
> ludique en courier 10", and the name of the perl program "vestale.pl".
> I am the author of it and somehow I lost the files in the mess of my
> disks !!!
>
> If someone still has it, I would really be greatful if they could
> forward it to me.
> Thanks in advance.
> alain_s75@hotmail.com
------------------------------
Date: Wed, 30 May 2001 11:22:00 GMT
From: helgi@NOSPAMdecode.is (Helgi Briem)
Subject: Re: Workgrounds for perl2exe ??
Message-Id: <3b14d74a.9481063@news.isholf.is>
On Mon, 28 May 2001 13:53:10 -0700, Darius <> wrote:
>Hi all,
>
>I have recently been playing around with writing GUI apps in Win32 and
>using perl2exe in order to make executables, so that other people
>without perl compilers can run my programs.
>
>However, in order to use the -gui command line option of perl2exe to
>get rid of the console window, it costs $150, which I currently don't
>have (and wouldn't pay anyway, since programming is a hobby for me and
>I don't make money doing it).
>
Let me get this straight. You want help from this
group in stealing from the company that makes
perl2exe? And you want people to post their
exploits here for all the world to see so that they
can be prosecuted for their illegal behaviour?
Helgi Briem
------------------------------
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 1018
***************************************