[10132] in Perl-Users-Digest
Perl-Users Digest, Issue: 3725 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 16 03:07:49 1998
Date: Wed, 16 Sep 98 00:00:37 -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 Wed, 16 Sep 1998 Volume: 8 Number: 3725
Today's topics:
Re: A question about perl compiler... <nguyend7@msu.edu>
Re: Any Perl 5.005 binary build for win32? (Jim Weisgram)
Re: difference between 'my' and 'local'? (Mark-Jason Dominus)
Re: Gratuitous warning: Deep Recursion <mgregory@asc.sps.mot.com>
Help with Perl problem mike @debtware.co.uk
Re: how safe is xor encryption ? (Mark-Jason Dominus)
Re: how safe is xor encryption ? <eashton@bbnplanet.com>
Re: how safe is xor encryption ? <eashton@bbnplanet.com>
Re: how safe is xor encryption ? (Mark-Jason Dominus)
Re: how safe is xor encryption ? (Ronald J Kimball)
Interogating a script for its methods <aravind@genome.wi.mit.edu>
Re: MIME and SMTP helphand@pacbell.net
Re: Perl (Ronald J Kimball)
Re: print statement in perl (Ronald J Kimball)
Regex strange behavior filippomorelli@my-dejanews.com
Re: Regex strange behavior (Sam Holden)
Re: Shopping Cart Systems <eashton@bbnplanet.com>
Re: Shopping Cart Systems (Sam Holden)
Size of a Long Int? (Chuck Gadd)
Stripping Trailing Spaces - How? (Ralph Freshour)
Re: Stripping Trailing Spaces - How? <nguyend7@msu.edu>
Re: Stripping Trailing Spaces - How? (Larry Rosler)
Re: Stripping Trailing Spaces - How? <garry@america.net>
Re: Stripping Trailing Spaces - How? <ajohnson@gpu.srv.ualberta.ca>
Turning perlpod into man documentation (Gregory Marton)
What's the meaning of the error message? hup@addall.com
Re: Who posts original posts on CLPM? (Ronald J Kimball)
Re: Who posts original posts on CLPM? (Mark-Jason Dominus)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 16 Sep 1998 04:03:27 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: A question about perl compiler...
Message-Id: <6tndaf$92u$1@msunews.cl.msu.edu>
In comp.lang.perl.misc GEMINI <dennis@info4.csie.nctu.edu.tw> wrote:
: I have installed a alpha-3 version of perl compiler module
: for perl 5.003 on linux. It can successfully generate a .C file for my
: perl script. I'd like to know if this .C file can be carried to
: my win95 platform (with Perl and MS VC++ compiler, but
: no compiler module) and compile it to an executable?
: thanks.
A really good way to find out is to try it.
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Wed, 16 Sep 1998 03:57:44 GMT
From: jweisgram@hotmail.com (Jim Weisgram)
Subject: Re: Any Perl 5.005 binary build for win32?
Message-Id: <3605367b.280625799@news.teleport.com>
dennis@info4.csie.nctu.edu.tw (GEMINI) wrote:
>Hi all,
> The newest binary build for win32 that I can find is 5.004,
>a binary distribution built by Borland C. I've tried to
>make one from the 5.005_02 source but got a failure.
>I am wondering if some one has made it? where can I get it?
>thanks.
http://www.ActiveState.com/
As of 5.005 ActiveState Perl and "Standard" Perl are combined and available at
the above URL.
--
All opinions expressed are mine and not my employers (but they ought to be)
Jim Weisgram
Oregon Department of Transportation
------------------------------
Date: 16 Sep 1998 00:55:26 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: difference between 'my' and 'local'?
Message-Id: <6tngbu$1sn$1@monet.op.net>
In article <35fd6cb5.195855375@nntp.best.com>,
Kevin Hawkins <jedihawk@mail.com> wrote:
>What's the difference between 'my' and 'local'?
I'll tell you if you promise not to laugh:
`my' makes a local variable.
`local' doesn't.
Really true.
What `local' does is to save the current value of a *global* variable,
and arrange that the saved value will be restored at the end of the block.
>Would it be a better idea to use 'local', like this:
No, it's almost always a worse idea. As a rule of thumb:
Always use `my'. Never use `local'.
There are some cases where `my' doesn't work, so this is only an
approximate rule. But it's a good approximation.
`local' was easier to implement, and appeared in perl 4. Then in perl
5 they did it right, and the result was `my'.
`my' has a shorter name than `local' to encourage you to use it
instead of `local'.
>Thanks for your time.
I live only to serve.
------------------------------
Date: 16 Sep 1998 09:51:45 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: Gratuitous warning: Deep Recursion
Message-Id: <r8g1dsdi06.fsf@asc.sps.mot.com>
Hans Mulder <hansmu@xs4all.nl> writes:
> Martin Gregory <mgregory@asc.sps.mot.com> wrote:
>
> >I am getting this 'deep recursion' warning message, about which
> >perldiag tells me:
[]
> >Does this message ever really help anyone,
>
> It does: it helps people who did not intend to recurse. Such
> people usually recurse inifinitely deep. If it weren't for
> this warning; they'd probably never figure out what hit them.
> >or does it only hinder people like me who happen
> >to have a job that calls for deep recursion and now have to grapple
> >with whether to take out -w or placate users about these warning
> >messages?
>
> A third option would be to set up a $SIG{__WARN__} handler
> to filter out this particular warning.
Now _that_ is a good suggestion.
I hadn't woken up and realised that -w warnings went thought $SIG{__WARN__}!
Thanks!
Martin.
------------------------------
Date: Wed, 16 Sep 1998 05:10:56 GMT
From: mike @debtware.co.uk
Subject: Help with Perl problem
Message-Id: <35ff46d5.1266349@news.netkonect.co.uk>
Can anyone kelp me please. I am trying to write a perl program where I
pass two arguments on then command line. The first is the input file
the second is the output file.
The command line reads:
perl myprog.pl filename1 filename2
In the code I have:
$file1 = @ARGV[0]
$file2 = @ARGV[1]
open (InFile, $file1);
open (OutFile, $file2);
When I run it OutFile will not open. I am running perl 5 under dos.
Any suggestions please.
Can you reply by e-mail to mike@jbcs.co.ok
------------------------------
Date: 15 Sep 1998 23:57:42 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: how safe is xor encryption ?
Message-Id: <6tncvm$1j7$1@monet.op.net>
>say, a cracker has somehow reached to the database, full of credit card
>numbers encrypted in that manner.
1. If the cracker knows any one entire credit card number, perhaps
because they inserted it themselves, they can easily figure out
what your secret pad is, and decrypt all the other numbers.
2. A cracker who has gotten into the database has probably also gotten
into your source code.
>well, do all what i've talked about make sense? anything wrong you see?
The whole exercise seems rather futile.
------------------------------
Date: Wed, 16 Sep 1998 04:04:18 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: how safe is xor encryption ?
Message-Id: <35FF3660.C3F29C3@bbnplanet.com>
Mark-Jason Dominus wrote:
> The querent is talking about storing the credit card numbers in a
> database in encrypted format, as an extra protection in case the
> database file falls into the wrong hands. I don't see what SSL has
> to do with it.
The 'querant' I assumed was taking the cc info over the web, if not, my
mistake. Either way, I deal with "e-commerce" jockeys every day whom I
could take advantage of every day. Hello, does anyone realise the
seriousness of credit cards on the net when so many "webmasters" still
don't understand why 777 isn't an acceptable mode? Even encrypted it can
be compromised. If it is on-line, it is insecure. There is no such thing
as on-line security when it comes to financial data. At least not what I
have observed. There are too many amateurs thinking as you do. Take my
point.a
e.
"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver
------------------------------
Date: Wed, 16 Sep 1998 04:10:52 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: how safe is xor encryption ?
Message-Id: <35FF37EA.135A0F30@bbnplanet.com>
Mark-Jason Dominus wrote:
> 1. If the cracker knows any one entire credit card number, perhaps
> because they inserted it themselves, they can easily figure out
> what your secret pad is, and decrypt all the other numbers.
>
> 2. A cracker who has gotten into the database has probably also gotten
> into your source code.
A light dawns.
> The whole exercise seems rather futile.
Bingo. Not futile, but certainly enlightening. Please, with as many
people I have taken issue with over CC security, you don't even want to
start with me. _NOT_ for the beginners. GRRRR. Also, 1 is not always
equal to 2 but 2 is certainly leading to 1. :)
e.
"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver
------------------------------
Date: 16 Sep 1998 00:19:08 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: how safe is xor encryption ?
Message-Id: <6tne7s$1nf$1@monet.op.net>
In article <35FF3660.C3F29C3@bbnplanet.com>,
Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com> wrote:
>The 'querant' I assumed was taking the cc info over the web, if not, my
>mistake.
Yes, it was your mistake.
Perhaps he was taking credit card numbers over the web; perhaps not.
If he was, perhaps he was using strong encryption methods to tranfer
them. I don't know, and neither do you; the question was about
something else.
> There are too many amateurs thinking as you do.
I'm not sure what you mean to imply here. If you meant to say that
any amateur would think that you had missed the point of the question,
then I agree.
Since that was the only thing I said, I don't know what else you
might have meant.
------------------------------
Date: Wed, 16 Sep 1998 00:49:34 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: how safe is xor encryption ?
Message-Id: <1dffalg.xn7an31ktucowN@bay1-474.quincy.ziplink.net>
<beyret@my-dejanews.com> wrote:
> I am about to write a simple script to encrypt/decrypt credit card numbers
> using xor and a key supplied by credit card owner. I wanted to learn your
> thoughts about it:
What exactly is your Perl question?
If I'm not mistaken, xor encryption could be implemented in any
programming language. Thus, this is not a Perl issue at all. Try a
security or encryption newsgroup.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Tue, 15 Sep 1998 20:05:41 -0400
From: Aravind Subramanian <aravind@genome.wi.mit.edu>
Subject: Interogating a script for its methods
Message-Id: <35FF00D5.401F2A6E@genome.wi.mit.edu>
In some_module_method I can figure out the name of the calling *script*
and the name of the calling *method* within it by checking caller().
My question is: Is there a way (without parsing) to get a list of the
names of ALL methods in the calling script?
I'd much appreciate any suggestions,
Thanks
aravind
------------------------------
Date: Wed, 16 Sep 1998 04:35:03 GMT
From: helphand@pacbell.net
Subject: Re: MIME and SMTP
Message-Id: <35ff3c4f.693648235@news.pacbell.net>
[Courtesy copy e-mailed}
On Mon, 14 Sep 1998 15:50:32 GMT, john.kelly@citicorp.com (John Kelly)
wrote:
>My question is can I somehow use the two together, meaning generate
>a mime body parts and send it through the SMTP interface?
>I have tried several different ways of doing this and it appears
>that I need to set up the mail header to contain several mime header
>information
[snip]
>There doesn't seem to be a way in the NET::SMTP to add headers.
>
I've used the SMTP and MIME modules to successfully handle this
using code like this...
$smtp = Net::SMTP->new('yourmailhost');
$smtp->mail("your.machine");
$smtp->to("you\@anywhere.com");
$smtp->data();
$smtp->datasend("From: met\@anywhere.com\n");
$smtp->datasend("To: you\@anywhere.com\n");
$smtp->datasend("Subject: A Test Message using PERL with a MIME
attachment\n");
$smtp->datasend("MIME-Version: 1.0\n");
$smtp->datasend("Content-Type: multipart/mixed;
boundary=unique-boundary-1\n");
$smtp->datasend("\n");
$smtp->datasend("This is the preamble area of a multipart
message.\n");
$smtp->datasend("Mail readers that understand multipart format\n");
$smtp->datasend("should ignore this preamble.\n");
$smtp->datasend(" \n");
$smtp->datasend("If you are reading this text, you might want to\n");
$smtp->datasend("consider changing to a mail reader that
understands\n");
$smtp->datasend("how to properly display multipart messages.\n");
$smtp->datasend(" \n");
$smtp->datasend("--unique-boundary-1\n");
$smtp->datasend("Content-Type: application/octet-stream;
name=\"$fn\"\n");
$smtp->datasend("Content-Transfer-Encoding: base64\n");
$smtp->datasend("Content-Disposition: attachment;
filename=\"$fn\"\n");
$smtp->datasend("\n");
$smtp->datasend(MIME::Base64::encode($filedata));
$smtp->datasend("--unique-boundary-1--\n");
$smtp->dataend();
$smtp->quit;
Basically, you create the required mime headers using the datasend
method. In the code snippet above, I had already slurped the file
into $filedata and put the filename into $fn.
This worked for me, but I must admit that I'm not really clear on
the "--unique-boundary" specs and how to really use them when you have
multiple MIME parts. The RFC's left my head spinning <g>.
Hope this helps point you in the right direction.
Scott
--------
Delta Performance Group, "Achieving the Competitive Edge"
http://www.deltagrp.com/
------------------------------
Date: Wed, 16 Sep 1998 00:49:35 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Perl
Message-Id: <1dffaq0.g9866n1oo4gpqN@bay1-474.quincy.ziplink.net>
<kazman@my-dejanews.com> wrote:
> if ($_ = /^<.*>/ .. /(<P><IMG SRC=\"/imagesT/area_of_expertise.gif\"
^^^ ^^^
> HEIGHT=25 WIDTH=427 ALT=\"Area Of Expertise Key
> Words\">)/([^\"]*)/<P><CENTER><A HREF=\"#top\"><IMG
^^^ ^^^
> SRC=\"/imagesT/top.gif\")/i {
^^^ ^^^
You're trying to use unescaped delimiter characters within your regex.
Naughty naughty!
Try using a different delimiter character, such as:
m!(<P><IMG SRC=\"/imagesT/area_of_expertise.gif\" (etc.) !i
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 16 Sep 1998 00:49:36 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: print statement in perl
Message-Id: <1dffaxv.yqgjh81iy6yx9N@bay1-474.quincy.ziplink.net>
Tien Pham <tpham@ee.gatech.edu> wrote:
> Does anybody know how to fix this (passing and printing 2-dimensional
> arrays)?
Read the documentation. perllol ["Lists Of Lists"] has a nice big
section entitled "Access and Printing". I don't suppose it would be
helpful in your current situation?
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Wed, 16 Sep 1998 04:46:08 GMT
From: filippomorelli@my-dejanews.com
Subject: Regex strange behavior
Message-Id: <6tnfqg$rhi$1@nnrp1.dejanews.com>
I'm trying to match tags in a document and am having no luck:
For example, say you want to match <FOO_*> in a line that contains
<FOO_BAR></FOO_BAR>
$tag = '<FOO';
$line = '<FOO_BAR></FOO_BAR>junk';
$line =~ /($tag.*)>/;
print "Found [$1]\n";
This will print out, [<FOO_BAR></FOO_BAR]. What I want is [<FOO_BAR]. It
seems that .* matches all the characters up until the last occurance of the
remaining expression (which is the above case, is simply a greater than
character '>').
I can not finding any explanation in Larry Wall's book or on the newsgroup of
how to match n or more non-whitespace up until the first instance (rather than
the last) of a specific character. The above results, IMHO, are counter
intuitive.
Thanks for the help...
Filippo
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: 16 Sep 1998 06:20:59 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Regex strange behavior
Message-Id: <slrn6vum6b.nei.sholden@pgrad.cs.usyd.edu.au>
On Wed, 16 Sep 1998 04:46:08 GMT, filippomorelli@my-dejanews.com
<filippomorelli@my-dejanews.com> wrote:
>I'm trying to match tags in a document and am having no luck:
>
>For example, say you want to match <FOO_*> in a line that contains
><FOO_BAR></FOO_BAR>
>
>$tag = '<FOO';
>$line = '<FOO_BAR></FOO_BAR>junk';
>
>$line =~ /($tag.*)>/;
>print "Found [$1]\n";
>
>This will print out, [<FOO_BAR></FOO_BAR]. What I want is [<FOO_BAR]. It
>seems that .* matches all the characters up until the last occurance of the
>remaining expression (which is the above case, is simply a greater than
>character '>').
Just as it is documented to do...
>
>I can not finding any explanation in Larry Wall's book or on the newsgroup of
>how to match n or more non-whitespace up until the first instance (rather than
>the last) of a specific character. The above results, IMHO, are counter
>intuitive.
>
>Thanks for the help...
I've got an idea : why don't read the documentation that comes with perl...
I guess 'perldoc perlre' would be useful since it's a regular expression you are
asking about.
Well what do you know the answer is on page 3.
perldoc perlfaq6 has an answer as well.
And no I'm not going to give you the answer since you can look it up yourself,
and anyway TMTOWTDI.
--
Sam
Another result of the tyranny of Pascal is that beginners don't use
function pointers.
--Rob Pike
------------------------------
Date: Wed, 16 Sep 1998 03:55:16 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Subject: Re: Shopping Cart Systems
Message-Id: <35FF3441.845A2128@bbnplanet.com>
> Strangely enough some people don't mind letting other people see source code,
> some people don't even mind giving things away for free.
Well, duh, neither do I, but I don't like people posting for something
that a) has been around since 1991 and b) could be found on most free
sites on the net. Call me cranky, but the 'I'm too tired to write my own
code' has gotten really old lately.
I would slash a vein to see someone post something evocative enough to
get me to post some code. I like to see people try. Maybe I'm a Jesuit
in a womans' body.
e.
"All of us, all of us, all of us trying to save our immortal souls, some
ways seemingly more round-about and mysterious than others. We're having
a good time here. But hope all will be revealed soon." R. Carver
------------------------------
Date: 16 Sep 1998 06:13:54 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Shopping Cart Systems
Message-Id: <slrn6vulp1.nei.sholden@pgrad.cs.usyd.edu.au>
On Wed, 16 Sep 1998 03:55:16 GMT, Elaine -HappyFunBall- Ashton
<eashton@bbnplanet.com> wrote:
>> Strangely enough some people don't mind letting other people see source code,
>> some people don't even mind giving things away for free.
>
>Well, duh, neither do I, but I don't like people posting for something
>that a) has been around since 1991 and b) could be found on most free
>sites on the net. Call me cranky, but the 'I'm too tired to write my own
>code' has gotten really old lately.
In which case a better response in the first place would have been something
like:
'This is the wrong place to ask questions like this, try searching the web.'
or possibly :
'Go and look yourself you complete waste of bandwidth...'
or even :
'Go away you ignorant moron, and RTFM.'
But to lie seems a little pointless.
>I would slash a vein to see someone post something evocative enough to
>get me to post some code. I like to see people try. Maybe I'm a Jesuit
>in a womans' body.
Guess you must be bleeding then :
--start---
Message-ID: <35ED6E6D.762EA2AD@bbnplanet.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
NNTP-Posting-Date: Wed, 02 Sep 1998 12:22:26 EDT
References: <35ecbd2a.0@news1.starnetinc.com>
X-Trace: burlma1-snr1.gtei.net 904753346 171.78.4.43 (Wed, 02 Sep
1998 12:22:26 EDT)
Subject: Re: how to generate random password
Date: 02 Sep 1998 00:00:00 GMT
From: Elaine -HappyFunBall- Ashton <eashton@bbnplanet.com>
Organization: BBN/GTEI/Bell Atlantic
Newsgroups: comp.lang.perl.misc
heres an example of how you might do it. enjoy.
e.
########################################################################
# Name: randomPass [length]
#
# Purpose: generate a random password of 'length' characters,
# default is 8.
#
# Arguments:
# length - the length of the random password to generate - default is 8
#
# Returns:
# passwd - the random password string generated
#
########################################################################
sub randomPass {
my $len = shift;
my $passwd;
my @charset = split //, '23456789ABCDEFGHIJKLMNPQRSTUVWXYZ';
length ($len) < 1 and $len=8;
do {
$passwd = '';
for ($i = 0; $i < $len; $i++) {
strapp \$passwd, $charset[rand($#charset)];
}
} until validPassword($passwd);
$passwd;
}
--end---
--
Sam
You can blame it all on the internet. I do...
--Larry Wall
------------------------------
Date: Wed, 16 Sep 1998 05:53:55 GMT
From: cgadd-NO@SPAM-cfxc.com (Chuck Gadd)
Subject: Size of a Long Int?
Message-Id: <35ff5163.15523241@news.csd.net>
Please help!
Here's a short perl script:
#!/usr/bin/perl
$test = chr(255).chr(255).chr(255).chr(255);
$a = unpack("l",pack("L",unpack("V",$test )));
print "signed = $a\n";
$a = unpack("L",pack("L",unpack("V",$test )));
print "unsigned = $a\n";
When run from Perl 5.003 on a DEC 8400 running Digital Unix , it
returns:
signed = -1
unsigned = 4294967295
But when run from Perl 5.004 on the same machine, it returns:
signed = 4294967295
unsigned = 4294967295
Why??? The signed is coming back as an Unsigned! Is this a perl
bug, or could it be due to the way the new Perl was compiled on the
DEC? Where should I start digging? Is a Long Int always 32 bits, or
is it machine dependant?
Chuck Gadd
Director of Software Development, Cyber FX Communications.
Remove the -NO SPAM- from my email address to send me e-mail.
------------------------------
Date: Wed, 16 Sep 1998 03:42:51 GMT
From: ralph@primemail.com (Ralph Freshour)
Subject: Stripping Trailing Spaces - How?
Message-Id: <35ff3381.9364733@news.earthlink.net>
How would I strip trailing spaces from a string?
I'm using the following to strip leading spaces:
if ($mVar =~ /^\ +/) #strip any leading spaces
{
$mVar = $'; #leading spaces stripped off
}
But I cannot seem to figure out how to strip trailing spaces.
Thanks for any help
Ralph
------------------------------
Date: 16 Sep 1998 04:19:26 GMT
From: Dan Nguyen <nguyend7@msu.edu>
Subject: Re: Stripping Trailing Spaces - How?
Message-Id: <6tne8e$92u$2@msunews.cl.msu.edu>
Ralph Freshour <ralph@primemail.com> wrote:
: How would I strip trailing spaces from a string?
try something like this
s/^\s*//; #for leading whitespace
s/^ *//; #for leading spaces only
: I'm using the following to strip leading spaces:
: if ($mVar =~ /^\ +/) #strip any leading spaces
: {
: $mVar = $'; #leading spaces stripped off
: }
It works, but that's what s/// is for.
: But I cannot seem to figure out how to strip trailing spaces.
s/\s*$//;
A good book to learn basic regex's is Tom's and Randal's "Learning
Perl"
-dan
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Tue, 15 Sep 1998 21:21:57 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Stripping Trailing Spaces - How?
Message-Id: <MPG.1068dcbd76e1d87398985b@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <35ff3381.9364733@news.earthlink.net> on Wed, 16 Sep 1998
03:42:51 GMT, Ralph Freshour <ralph@primemail.com> says...
> How would I strip trailing spaces from a string?
Would you believe that this is a Frequently Asked Question? Did you look
among the Frequently Asked Questions before posting it?
perlfaq4: "How do I strip blank space from the beginning/end of a
string?"
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 16 Sep 1998 04:48:36 GMT
From: Garry Williams <garry@america.net>
Subject: Re: Stripping Trailing Spaces - How?
Message-Id: <35FF436C.D63560D0@america.net>
Try this instead:
$mVar =~ s/^ +//; # Trash leading spaces
$mVar =~ s/ +$//; # Trash trailing spaces
If you don't care about the "kind" of white space, you usually see
something like this instead:
$mVar =~ s/^\s+//;
$mVar =~ s/\s+$//;
The points are that the space character is *not* a metacharacter, so it
doesn't have to be protected with the backslash and the s/// operator
substitutes directly so you don't have to do it by hand with $' and a
match operator.
You really should read about matching (m//) and substitutiing (s///) in
man perlop and read about regular expressions in man perlre. It's all
there, if you check...
Hope this helps.
-Garry Williams
Ralph Freshour wrote:
>
> How would I strip trailing spaces from a string?
>
> I'm using the following to strip leading spaces:
>
> if ($mVar =~ /^\ +/) #strip any leading spaces
> {
> $mVar = $'; #leading spaces stripped off
> }
>
> But I cannot seem to figure out how to strip trailing spaces.
>
> Thanks for any help
>
> Ralph
------------------------------
Date: Wed, 16 Sep 1998 01:34:48 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Stripping Trailing Spaces - How?
Message-Id: <35FF5C08.6728E986@gpu.srv.ualberta.ca>
Ralph Freshour wrote:
!
! How would I strip trailing spaces from a string?
!
! I'm using the following to strip leading spaces:
!
! if ($mVar =~ /^\ +/) #strip any leading spaces
! {
! $mVar = $'; #leading spaces stripped off
! }
!
! But I cannot seem to figure out how to strip trailing spaces.
there is a standard answer to this Oft Recurring Query (ORQ)
located in the standard place for ORQ's to which the following
ornithological quack impediment offers a tiny hint:
#!/usr/bin/perl -wl
$_="faufakfacfadfas"; # some arbitrary string.
$not=q=q+q-q-+=; # q plus q minus q-+= equals one q right?
s$d|u|c|k|s\$$\$not$geese; # seems fowl.
s+.ay?.\++print uc $&+e; #<ducking>...(sic)
regards
andrew
------------------------------
Date: 16 Sep 1998 00:14:48 -0400
From: gremio@Glue.umd.edu (Gregory Marton)
Subject: Turning perlpod into man documentation
Message-Id: <6tndvo$bc6@latte.eng.umd.edu>
Thank you both for responding. I have gotten it to work, finally, though
the I<> doesn't seem to get interpreted at all.
Thanks again,
Gremio
From: Russ Allbery
Greg Marton <gremio@Glue.umd.edu> writes:
> I have a little perl utility I wrote, and I wrote some pod to go along
> with it. When I do "pod2man myscript | nroff -man | more" I get a
> roughly man-like and fairly decent documentation. I have two questions:
> 1) how do I go about making it so that I can type "man myscript" and
> this documentation would come up? (likewise, how would I go about
> distributing the script with this man documentation?)
pod2man myscript > myscript.1 and then put myscript.1 in the appropriate
directory for man pages on your system. That's usually something like
/usr/local/man/man1, /usr/man/man1, /usr/share/man/man1, or something
along those lines.
> 2) how do you underline your key words, like parameters, so they stand
> out, as in other man pages?
This is harder; basically, pod2man has some ideas of its own about what
POD elements should get what markup. On some systems, that happens to
coincide with the markup that system uses for other man pages, and on some
systems it doesn't. Unfortunately, there's very little uniformity of
convention for man pages for pod2man to aim at. :/
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
From: "Matthew O. Persico"
Greg Marton wrote:
>
> 1) how do I go about making it so that I can type "man myscript" and this
> documentation would come up? (likewise, how would I go about
> distributing the script with this man documentation?)
two solutions:
1) Put it in a directory normally read by man. That is /usr/local/man.
Since it is a program, it should reside in man1 under this directory.
2) Put it in /usr/local/lib/perl5/man/man1 and hope the end users have
added that to the MANPATH variable.
> 2) how do you underline your key words, like parameters, so they stand
> out, as in other man pages?
I think that the underlining is a crude attempt for the terminal to do
italics. Use the I<> syntax around the thing you want to underline.
--
Get "The Perl Cookbook"
Christansen and Torkington.
O'Reilly. ISBN 1-56592-243-3
FAQ on serious steriods!
------------------------------
Date: Wed, 16 Sep 1998 05:22:31 GMT
From: hup@addall.com
Subject: What's the meaning of the error message?
Message-Id: <6tnhuo$tos$1@nnrp1.dejanews.com>
Hi,
I get a error message in my Parallel User Agent module program:
Database handle destroyed without explicit disconnect at
/usr/lib/perl5/site_perl/LWP/Parallel/Protocol.pm line 218.
I just don't understand does PUA do anything with database?
and why does database handle do anything with PUA?
I have Linux, 5.004_04, LWP::Parallel_2.36, MySQL DBI.
Any idea how to fix it?
In my program, I find my parallel searching result are very unreliable,
use the same code, same configuaration(hardware,url and network) search for
several time, it give me quite a lot of different result. Does anybody
have the same experience? or just the way I am writing is buggy?
I did study http://www.stonehenge.com/merlyn/WebTechniques/col27.html,
(where I find a bug, either the example or PUA, PUA sometime
return 0 byte at the first return. We can't merely rely on
length($return_data)==0 as exit condition :( )
I don't think I could find any other better example. Does anybody can
give me other URL for the example? Either PUA or PWGng are welcome :)
----------------------------------------------------------------------
AddALL is a books searching and price comparison meta search engine.
The free service find books and compare prices among major bookstores.
Please visit http://www.addall.com to save your Time and Money.
-- Chai-Hup Chen hup@addall.com --------------------------------------
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Wed, 16 Sep 1998 00:49:37 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Who posts original posts on CLPM?
Message-Id: <1dffbav.62rew8100z57yN@bay1-474.quincy.ziplink.net>
Larry Rosler <lr@hpl.hp.com> wrote:
> How about the ridiculous assumptions that the choice of a newsreader
> correlates with the choice of a primary programming environment, and that
> either correlates with programming experience or philosophy? This thread
> can lead nowhere except to perpetuate prejudicial stereotypes.
Oh sure, that's just what a Windows luser would say...
P.S. Big big big big :-) !
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 16 Sep 1998 01:06:53 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Who posts original posts on CLPM?
Message-Id: <6tnh1d$1ti$1@monet.op.net>
In article <slrn6vuad7.gh.asher@localhost.localdomain>,
Asher <asher@magicnet.net> wrote:
>Clearly, the program cannot penetrate a user's motives for using any
>particular newsreader or operating system.
Maybe we should encourage people to include new headers in their articles:
X-Posting-Motive: desire to freeload
X-Posting-Motive: too stupid to read the manual
X-Posting-Motive: wants to show off in public
X-Posting-Motive: going through caffeine withdrawal
X-Posting-Motive: deep-seated feelings of inadequacy
X-Posting-Motive: trying to impress Tom Christiansen
X-Posting-Motive: procrastinating on overdue project
X-Posting-Motive: alternative to filing tax forms
X-Posting-Motive: was abused by parents
X-Posting-Motive: poster is drunk
X-Posting-Motive: pure laziness
X-Posting-Motive: taunting Abigail
X-Posting-Motive: up past bedtime
X-Posting-Motive: nothing good on TV
X-Posting-Motive: shameless self-aggrandizement
X-Posting-Motive: persistent despair
------------------------------
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 3725
**************************************