[18711] in Perl-Users-Digest
Perl-Users Digest, Issue: 879 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 11 18:15:45 2001
Date: Fri, 11 May 2001 15:15:22 -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: <989619321-v10-i879@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 11 May 2001 Volume: 10 Number: 879
Today's topics:
Re: multi thread sockets <root@novastar.dtdns.net>
Re: need a simple script created please <lmoran@wtsg.com>
OOP in Perl <david_jerzycki@agilent.com>
Perl d20 GM Utility Available for Use/Comment <bmstroh@cavtel.net>
perl jobs in sunny south florida <todd@dsninc.com>
post to script and mail to user at same time? <eyoung@noway.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Anno Siegel)
Removing blank lines at beginng/end of a file <js@hotmail.com>
Re: Removing blank lines at beginng/end of a file <krahnj@acm.org>
Re: Tips for using the Perl Debuger (M.J.T. Guy)
Re: Tuning Perl application <djberge@uswest.com>
Unicode character (was: Re: If statement question) (Rudolf Polzer)
Re: weird error on @array syntax (Craig Berry)
Write to file (Jad)
Re: Write to file <lmoran@wtsg.com>
Re: Write to file <uri@sysarch.com>
Re: Write to file <me@my_no_spam.org>
Re: Write to file <lmoran@wtsg.com>
Re: Write to file (Damian James)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 11 May 2001 19:40:59 +0300
From: "novastar" <root@novastar.dtdns.net>
Subject: Re: multi thread sockets
Message-Id: <9dh4ms$17j$1@usenet.otenet.gr>
Thanks Bart.
"Bart Lateur" <bart.lateur@skynet.be> wrote in message
news:6usnftolnvm3edljp0j4pmjjhoss0jqu60@4ax.com...
> novastar wrote:
>
> >I am scannining my network with 10 threaded sockets each time. When all
> >these 10 threads have been terminated I have to go for the next 10
sockets
> >and so on. My problem is that I can not figure out if all these10 threads
> >have been terminated for sure in order to go for the next.
>
> Threads, or forks?
>
> In case of the latter, waitpid() can tell you if there are still any
> children alive. Er, "on some systems", that's what "perlfunc -f waitpid"
> says.
>
> --
> Bart.
------------------------------
Date: Fri, 11 May 2001 17:05:58 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: need a simple script created please
Message-Id: <10loftos8cfghvuja228pp8n6krp3s6qet@4ax.com>
On Fri, 11 May 2001 14:34:59 -0700, Donald Dahlman
<druid@eoe-magical.org> wrote wonderful things about sparkplugs:
>I need a perl script
>that allows a user to fill in some information
>select a local file on there machine a jpg or gif only
>click a button and have the contents added to an html file
>and have the graphic file added to a separate directory.
>when the html file is opened the links will also show the photos
>have a little money can some one help. I can do a little of the work
>like creating the basic html headers and footers
>druid@nift.net
>
you need a programmer...
you could *possibly* try www.freeperlcode.com although your specs are
a little specific.
--
print "\x{263a}"
------------------------------
Date: Fri, 11 May 2001 13:52:56 -0600
From: dave jerzycki <david_jerzycki@agilent.com>
Subject: OOP in Perl
Message-Id: <3AFC4318.83B993F3@agilent.com>
Just getting started in object oriented programming, I've got a
quick question to ask:
How do I read this statement
my $pOptionMap = $this->SUPER::getOptionMap( );
-> is a dereferencing arrow used to call a method on an object, in this
case, let's just say $this equals foo
How do I interpet SUPER::getOptionMap( )????
SUPER is what? If I print out what @ISA is, it has no bearing on where
this program "jumps" to/calls. So getOptionMap is a member of SUPER?
Any good reference text I could refer to, most texts I've seen define
$this->cgi( ) or $this->cgi($data) or even App::initInstance( )
but not something like $this->SUPER::getOptionMap( )
------------------------------
Date: Fri, 11 May 2001 16:15:47 -0400
From: Brent Stroh <bmstroh@cavtel.net>
Subject: Perl d20 GM Utility Available for Use/Comment
Message-Id: <j2ioftgd9bdusol892oleoimgc8u1o5e3n@4ax.com>
I've recently put together a handful of modules to support my PBEM Dungeons
& Dragons 3e game. To make them useful, I've also built a shell program to
tie them together.
As an example of what it does:
C:\rpgshell>rpgshell
RPGShell> load party
RPGShell> roll party init
Alex (init) : 1d20+0 :: ( 13 ) +0 = 13
Bob (init) : 1d20-2 :: ( 16 ) -2 = 14
RPGShell> roll bob lt-mace vs 16
Bob (lt-mace) : 1d20+0 :: ( 3 ) +0 = 3 -> Failure
RPGShell> roll Alex dagger vs 16
Alex (dagger) : 1d20+1 :: ( 4 ) +1 = 5 -> Failure
RPGShell> roll bob fort
Bob (fort) : 1d20+6 :: ( 19 ) +6 = 25
RPGShell> roll bob lt-mace vs 16
Bob (lt-mace) : 1d20+0 :: ( 2 ) +0 = 2 -> Failure
RPGShell> roll alex dagger vs 16
Alex (dagger) : 1d20+1 :: ( 3 ) +1 = 4 -> Failure
RPGShell> roll bob heal
Bob (heal) : 1d20+5 :: ( 5 ) +5 = 10
It's currently under-documented, but the README should give you a place to
start. The example above will probably help, as well. The code will need
some cleanup, and I've still got some features to add. However, it's
functional.
Folks interested can get it from Yahoo Groups at:
http://groups.yahoo.com/group/rpgshell
This requires a Yahoo id; if you don't have/don't want one, you can still
subscribe to the discussion list by sending email to:
rpgshell-subscribe@yahoogroups.com
Optionally, you can request a copy via email from:
bmstroh@cavtel.net
I'm interested in feedback, bug reports, bug fixes, etc, if you're
interested in getting involved.
------------------------------
Date: Fri, 11 May 2001 17:18:04 -0400
From: "Todd Katcher" <todd@dsninc.com>
Subject: perl jobs in sunny south florida
Message-Id: <9dhkrp$q66$1@slb0.atl.mindspring.net>
We are looking for several senior perl programmers to fill permanent
opportunties in South Florida. Please email todd@dsninc.com for more
information.
Thanks.
------------------------------
Date: Fri, 11 May 2001 15:01:36 -0500
From: eyoung <eyoung@noway.com>
Subject: post to script and mail to user at same time?
Message-Id: <3AFC4520.F9394324@noway.com>
<form method="post" action="cgi-bin/document">
The above statement will send all the data collected to a script called
"document"
How do you also send all or even parts of the information to an email
address as well as the script?
Because I only want parts of the information emailed (the same info that
will be given back to the user in the confirmation page) should I send
the email from the confirmation page with a script like
open (MAIL, "|mail my_email");
print MAIL "$Name, $Value\n";
close MAIL;
------------------------------
Date: 11 May 2001 15:07:51 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 1.1 $)
Message-Id: <9dgv87$4u8$2@mamenchi.zrz.TU-Berlin.DE>
According to Eric Bohlman <ebohlman@omsdev.com>:
> Andras Malatinszky <andras@mortgagestats.com> wrote:
>
>
> > tadmc@augustmail.com wrote:
>
> > [snip]
>
> > Tad, I think what you are doing is great and much needed. I hope you
> don't mind
> > some suggestions.
>
> >>
> >> Outline
> >> Before posting to comp.lang.perl.misc
> >> Must
>
> > Should.
>
> > You are talking to adults. If you start off on a bossy tone you are going to
> > alienate your audience. That's not what we want.
>
> > Maybe you could try the angle of "if you don't want to embarrass yourself and
> > make yourself the target of scorn, you should..."
>
> I think Tad is using "must," "should," etc. in the very particular (some
> would say "peculiar") sense that they have in specs like RFCs. I'm not
> entirely sure whether that's a good idea here (at least not without some
> explanation, which would take up valuable space) because:
>
> 1) Many or most of the people reading guidelines won't yet be familiar
> with reading formal specs and
>
> 2) Stark imperatives make sense when you're saying what a *computer* is
> supposed to do (as does a spec) but are rather objectifying and
> defense-inducing when you're describing what a *person* is supposed to do.
I disagree with you and the previous poster. Tad's document lays out
what we think an acceptable posting and what we don't. It's like
setting up the terms of a contract. *Because* we are talking to adults
(though not exclusively), the terms should be as clear as possible.
Anno
------------------------------
Date: Fri, 11 May 2001 21:22:27 GMT
From: "Kenneth Eide" <js@hotmail.com>
Subject: Removing blank lines at beginng/end of a file
Message-Id: <nKYK6.69$qR5.7284@news01.chello.no>
Hello!
How would I remove ALL blank lines at the beginning, and at the end of a
file?
I've searched for help on this but I haven't found anything unfortunatly.
Hope some of you guys could help me out.
Sincerely
Kenneth Eide
------------------------------
Date: Fri, 11 May 2001 21:59:52 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Removing blank lines at beginng/end of a file
Message-Id: <3AFC60DF.FA5A40FC@acm.org>
Kenneth Eide wrote:
>
> Hello!
>
> How would I remove ALL blank lines at the beginning, and at the end of a
> file?
> I've searched for help on this but I haven't found anything unfortunatly.
> Hope some of you guys could help me out.
perl -0777 -pi.bak -e 's/^\s+//; s/\s+$//' yourfile
John
--
use Perl;
program
fulfillment
------------------------------
Date: 11 May 2001 15:15:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Tips for using the Perl Debuger
Message-Id: <9dgvmu$a1a$1@pegasus.csx.cam.ac.uk>
Chris Newman <chris_newman@bigpond.com> wrote:
>
>What is the most efficient way to set up and working with the Perl debuger?
>Use aliases for common tasks. Use the a LINE ACTION command to view changes
>to variables. Any suggestions (NO FLAMES PLEASE) would be appreciated. We
>all need to learn sometime.
If you have a recent enough Perl ( >= 5.6.1 ), see 'perldoc perldebtut'
as a starting point.
Mike Guy
------------------------------
Date: Fri, 11 May 2001 10:41:38 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: Tuning Perl application
Message-Id: <3AFC0832.7E283650@uswest.com>
Paul Dembry wrote:
> I need to determine where time is being spent within my application. Is
> there a profiling type of function/module that I can use to do this? There
> are no command line options for this nor have I found anything in several
> Perl books. I would like to know which subroutines are taking the most time
> to execute.
> Thanks,
> Paul
Try the profiler:
perl -d:DProf prog.pl
See "Debugging Perl" by Martin Brown for more details.
Regards,
Mr. Sunray
------------------------------
Date: Sat, 12 May 2001 01:25:26 +0200
From: eins@durchnull.de (Rudolf Polzer)
Subject: Unicode character (was: Re: If statement question)
Message-Id: <slrn9fot75.icf.eins@www42.t-offline.de>
Lou Moran <lmoran@wtsg.com> wrote:
> --
> print "\x{263a}"
What is this? Is it the Korean
____
/ \
\____/
________
____
/ \
\____/
'0/0' character (spoken near 'ang', but forget about the 'a')?
How do I display unicode characters in Linux? Is there a charmap program?
And if it is not the 0/0: does anyone know which it is?
OT, so fup2me
--
www42:~ # mv /mnt/c/windows/win.com /dev/null
mv: /dev/null: data refused
------------------------------
Date: Fri, 11 May 2001 17:23:17 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: weird error on @array syntax
Message-Id: <tfo805gvo6q505@corp.supernews.com>
Bart Lateur (bart.lateur@skynet.be) wrote:
: Craig Berry wrote:
:
: >: Is it me (more probably) or perl?
: >
: >I'd actually blame this one more on perl.
:
: Perl4 mosty likely would have printed a literal @ instead. Would you
: prefer that to the warning -- er, error?
The only reason that (until recently) Perl errored out on an ambiguous
array interpolation was to avoid silently changing the semantics of
scripts written for Perl 4. Which is a reasonable enough goal, certainly.
My criticism is that the error should have been downgraded to a warning
much sooner, given that we've been in the Perl 5 regime for many years,
now.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "God becomes as we are that we may be as he is."
| - William Blake
------------------------------
Date: Fri, 11 May 2001 19:44:02 GMT
From: jadhajj@austin.rr.com (Jad)
Subject: Write to file
Message-Id: <3afc4141.13978259@news-server.austin.rr.com>
Hi,
My scrip is creating a file and appending to it.
I want the file to be created outside of the cgi-bin/ directory and be
available for the public, is there a way to do it. I tried this but it
didn't work:
$outfile = "../results.txt";
open(FH,">> $outfile");
Thanks,
JH
------------------------------
Date: Fri, 11 May 2001 16:23:32 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Write to file
Message-Id: <5jhoft4hts747l684hk3o6kil5moum1007@4ax.com>
On Fri, 11 May 2001 19:44:02 GMT, jadhajj@austin.rr.com (Jad) wrote
wonderful things about sparkplugs:
>Hi,
>My scrip is creating a file and appending to it.
>I want the file to be created outside of the cgi-bin/ directory and be
>available for the public, is there a way to do it. I tried this but it
>didn't work:
> $outfile = "../results.txt";
> open(FH,">> $outfile");
What didn't work?
Your script didn't create the file results.txt?
-- Try to have the script tell you why with --
$outfile = "../results.txt" or die "Can't create file: $!" ;
open(FH,">> $outfile") ;
Your script didn't append to the file results.txt?
-- Try to have the script tell you why with --
$outfile = "../results.txt" or die "Can't create file: $!" ;
open(FH,">> $outfile") ;
Your script didn't put the file results.txt where you wanted it?
-- Try --
$outfile = "/home/httpd/html/results.txt" or die "Can't create
file: $!" ;
open(FH,">> $outfile") ;
Your script created and appended the file results.txt but no one could
"see" it?
-- Try --
To make sure the rights are set properly in your directory of
choice as well as your file.
Your script ran fine but flames shot out of your NIC card and flying
poison monkeys attacked you and everyone in your place of worship?
-- Try --
Step away from the machine and run for your life :)
>
>Thanks,
>JH
--
print "\x{263a}"
------------------------------
Date: Fri, 11 May 2001 20:50:54 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Write to file
Message-Id: <x766f7bodt.fsf@home.sysarch.com>
>>>>> "LM" == Lou Moran <lmoran@wtsg.com> writes:
LM> Your script didn't create the file results.txt?
LM> -- Try to have the script tell you why with --
LM> $outfile = "../results.txt" or die "Can't create file: $!" ;
LM> open(FH,">> $outfile") ;
hmm, it helps if you put the die clause on the open statement. i think
assignment in perl will always work. :)
LM> -- Try to have the script tell you why with --
LM> $outfile = "../results.txt" or die "Can't create file: $!" ;
LM> open(FH,">> $outfile") ;
repeat. rinse.
LM> Your script didn't put the file results.txt where you wanted it?
LM> -- Try --
LM> $outfile = "/home/httpd/html/results.txt" or die "Can't create
LM> file: $!" ;
LM> open(FH,">> $outfile") ;
one more time.
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: Fri, 11 May 2001 16:35:33 -0400
From: Dave VP <me@my_no_spam.org>
Subject: Re: Write to file
Message-Id: <3AFC4D15.93225C0F@my_no_spam.org>
Lou Moran wrote:
>
> On Fri, 11 May 2001 19:44:02 GMT, jadhajj@austin.rr.com (Jad) wrote
> wonderful things about sparkplugs:
>
> >Hi,
> >My scrip is creating a file and appending to it.
> >I want the file to be created outside of the cgi-bin/ directory and be
> >available for the public, is there a way to do it. I tried this but it
> >didn't work:
> > $outfile = "../results.txt";
> > open(FH,">> $outfile");
>
> What didn't work?
>
> Your script didn't create the file results.txt?
>
> -- Try to have the script tell you why with --
> $outfile = "../results.txt" or die "Can't create file: $!" ;
> open(FH,">> $outfile") ;
>
> Your script didn't append to the file results.txt?
>
> -- Try to have the script tell you why with --
> $outfile = "../results.txt" or die "Can't create file: $!" ;
> open(FH,">> $outfile") ;
>
> Your script didn't put the file results.txt where you wanted it?
>
> -- Try --
> $outfile = "/home/httpd/html/results.txt" or die "Can't create
> file: $!" ;
> open(FH,">> $outfile") ;
>
> Your script created and appended the file results.txt but no one could
> "see" it?
>
> -- Try --
> To make sure the rights are set properly in your directory of
> choice as well as your file.
>
> Your script ran fine but flames shot out of your NIC card and flying
> poison monkeys attacked you and everyone in your place of worship?
>
> -- Try --
>
> Step away from the machine and run for your life :)
>
> >
> >Thanks,
> >JH
>
> --
> print "\x{263a}"
Lou,
Usually I have the monkey problem.
I assume you meant to check the return from the open() and not the
variable assignment?
Dave
------------------------------
Date: Fri, 11 May 2001 16:56:23 -0400
From: Lou Moran <lmoran@wtsg.com>
Subject: Re: Write to file
Message-Id: <i8koftoqbpn9d3676cvm3g4k352a73v5mh@4ax.com>
On Fri, 11 May 2001 16:23:32 -0400, Lou Moran <lmoran@wtsg.com> wrote
wonderful things about sparkplugs:
UGH! Stupid, ugly cut and paste!
I meant:
$outfile = "../results.txt";
open(FH,">> $outfile") or die "Can't create file: $!" ;
(3 times in a row... That's it back to lurking and asking dumb
questions)
--
print "\x{263a}"
------------------------------
Date: 11 May 2001 21:15:37 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Write to file
Message-Id: <slrn9folfd.src.damian@puma.qimr.edu.au>
Lou Moran chose Fri, 11 May 2001 16:23:32 -0400 to say this:
>...
>What didn't work?
>
>Your script didn't create the file results.txt?
>
>-- Try to have the script tell you why with --
> $outfile = "../results.txt" or die "Can't create file: $!" ;
> open(FH,">> $outfile") ;
>...
I don't mean to quibble, but you probably mean:
$outfile = "../results.txt";
open(FH,">> $outfile") or die "Can't write to $outfile: $!";
If the assignment line failed, there are worse problems going on than I
would want to have to deal with :-).
[OT] To the OP:
While the error checking here is important, once you use it you will find
that the directory immediately above cgi-bin is probably NOT the place you
want to be writing data files. Specifically you do NOT want your CGI
programs to have write access to that directory. But this has nothing to do
with Perl -- try a CGI newsgroup.
Cheers,
Damian
--
@:=grep!($;+=m!$/|#!),split//,<DATA>;@;=0..$#:;while(@;){for($;=@;;--$;;)
{@;[$;,$:]=@;[$:,$;]if($:=rand$;+$|)!=$;}push@|,shift@;if$;[0]==@|;select
$,,$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__
Just another Perl Hacker # rev 3.1 -- a JAPH in progress, I guess...
------------------------------
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 879
**************************************