[8176] in Perl-Users-Digest
Perl-Users Digest, Issue: 1794 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 3 05:07:15 1998
Date: Tue, 3 Feb 98 02:00:31 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 3 Feb 1998 Volume: 8 Number: 1794
Today's topics:
[perl] accept a char at a time without.. <khoohuit@iscs.nus.edu.sg>
Carp.pm and CGI::Carp.pm versioning questions <NOSPAM_mike808@mvp.net>
Re: crypt in perl CGI (Jim Britain)
Re: How Do I Tell Whether a Key Is Valid for an Associa <merlyn@stonehenge.com>
Re: How Do I Tell Whether a Key Is Valid for an Associa (Devin L. Ganger)
Re: How do you setup named parameters in objects <NOSPAM_mike808@mvp.net>
how to replace bad characters in a string with a space? (milagro)
Re: mkdir and mkdir -p <merlyn@stonehenge.com>
Module design question (use Exporter vs require Exporte <NOSPAM_mike808@mvp.net>
Monitoring a file <anthonyl@kodak.com>
Re: Monitoring a file <xxTony.Curtis@vcpc.univie.ac.at>
Re: NAWK to PERL conversion <rjk@coos.dartmouth.edu>
Perl Signals (Please Help) <tantongk@iscs.nus.edu.sg>
Perl-Msql interface moneesha@plexustech.net
PROBLEM WITH gifs <steph@hotkey.net.au>
Re: Problem with running perl scripts <xxTony.Curtis@vcpc.univie.ac.at>
Re: recursive regex? <rjk@coos.dartmouth.edu>
Re: replacement for ls command? <rpsavage@ozemail.com.au>
Re: replacement for ls command? <joseph@5sigma.com>
Re: solution for multiline comments??? thowland@vsicom.com
Re: solution for multiline comments??? <danboo@negia.net>
Re: tainted socket <tomroddy@netrition.com>
Re: tainted socket <rjk@coos.dartmouth.edu>
Re: Want to determine the subnet networks from a networ (Martin Vorlaender)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Feb 1998 05:26:57 GMT
From: wakaranai <khoohuit@iscs.nus.edu.sg>
Subject: [perl] accept a char at a time without..
Message-Id: <6b69r1$m072@id4.nus.edu.sg>
hi!
how do i accept a char input without having to press the
enter key in perl?
i am implementing a text based GUI which requires key movements
like TAB and ARROW keys....any gurus out there? thanks!
--
"The human intellect has permitted the appearances to shine forth and
has infused all things with its own basic misconceptions..."
- Nietzsche
------------------------------
Date: Mon, 2 Feb 1998 19:41:42 -0600
From: "Michael King" <NOSPAM_mike808@mvp.net>
Subject: Carp.pm and CGI::Carp.pm versioning questions
Message-Id: <6b5sfv$nfm$2@twain.mvp.net>
A module I'm working on basically replaces Carp.pm. (LogCarp.pm)
However, with 5.004_04, Carp.pm was changed in three critical ways that
affect how I code my module.
1) Carp::shortmess() was changed from the following:
sub shortmess {
my $error = $_[0];
etc...
to the better:
sub shortmess {
my $error = join('',@_);
etc...
Clearly, this was in keeping with the documented syntax of shortmess: i.e.
shortmess LIST.
It clearly fixed:
carp "Hello", $there, ", I just carped!";
to perform like the documented 'carp LIST' syntax. Why it was different than
longmess in the first place,
I don't know.
Anyway, my problem is that I've put code to fix that problem in my module
for the older carp, but
now that the newer one has been fixed, my code is redundant and adds
inefficiency to the execution.
This goes against the "Be Small. Be Fast. Be Good." motto of Carp.pm.
Unfortunately, Carp.pm doesn't have any versioning, so I can't tell whether
my "fix" is required or not,
and I'd rather have 5.000 requirements than 5.004 as my code isn't really
5.004-specific, and opens
my module to a larger potential audience with the lower versioning
requirement.
What to do? Suggestions? Discussion?
2) 5.004_04 Carp.pm also added a new 'cluck' (like confess, but only
carp'ing).
I'm glad we're getting orthogonal and all, but how do I supercede Carp with
my module and have the same import semantics?
My code that does the 'use Carp'; doesn't know what options it was called
with (or does it? or can it?)
when somebody else does a 'use LogCarp;'
Or do I care? Do I just need to 'use Carp qw( cluck );' in *my* code, so
that i *can* override Carp's cluck and export my own 'cluck' if needed in my
@EXPORT_OK?
3) Now here's the tricky part - Carp.pm also added a 'verbose' pseudo-export
symbol / option
to convert croaks and carps into confesses and clucks.
How do I mimic these semantics to my LogCarp module?
I've already 'use'd Carp (and this gets processed in the compile phase
anyway), and so I can't "use" it again when I figger out that somebody wants
to 'use LogCarp qw( verbose )'. I can't re-import the Carp module. Or can I?
And how does this affect (or do I detect) situation #1, where the person is
has an older Carp.pm (and so therefore, the one I 'use' in my module doesn't
have these semantics at all.
Do I just say "Look, ya gotta have 5.004_04" and that's the end of my
versioning problems?
That's not to say this won't solve future versioning problems either.
I'm all ears to your collective insights and discussion.
Mike.
--
# Michael King
# NOSPAM_mike808@mvp.net
# To reply, remove the NOSPAM_ in the address in the line above
# Or, check out my WWW site at:
# http-colon-slash-slash-walden-dot-mo-dot-net-slash-tilde-mike808
#
# These are my views and do not necessarly reflect those of anyone else.
#
# Copyright 1998 Michael King. St. Louis, MO USA
# Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
==================================================================
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
==================================================================
------------------------------
Date: Tue, 03 Feb 1998 06:47:23 GMT
From: jbritain@home.com (Jim Britain)
Subject: Re: crypt in perl CGI
Message-Id: <34d6baf8.11530048@news>
On Mon, 2 Feb 1998 17:25:19 +0100, "Frederic Francken"
<francken@kbinirsnb.be> wrote:
>Can anyone help me with writing a small script which generates a =
>password file using the crypt routine as htpasswd does?
>I'm not at all familiar with Perl, so help is much appreciated.
>The script should ask a filename (password file) and a userID after =
>which it asks for a password twice.
>The file structure should be something like this :
># UserID : Password
Here's the heart of what you want, minus any file IO
I believe this came from: Kevin Scott <scottj@mthcsc.wfu.edu>, but I
don't know where the original message is. It's amazingly simple, if
put into a subroutine, handle your file IO separately.
#! /usr/bin/perl -w
my @salts = ( 'A' .. 'Z', 'a' .. 'z', 0 .. 9, '.', '/' );
my $salt;
my $user;
my $pass;
while (<>) {
chomp;
($user, $pass) = split /:/;
$salt = $salts[rand @salts] . $salts[rand @salts];
print $user, ":", crypt($pass, $salt), "\n";
}
adapt to suit. Feed it with username:passwd.
If you are using this for CGI input, ensure you filter out the
separtor charactor ":" on the input side -- it'll save you from grief
later, if found in a username. (for CGI stuff, most likely, you'll
only want to include alphas and numbers for the username anyway..)
------------------------------
Date: 02 Feb 1998 21:58:41 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: slinberg@crocker.com (Steve Linberg)
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <8cyaztp9mm.fsf@gadget.cscaper.com>
>>>>> "Steve" == Steve Linberg <see-below@crocker.com> writes:
Steve> Might I suggest "Learning Perl" by Randal Schwartz, available at better
Steve> bookstores everywhere.
And the way you tell if it's a "better bookstore" is you verify that
it carries "Learning Perl".
:-)
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 210 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 3 Feb 98 09:21:06 GMT
From: devin@premier1.net (Devin L. Ganger)
Subject: Re: How Do I Tell Whether a Key Is Valid for an Associative Array?
Message-Id: <slrn6ddob7.d03.devin@blacktower.premier1.net>
<flashy-thing!> Remember only that on Mon, 02 Feb 1998 22:35:14 -0500,
in comp.lang.perl.misc Steve Linberg wrote:
> Uh oh, now I've done it. I said "define" and other people said "exists".
> And me without my Perl docs handy...
Hah! I was just reading the tree I printed out at work today (the two
reams, nearly, of paper it took to produce the Postscript bersion of the
Perl documentation -- handy for reading in the restroom, thank you very
much!), so I may even know this one.
> I think they both work in this case, but perhaps someone with books at
> hand (or in head) could clear up the difference.
As I understand it, defined() tells you merely whether the value of a
key-value pair in a hash is equal to undef or not, while exists() tells
you whether the pair is (currently) present in the hash at all.
I am sure that if I am wrong, someone will point out the error of my
ways, and we'll both learn.
--
Devin L. Ganger <devin@premier1.net>
Chief Systems Administrator
Premier1 Internet Services
------------------------------
Date: Mon, 2 Feb 1998 18:53:58 -0600
From: "Michael King" <NOSPAM_mike808@mvp.net>
Subject: Re: How do you setup named parameters in objects
Message-Id: <6b5sft$nfm$1@twain.mvp.net>
>Looking through the code brings no light as $self->{TERM} is apparently
used
>without ever being explicitly created. Could anybody explain what magic is
>being used? If Tgetent had code to explicitly populate $self from the
>parameters, I'd understand, but as far as I can see, this isn't the case.
CGI.pm defines an AUTOLOAD method to lookup and compile (eval) the
appropriate code on demand.
>The following code can be used to furthur illustrate my question:
> #!/usr/local/bin/perl
> package foo;
>
> sub new {
> my $class = shift;
> my $self = {};
> bless $self, $class;
> return $self;
> }
>
> sub foo {
> my $self = shift;
> print "This $self->{-this}\n";
> }
>
> package main;
> $x = foo->new(-this => "is it");
> $x->foo;
>
>Shouldn't this print "This is it\n"?
No. You don't do anything with the parameters passed into "new".
sub new {
my $class = shift;
my $self = {};
# Grab our parameters and make them "properties" of our hash
while (my ($key,$value) = (shift, shift)) {
$key =~ s/^-//; # Strip any leading dash
$self->{$key} = $value;
}
bless $self, $class;
return $self;
}
HTH.
--
# Michael King
# NOSPAM_mike808@mvp.net
# To reply, remove the NOSPAM_ in the address in the line above
# Or, check out my WWW site at:
# http-colon-slash-slash-walden-dot-mo-dot-net-slash-tilde-mike808
#
# These are my views and do not necessarly reflect those of anyone else.
#
# Copyright 1998 Michael King. St. Louis, MO USA
# Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
==================================================================
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
==================================================================
------------------------------
Date: Tue, 03 Feb 1998 03:27:20 -0500
From: milagro@beanfield.com (milagro)
Subject: how to replace bad characters in a string with a space?
Message-Id: <milagro-ya02408000R0302980327200001@news.erols.com>
I currently have a script (which I received help for right here -- thank
you very much) that looks for a series of control characters and tells me
when it finds one and where it found it. What I now need to do is replace
the "bad" characters I find with spaces (" "). My questions is: after I
find the location and record where the bad character exisits, how do I
replace those characters with a space (or anything for that matter).
Do I use "s/what here?/ /g;" ?
Example.. if the output from below tells me I have bad characters at
postions 234 and 998 in Rec 12. How do I go to position 234 and 998 and
change those characters to spaces?
Thanks.. as always for any advice and help.
foreach $rec (@records)
{
$count++;
pos($rec) = 0;
if ($rec =~ /[\000-\011\013\014\020-\37]/g)
{
print "Bad character at position " . pos($rec) . " in record $count. ";
#need to replace the bad character with a space here. How?
}
Sincerely
Michael Shavel
mshavel@erols.com
------------------------------
Date: 02 Feb 1998 22:15:57 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: mwang@alhena.ibk.ml.com (Michael Wang)
Subject: Re: mkdir and mkdir -p
Message-Id: <8cu3ahp8tu.fsf@gadget.cscaper.com>
>>>>> "Michael" == Michael Wang <mwang@alhena.ibk.ml.com> writes:
Michael> Though perl provides "mkdir" but it can not do "mkdir -p",
Michael> for that I have to do system ("mkdir -p ..."); is there
Michael> a better solution? Thanks.
use File::Path;
mkpath "/foo/bar/baz";
print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 210 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Mon, 2 Feb 1998 19:43:14 -0600
From: "Michael King" <NOSPAM_mike808@mvp.net>
Subject: Module design question (use Exporter vs require Exporter)
Message-Id: <6b5sil$ng7$1@twain.mvp.net>
I've seen various module authors use the following constructs (not
simultaneously!):
use Exporter;
and also
require Exporter;
My questions are:
What is (if any) the difference (besides the documented compile-time vs.
run-time semantic differences) between the two usages?
Why would I want to use one form instead of the other for a module I am
authoring?
--
# Michael King
# NOSPAM_mike808@mvp.net
# To reply, remove the NOSPAM_ in the address in the line above
# Or, check out my WWW site at:
# http-colon-slash-slash-walden-dot-mo-dot-net-slash-tilde-mike808
#
# These are my views and do not necessarly reflect those of anyone else.
#
# Copyright 1998 Michael King. St. Louis, MO USA
# Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
==================================================================
By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
meets the definition of a telephone fax machine. By Sec.227(b)
(1)(C), it is unlawful to send any unsolicited advertisement to
such equipment, punishable by action to recover actual monetary
loss, or $500, whichever is greater, for EACH violation.
==================================================================
------------------------------
Date: Tue, 03 Feb 1998 17:48:38 +1100
From: Anthony Licciardi <anthonyl@kodak.com>
Subject: Monitoring a file
Message-Id: <34D6BDC5.21A0@kodak.com>
Has anyone written or know of a simple way to monitor a file, sleep for
a few seconds and then check to see if the file has increased in length
and if so, to read the newly added lines and pipe them into another
file????!??
------------------------------
Date: 03 Feb 1998 10:25:18 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
To: anthonyl@kodak.com
Subject: Re: Monitoring a file
Message-Id: <7x3ei1m45d.fsf@beavis.vcpc.univie.ac.at>
Re: Monitoring a file, Anthony <anthonyl@kodak.com> said:
Anthony> Has anyone written or know of a simple way to
Anthony> monitor a file, sleep for a few seconds and then
Anthony> check to see if the file has increased in length
Anthony> and if so, to read the newly added lines and pipe
Anthony> them into another file????!??
Try some things here:
http://reference.perl.com/query.cgi?sysadmin
tony
(another one :-)
------------------------------
Date: Tue, 03 Feb 1998 00:35:22 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
To: rclift@riscman.com
Subject: Re: NAWK to PERL conversion
Message-Id: <34D6AC9B.CBA6DEDA@coos.dartmouth.edu>
rclift@riscman.com wrote:
>
> I used the following script to do this with nawk:
>
> nawk '
> {
> field = $1
> string = "Name"
> if (field == string) {
> if ($NF > 3) {
> gsub(/\ /, "_", $0)
> gsub(/\_\=\_/, " = ", $0)
> sub(/\_*\_/, " ", $0)
> print $0 > "temp.mif"
> }
> else print $0 > "temp.mif"
> }
> else print $0 > "temp.mif"
> }' $SOURCE_MIF
>
> Does anyone know how to do this in perl?? If so, please email
> rclift@riscman.com as I do not check the usenet posting very often.
A mostly line by line conversion. There's probably a more Perlish way to do it.
I did remove the unnecessary temporary variables and tighten up the logic.
#!/usr/local/bin/perl -na
BEGIN {open(OUT, ">temp.mif") or die "Unable to open temp.mif: $!\n"}
if ($F[0] eq "Name" and @F > 3) {
s/\ /_/g;
s/_=_/ = /g;
s/__+/ /;
}
print OUT;
Chipmunk
------------------------------
Date: 3 Feb 1998 06:36:40 GMT
From: Tan Tong Kiat <tantongk@iscs.nus.edu.sg>
Subject: Perl Signals (Please Help)
Message-Id: <6b6dto$ljq5@id4.nus.edu.sg>
Hi,
I'm new to Perl and I'm now facing some problems with signals.
I'm writing a client program to handle 2 signals -- SIGIO and SIGALRM. I'm
using ualarm to raise a SIGALRM signal at a regular interval of 100ms. SIGIO
will be raised when a server program sends the client a UDP message. The
server will intermittently send the client messages.
When I tested the client program to handle one of the signals only,
everything works fine. However, when the client tries to handle both signals,
the client program works fine for about 5 mins or so, after which the client
hangs.
When servicing SIGIO, I block the SIGALRM signal. Similarly SIGIO is blocked
when I service SIGALRM. This is to prevent them from interrupting each other
when the signals are serviced.
I'm using Linux and perl version 5.004_56 built for i586-linux-thread.
What could possibly go wrong? Are there any alternatives I can use?
TIA.
--
Perl novice,
tk
------------------------------
Date: Tue, 03 Feb 1998 00:51:46 -0600
From: moneesha@plexustech.net
Subject: Perl-Msql interface
Message-Id: <886484694.515702799@dejanews.com>
hi, am facing a problem. I have Perl 5.004 ,Msql 2.0 and the PerlMsql
interface installed on my server. Dynamic loading of the Msql through the
Perl script is not happening..how could i do a static linking between the
two
Please suggest a way out!!!!!!
thanx
moneesha
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: Tue, 03 Feb 1998 17:55:19 +1100
From: Stephan Carydakis <steph@hotkey.net.au>
Subject: PROBLEM WITH gifs
Message-Id: <34D6BF57.5A93@hotkey.net.au>
Hi All,
I am teaching myself Perl from the apparantly legendary book
"Programming Perl" (vers 5). Its my first attemp at OOP and frankly i
dunno if i got enough brain cells, but I'm very much enjoying it, anyway
on to the problem.
I wrote a very simple script to send HTML back to browser. The HTML all
loads, but the images dont. Instead, the Windows default viewer for gifs
is spawned, and the images load there????
I had a friend access the script and the same happened. The images
loaded my end in the default viewer.
ANY SUGGESTIONS ????????
I'm using Win95[a] and a Netscape Fast Trak Server for my developing.
thanks!!!
________________________________
Stephan Carydakis
steph@hotkey.net.au
________________________________
------------------------------
Date: 03 Feb 1998 08:50:57 +0100
From: Remove xx to reply <xxTony.Curtis@vcpc.univie.ac.at>
Subject: Re: Problem with running perl scripts
Message-Id: <7xbtwpkty6.fsf@beavis.vcpc.univie.ac.at>
Re: Problem with running perl scripts, Janne
<janne.kallunki@tietogroup.com> said:
Janne> I have a problem with perl and apache server. When I
Janne> run perl script from a command line I have not any
Janne> problems. But if I try to run same script from
Janne> browser I got following error message to a apache
Janne> server log:
So it's a server setup problem; ask in a group dedicated to
the server type / platform you are using.
Also check http://www.boutell.com/ and your own
documentation for the server.
hth,
tony
------------------------------
Date: Tue, 03 Feb 1998 01:00:11 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: recursive regex?
Message-Id: <34D6B26B.13FF62C5@coos.dartmouth.edu>
Richard Caley wrote:
>
> In article <6b1o86$mt61@zinc.imation.com>, Mark Rostron (mr) writes:
>
> mr> am writing a parser and would like to use regex to easily decode nested
> mr> funcion calls - any ideas?
>
> Can't be done (at least generally). Regular expressions recognise
> regular languages and regular languages don't include recursive
> structures. Wouldn't put it past `them' to provide non-regular regular
> expressions in some future perl though :-).
Perl's regular expressions are already non-regular.
Think 'back-references'.
Chipmunk
------------------------------
Date: Tue, 03 Feb 1998 16:43:36 +1000
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: replacement for ls command?
Message-Id: <34D6BC98.DAC@ozemail.com.au>
[snip]
> To rephrase my original question, I'm looking for something like:
> @found=&ls ("$pattern");[snip]
use File::Find;
--
Cheers,
Ron Savage
Office: savage.ron.rs@bhp.com.au
Home (preferred): rpsavage@ozemail.com.au
------------------------------
Date: Tue, 03 Feb 1998 02:40:51 -0700
From: "Joseph N. Hall" <joseph@5sigma.com>
Subject: Re: replacement for ls command?
Message-Id: <34D6E5DC.1E5C90DD@5sigma.com>
<sigh>
Use the "glob" operator:
@files = glob "*.c *.h";
@files = <*.c *.h>; # alternatively
And, Larry, I know you think laziness is a virtue, but there's
whiny feeble laziness and crafty resource-saving laziness.
Guess which category your very frequently asked question falls into,
no matter how (or especially considering how) whinily you grovel.
Finally, it aggravates me when people talk about the 'ls' command
as if it were something used to produce a list of filenames.
-joseph
Ron Savage wrote:
>
> [snip]
> > To rephrase my original question, I'm looking for something like:
> > @found=&ls ("$pattern");[snip]
>
> use File::Find;
--
Joseph N. Hall, prop., 5 Sigma Productions mailto:joseph@5sigma.com
Author, Effective Perl Programming . . . . . http://www.effectiveperl.com
Perl Training . . . . . . . . . . . . . . . http://www.perltraining.com
------------------------------
Date: Mon, 02 Feb 1998 23:06:55 -0600
From: thowland@vsicom.com
Subject: Re: solution for multiline comments???
Message-Id: <6b68lg$4r0$1@nnrp2.dejanews.com>
In article <34D5F5FE.B87DF4D5@houston.Geco-Prakla.slb.com>,
Dave Barnett <barnett@houston.Geco-Prakla.slb.com> wrote:
>
> Bjvrn Nilsson wrote:
> >
> > Hi all!
> >
> > Has anyone figured out how to in a convienient way do mulitline comments
> > a la C, Java etc.
> > OK, I know that one solution is to write a perl snippet that looks for
> > some special tags (e.g. startcomm and endcomm) and than comment
> > everything out in between those lines.
> >
> > But is there some kind of simpler solution, where I don't have to
> > process a script with a script?
> >
> > Bjvrn
> It's not terribly elegant, but how about a here document:
> #!/usr/local/bin/perl -w
> #
> $junk = ""; # to keep perl from complaining about typos
> $junk = <<EOF;
> These are just some random comments.
> They span multiple lines, and don't
> end until I put EOF on a line by
> itself.
> EOF
> print "Hello\n";
> __END__
>
> Should print out "Hello", without so much as a peep about the here
> document.
>
> HTH.
>
> Dave
Have you considered using POD?
#!/usr/bin/perl
print "hello ";
=head1
My comments start here
They go for a while
Then they stop
=cut
print " world\n";
Just a thought,
Tim
>
> --
> "Security through obscurity is no security at all."
> -comp.lang.perl.misc newsgroup posting
>
> ------------------------------------------------------------------------
> * Dave Barnett U.S.: barnett@houston.Geco-Prakla.slb.com *
> * DAPD Software Support Eng U.K.: barnett@gatwick.Geco-Prakla.slb.com *
> * Schlumberger Geco-Prakla (281) 596-1434 (Office Number) *
> * 1325 S. Dairy Ashford (281) 596-1807 (Fax) *
> * Houston, TX 77077 *
> ------------------------------------------------------------------------
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading
------------------------------
Date: Tue, 03 Feb 1998 01:03:14 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: Re: solution for multiline comments???
Message-Id: <34D6B322.9FB925F0@negia.net>
Michael Wang wrote:
>
> Dave Barnett <barnett@houston.Geco-Prakla.slb.com> wrote:
> >It's not terribly elegant, but how about a here document:
> >#!/usr/local/bin/perl -w
> >#
> >$junk = ""; # to keep perl from complaining about typos
> >$junk = <<EOF;
> > These are just some random comments.
> > They span multiple lines, and don't
> > end until I put EOF on a line by
> > itself.
> >EOF
> >print "Hello\n";
>
> I think the problems with here document:
> 1. All the lines get processed and hence wasting CPU time
> 2. There might be errors like in the here document, like $something
> not defined.
>
> if ( 0 ) {
> put
> comments
> here
> }
> is a better solution.
i think this has its own problems, try:
if (0) {
$test
this
}
i get a 'Bareword found where . . .' compilation error, and also get
warnings from -w after removing 'this'. i don't think either of
your disadvantages above are overcome here. personally i would
take the here doc out of these two, but still old fashioned #'s
as my first choice.
--
dan boorstein
------------------------------
Date: Tue, 03 Feb 1998 00:45:27 -0500
From: Tom Roddy <tomroddy@netrition.com>
To: chip@pobox.com
Subject: Re: tainted socket
Message-Id: <34D6AEF7.66D2529C@netrition.com>
Chip Salzenberg wrote:
>
> According to Tom Roddy <tomroddy@netrition.com>:
> >I am trying to write a Perl socket (client) script to retrieve
> >an HTML page from a web server. This script must run
> >setuid so it must pass taint checks. If I "Use socket;",
> >and connect to a socket, I get an "Insecure dependency".
>
> Well, I'm afraid that's not enough info.
>
> I suggest you read the perlsec man page and then try to figure
> out what data are tainted and why.
I read perlsec.
The tainted code is apparently within Socket.pm - in AUTOLOAD -
which is hit with my call to connect().
I notice the client socket examples in the O'Reilly Perl
book do not activate -T for taint checking but the server socket
examples do... I imagine this is because of the same reason I
can't get it to work.
-Tom
------------------------------
Date: Tue, 03 Feb 1998 00:56:29 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: tainted socket
Message-Id: <34D6B18D.99245E3C@coos.dartmouth.edu>
Tom Roddy wrote:
>
> I am trying to write a Perl socket (client) script to retrieve
> an HTML page from a web server. This script must run
> setuid so it must pass taint checks. If I "Use socket;",
> and connect to a socket, I get an "Insecure dependency".
>
> Any way around this?
I have a Perl server script running under taint checking, and have
not had any problems with Insecure dependencies. Must be something
specific you're doing. Perhaps you could provide a short piece of
code which demonstrates your problem.
Note: The message for "Insecure dependency" should tell you
the function and line number where the error occured.
Chipmunk
------------------------------
Date: Tue, 03 Feb 1998 07:05:35 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Want to determine the subnet networks from a network:subnet combo.
Message-Id: <34d6b3af.524144494f47414741@radiogaga.harz.de>
John Porter (jdporter@min.net) wrote:
: Here's short and sweet solution.
Beware, however, that this won't work if the netmask has "holes" in it,
e.g. 255.255.216.0. (I know this generally is a Bad Thing(TM) to do, but
it's perfectly legal).
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.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 1794
**************************************