[9969] in Perl-Users-Digest
Perl-Users Digest, Issue: 3562 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 27 13:03:44 1998
Date: Thu, 27 Aug 98 10:01:33 -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, 27 Aug 1998 Volume: 8 Number: 3562
Today's topics:
Re: Perl documentation <aqumsieh@tigre.matrox.com>
Re: Perl script compiling <rootbeer@teleport.com>
Re: PerlBots rcaller@elsevier.co.uk
Re: PerlBots <l.brocard@elsevier.nl>
Re: Problems with system call <aqumsieh@tigre.matrox.com>
Re: question RE downloading webpages and parsing them. <e.christensen@netjob.dk>
Re: Reading a binary file and converting it's data. (Craig Berry)
Re: Rename a file? <aqumsieh@tigre.matrox.com>
SWF (Shockwave Flash) file format (Larry Rosler)
Re: Unreadable Scripts? <pdcawley@bofh.org.uk>
Re: Unreadable Scripts? <upsetter@ziplink.net>
Re: why no true/false keywords? paul_kroll@my-dejanews.com
Win32 unlink bug? <johnc@interactive.ibm.com>
Win32 unlink error? <johnc@interactive.ibm.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 27 Aug 1998 12:23:58 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Perl documentation
Message-Id: <x3yn28qo0kh.fsf@tigre.matrox.com>
dhawker@removethis.bigfoot.com (David Hawker) writes:
>
> On 25 Aug 1998 13:53:12 GMT, Tom Christiansen <tchrist@mox.perl.com> felt
> the need to post:
>
> >Everyone should be familiar with the pointers in the top-level
> >manpage. I've starred the ones most important to beginners.
>
> I'm familiar with it but I'm not going to mush my brain by reading through
> 20 huge texts looking for something whose whereabouts I'm unsure of.
>
Searching through 20 huge texts looking for something takes me less
than 1 minute. I won't tell you my secret! I swore not to reveal the
magic of grep! (oops!)
> >If you first consult this list when you want to find something
> >whose whereabouts you're unfamiliar with, I'll bet you'll go far.
>
> A better and faster way is to use Windows 95's built-in Find tool which
> searches files for a text string. You must have something like this on
> UNIX? Granted, perl itself could do it.
WOW! This Windows95 function is awesome! I bet using Windows95 and
this Find tool saves you a lot of hassle, and time, and crashes, and
money ..
Boy, how did the geniuses in Microsoft think of that? Maybe I should
convince my boss to throw away the Ultra-1 sunsparc station on my
desk, and buy a winblows-based PC that can search text!
>
> --
> dhawker@bigfoot.com | ICQ 7222349
> http://dhawker.home.ml.org
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Thu, 27 Aug 1998 16:03:45 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Perl script compiling
Message-Id: <Pine.GSO.4.02A.9808270901520.4382-100000@user2.teleport.com>
On Thu, 27 Aug 1998 mee@mine.com wrote:
> I would appreciate any pointers on compiling a Perl script into C. My
> host does not have neither Perl libs nor source installed and I am not
> sure whether I must have both to use the backend CC compiler. (Yes, I
> have read M. Beattie's README but it is like most Perl dox -- the
> developer talking to himself).
If you'd like better docs, please write some. :-)
But if you have particular questions on what some docs are trying to tell
you, you could ask those questions here or (better yet) in
comp.lang.perl.moderated. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Thu, 27 Aug 1998 14:10:24 GMT
From: rcaller@elsevier.co.uk
Subject: Re: PerlBots
Message-Id: <6s3pcg$ads$1@nnrp1.dejanews.com>
In article <35E27CC3.FFD24548@netcraft.com>,
Leon Brocard <leon@netcraft.com> wrote:
> Harry McGreggor wrote:
>
> > Well done on dabot, I've taken a look at your site and I'm very
> > impressed!
>
Yea, it does look pretty good for an evenings work. I've been looking into
this field a little as well but haven't got very far.
> Hmm. Well, if we get together with the creator of purl, I'm sure
> we can get a funky thing going. What kind of use for bots were
> you interested in?
>
Well, I've been working a bit on a 'bot which can maintain a semblance of a
conversation (the bit that doesn't work very well yet) and feed information
from a DB. The second part works reasonably well but the problem I've been
having has been primarily in language parsing and maintaining a subject. I
think I can over come the second problem fairly easily but, not knowing much
about language construction the first problem is more serious. I'd like to
hear other peoples thoughts...
> Leon.
>
--
Rich Caller
rcaller@elsevier.co.uk
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 27 Aug 1998 17:24:13 +0100
From: Leon Brocard <l.brocard@elsevier.nl>
Subject: Re: PerlBots
Message-Id: <35E5882D.ED0F3BB@elsevier.nl>
rcaller@elsevier.co.uk wrote:
> Well, I've been working a bit on a 'bot which can maintain a semblance of a
> conversation (the bit that doesn't work very well yet) and feed information
> from a DB. The second part works reasonably well but the problem I've been
> having has been primarily in language parsing and maintaining a subject. I
> think I can over come the second problem fairly easily but, not knowing much
> about language construction the first problem is more serious. I'd like to
> hear other peoples thoughts...
I guess you probably didn't use Chatbot::Eliza then ;-)
btw Is there web/irc access to this bot so that we can stress its
language skills? This is the major way that I tested dabot,
changing its grammar as people played with it on slashNET.
Hmmm. Time to code up a Lingua::EN::Parse then. Anyone want to do
this then? ;-) Parse::RecDescent would be good as we could then
change the grammar depending on twists in the conversation...
So, why code bots in Perl? One simple answer: regular expressions.
They make parsing simple English easy...
What kind of bots are people interested in? You never know, this
could snowball, and the Bot:: namespace will fill up, and seeing
real people on IRC/Usenet will become a rarity.[1]
btw Rich, got any pointers to info that you've used? Oh. And I
appear to now be working in the same company as you ;-)
Leon
[1] This may have already happened
[2] Kibo
--
Leon Brocard...............................................Perl Hacker
l.brocard@elsevier.nl...........................http://www.astray.com/
... Are we having Fahrvergnugen yet??
------------------------------
Date: 27 Aug 1998 11:50:10 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Problems with system call
Message-Id: <x3yogt6o24t.fsf@tigre.matrox.com>
craigs@3rdstone.net (Craig) writes:
>
> On Wed, 26 Aug 1998 15:36:16 -0400, Brian Miller
> <bmiller@newbridge.com> wrote:
>
> >Hello All,
> >
> >I am trying to execute a program in the background (graphical
> >application) using the system
> >call, however the application crashes. I believe the problem has
> >something to do with
> >connections to IO but I am not sure of the details or how to fix it. If
> >I do not use the &
> >in the command it works fine, however I want the perl program to move on
> >to other things.
> >Any suggestions?
Perl waits for system() to finish and return an exit status before it
continues executing the script.
You probably then need to fork() a child process that would exec()
your graphics application separately. Read some documentation on those
two commands.
> >
> >Example case:
> >
> >#!/opt/perl/bin/perl
> >
> >require 5.002;
> >use strict;
> >
> >my $cmd = 'ksh -c "vsim " & ';
> >system($cmd);
Here .. instead of the system call, you would fork(), check the pid
returned and exec() the vsim command in the child process. (Enough
hints .. read some more!)
>
> Not really sure what ksh is but how about
> my $cmd = 'ksh -c vsim';
ksh stands for Korn Shell which is another
command/language/environment for the *nix plaforms. Thus, the proposed
solution does not solve anything.
>
> >
> >Thanks
> >Brian
> >
> >--
> >
Hope this helps
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Thu, 27 Aug 1998 16:19:03 +0200
From: Ernst Christensen <e.christensen@netjob.dk>
To: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: question RE downloading webpages and parsing them.
Message-Id: <35E56AD7.6479EA8F@netjob.dk>
Hi
If you for some reasons can't install the LWP module, you can use
http-lib.pl
reg
Ernst
------------------------------
Date: 27 Aug 1998 05:57:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Reading a binary file and converting it's data.
Message-Id: <6s2sfp$hcd$1@marina.cinenet.net>
Jim Rendant (jimr@xnet.com) wrote:
: I need to read a binary file that contains binary data.
As opposed to a binary file that contains...what? :)
: How do I do this?
Here's my favorite approach *if* the file isn't too big to yank into
memory all at once:
open FOO, "< binfile" or die $!;
binmode FOO; # Necessary on DOS/Win, harmless elsewhere.
{ local $/; $data = <FOO>; }
close FOO;
Now all the data from binfile is in $data as one big scalar string, and
you can play with it there to your heart's content.
If the file is too big to slurp into memory all at once, you'll need to
pull it in in pieces. See the doc on the read function, if this is the
case.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: 27 Aug 1998 09:52:53 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Rename a file?
Message-Id: <x3yr9y2o7ka.fsf@tigre.matrox.com>
Weifan Lin <wlin@pip974.aud.alcatel.com> writes:
>
> I am trying to replace the file name with the variables. I don't know
> too much about Perl.
> I got the following script from someone but it didn't work. Can someone
> tell me where is
> the problem?
>
> $original = "abc.jpg";
> $newname = "1234";
> $number = 1;
> $_ = $original;
> /\./;
> rename($original, "$newname-$number\.$'");
>
>
> Thanks in advance.
>From your description and the little piece of code you have, I
understand that you want to rename a file, but keep the same extension.
$original = "abc.jpg";
$newname = "1234";
$number = 1;
($ext) = $original =~ /^.*\.(.*)$/;
if (rename $original, "$newname-$number.$ext") {
print "Success!\n";
} else {
print "Couldn't rename!\n";
}
--
Ala Qumsieh | No .. not Just Another
ASIC Design Engineer | Perl Hacker!!!!!
Matrox Graphics Inc. |
Montreal, Quebec | (Not yet!)
------------------------------
Date: Thu, 27 Aug 1998 09:28:41 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: SWF (Shockwave Flash) file format
Message-Id: <MPG.104f2917581841c19897f8@nntp.hpl.hp.com>
I am having difficulty parsing packed binary data from the Shockwave
Flash file format (.swf), despite having the detailed specification in
hand. I have found no module that helps either.
Would someone who has experience or code in this area please help (via
email if you think the content might be too specific for the Perl
newsgroups). In particular, I am trying to recover the image size, but
Image::Size doesn't handle this format.
--
(Yet Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 27 Aug 1998 17:00:59 +0200
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: Unreadable Scripts?
Message-Id: <s7pr9y2fp04.fsf@serinde.elsevier.nl>
mgjv@comdyn.com.au (Martien Verbruggen) writes:
> In article <6s2fbf$fpm$1@camel19.mindspring.com>,
> "David" <ceci@bway.net> writes:
> > Now I'm a beginner at Perl and this may sound stupid and and I may get
> > flames but I need to know. Is there any way to make it so that your scripts
> > are unreadable but still executable to people that have FTP access to your
> > host? Cause I'd like it so that people that use the same host as me can't
> > take a look at my scripts. Well now's probably the time for all those
> > flames :).
>
> This is not a perl question, but a quesiton about file access
> permissions, which depends on your platform. Assuming that's some unix
> variant:
>
> chmod 711 script.pl
Last time I tried doing that the script failed to run for anyone but
myself since perl needs to read the file in order to compile and
execute it.
--
Piers Cawley
Where is the life we have lost in living?
Where is the wisdom we have lost in knowledge?
Where is the knowledge we have lost in information? -- T. S. Eliot.
------------------------------
Date: Thu, 27 Aug 1998 15:50:36 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Unreadable Scripts?
Message-Id: <gffF1.25$V5.212469@shore>
Nathan V. Patwardhan <nvp@shore.net> wrote:
: Strange. Does clpmisc now have a reputation for being an unhelpful
: flamebed?
Where have you been? :)
: If so, I wonder why people aren't careful and continue to
: post FAQs. Just curious.
Um... because the people who post FAQs aren't, by and large, reading the
newsgroup beforehand?
--Art
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Thu, 27 Aug 1998 15:45:46 GMT
From: paul_kroll@my-dejanews.com
Subject: Re: why no true/false keywords?
Message-Id: <6s3uva$hco$1@nnrp1.dejanews.com>
In article <6s2g13$97v$1@client3.news.psi.net>,
abigail@fnx.com wrote:
> Tom Christiansen (tchrist@mox.perl.com) wrote on MDCCCXXI September
> MCMXCIII in <URL: news:6s1s6a$93j$1@csnews.cs.colorado.edu>:
> ++ In comp.lang.perl.misc,
> ++ "Saurus" writes:
> ++ : Say true keyword converts to 1 and false keyword to
> ++ :NULL or some such arrangement.
> ++
> ++ No, that would be bad. Bad bad bad.
> ++
> ++ http://language.perl.com/style/slide13.html
>
> Uhm, that's about the silly use of comparing TRUE/FALSE with a
> (potential) boolean expression.
>
> But is the use of TRUE/FALSE wrong in, for instance:
>
Simple code example deleted
> At least it's clear only a true/false value will be returned, where
> as 'return 1' and 'return 0' might throw someone off thinking it will
> be used in an arithmetic expression. There is nothing magical about
> 0/undef/'' that makes them perfect candidates for FALSE.
More text deleted.
> What about
>
> use constant SUCCESS => 0;
> use constant ILLEGAL_DOGMA => 1;
> use constant TOO_MANY_RHYMING_FUNCTIONS => 2;
> use constant UGLY_COLOUR_COMBINATION => 3;
> use constant MISC_ERROR => 4;
>
> Is that wrong too? The degenerated case only uses 0 and 1.
>
> I wouldn't easily use TRUE/FALSE myself, but calling it "bad, bad, bad"?
> No. And your slide doesn't really convince me.
>
> Abigail
(More deleted)
That last example with use constant is what I'd consider "best" for returning
status from a function/subroutine/method.
First, it isn't TRUE/FALSE, so you avoid the many possible meanings of each.
Second, providing named constants for status gives you, well, the same thing
named constants always give you: a central location from which to define the
list of possible values, and a readable name instead of a vague magic number.
Third, it extends a whole lot better than TRUE/FALSE. As Steve McConnell
points out (in "Code Complete" I believe), when a function suddenly goes from
returning TRUE/FALSE to returning a third or fourth value, the whole system
breaks down. His examples were in C, but can you picture someone trying to
extend the TRUE/FALSE in Perl? Return 1 for OK, 0 for error... hmmm, need an
error code, so return 1 for OK and a negative number as an error code (-1 disk
error, -2 dog chewing on cords, -3 cat putting paw on processor fan) breaking
all code that expects 0 to represent FALSE or failed.
Where a function looks or acts like a built-in Perl function, I think most
people would see value in keeping the returns limited to common convention,
i.e., undef is a reasonable return value. But if you're working on a
function that may someday need to return anything more than SUCCESS and
FAILURE, why not give yourself an easy way to extend the system later?
You could certainly just say SUCCESS was an appropriate-in-context true-value
and FAILURE was some appropriate-in-context value of false, and return a
Status code seperately so you never have to extend the basic return. (Sort
of like $! after an OS operation.)
Paul Kroll
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Thu, 27 Aug 1998 10:28:20 -0400
From: "John Call" <johnc@interactive.ibm.com>
Subject: Win32 unlink bug?
Message-Id: <6s3qfj$qmi$1@ausnews.austin.ibm.com>
I tried to execute the following code:
unlink ("$CART_DIR/$name") || warn("UNLINK " . $!);
Instead of unlinking the warn executed. I was a little suprised and looked
at some of the obvious reasons first (like I wasn't in the right directory,
etc.).
After looking at these reasons I decided to take out the $CART_DIR and do a
chdir ("$CART_DIR") before the unlink and just unlink ($name). This worked
fine! So I changed my code to:
unlink ("$CART_DIR\\$name") || warn("UNLINK " . $!);
Now this worked fine. I have never had a problem with mixing backslashes and
forward slashes on. I bring a lot of code from Unix to NT when I write on NT
and all my other statements that have mixed slashes (like open statements)
work fine. I'm curious if this is a bug or a feature in relation to unlink
on Win32?
--
John Call
IBM Interactive Media
------------------------------
Date: Thu, 27 Aug 1998 12:12:01 -0400
From: "John Call" <johnc@interactive.ibm.com>
Subject: Win32 unlink error?
Message-Id: <6s40i0$2c1s$1@ausnews.austin.ibm.com>
I tried the following code:
unlink ("$CART_ID/$name") || warn("unlink: " . $!);
The warn was executed. I looked to make sure that the proper files were in
the correct directory, which they were. I couldn't figure out what was going
on so, on a whim, I took out the $CART_DIR and did a chdir:
chdir ("$CART_DIR");
unlink("$name");
This worked fine! So I assumed the forward slash was the problem so I did
the following:
unlink("$CART_DIR\\$name") || warn("unlink: " . $!);
This worked fine.
Why can I mix and match / and \ with open statements and such and I cannot
do it with unlink? The problem also seems to occur when do file check
operations like -M. This cause problems with portability it seems and I am
curious if it is a bug or is on purpose?
--
John Call
IBM Interactive Media
------------------------------
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 3562
**************************************