[18063] in Perl-Users-Digest
Perl-Users Digest, Issue: 223 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 6 14:06:15 2001
Date: Tue, 6 Feb 2001 11:05:20 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981486319-v10-i223@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 6 Feb 2001 Volume: 10 Number: 223
Today's topics:
Re: "Average of List of Numbers" by Abigail <bernie@fantasyfarm.com>
Re: Call .ksh from perl (Martin Vorlaender)
Check for no value? <vivekvp@spliced.com>
Re: Convert from base 10 to hex (John Joseph Trammell)
Re: Convert from base 10 to hex <leekembel@hotmail.com>
Re: Convert from base 10 to hex (Rudolf Polzer)
Re: Convert from base 10 to hex <Stephen.Mayer@oracle.com>
er, how? <ducateg@info.bt.co.uk>
Re: er, how? <ducateg@info.bt.co.uk>
Re: er, how? tigra@sky.deep.ru
Re: getting line number n of a file (Craig Berry)
Re: Help with < <bernie@fantasyfarm.com>
Re: How to tell which Perl is running (Csaba Raduly)
Re: How to tell which perl is running? <mischief@velma.motion.net>
Re: How to tell which perl is running? <lynn@swcp.com>
Re: How to tell which perl is running? <uri@sysarch.com>
Re: Is scalar a float, int or string? (Rudolf Polzer)
Re: Is scalar a float, int or string? (Abigail)
Re: Is scalar a float, int or string? <occitan@esperanto.org>
Re: Is scalar a float, int or string? <thoren@southern-division.com>
Re: JAPH <godzilla@stomp.stomp.tokyo>
Re: JAPH (Rudolf Polzer)
Re: MSIE, XML and Accents <lenssen@hitnet.rwth-aachen.de>
Need Help Checking IP Address Syntax w/ PERL? <webbgroup@my-deja.com>
Re: Need Help Checking IP Address Syntax w/ PERL? (Rudolf Polzer)
Re: Need Help Checking IP Address Syntax w/ PERL? egwong@netcom.com
Re: Need Help Checking IP Address Syntax w/ PERL? <bart.lateur@skynet.be>
Re: Passwd and Shadow <mischief@velma.motion.net>
Re: Perl & arrays <juex@deja.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 06 Feb 2001 11:09:10 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: "Average of List of Numbers" by Abigail
Message-Id: <e6808ts0beehinqjl7p0101bc6rp7lnt0k@news.supernews.net>
Terrence Brannon <brannon@lnc.usc.edu> wrote:
}
} The Museum of Modern Programming is proud to present its first work:
}
} "Average of List of Numbers" by Abigail.
}
} The Museum of Modern Programming: http://www.momp.org
I remember when this first went by and I had a meta question about the
'elegance' of it. I'd have done:
eval(join("+", @nums))
rather than messing with $". Is this way a LOT less elegant and striking
that using local $"?
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Tue, 06 Feb 2001 18:21:51 +0100
From: martin@radiogaga.harz.de (Martin Vorlaender)
Subject: Re: Call .ksh from perl
Message-Id: <3a8032af.524144494f47414741@radiogaga.harz.de>
JC (jc@home.com) wrote:
> I need to call a .ksh script from a perl script, but have no idea how.
> Can someone please help out with this?
Depends on what you want to do with the ksh script's output.
If all you're interested in is the return code: `perldoc -f system'.
If you want to get the script's output: `perldoc -f open' (look for `|')
cu,
Martin
--
One OS to rule them all | Martin Vorlaender | VMS & WNT programmer
One OS to find them | work: mv@pdv-systeme.de
One OS to bring them all | http://www.pdv-systeme.de/users/martinv/
And in the Darkness bind them.| home: martin@radiogaga.harz.de
------------------------------
Date: Tue, 06 Feb 2001 18:27:48 GMT
From: vivekvp <vivekvp@spliced.com>
Subject: Check for no value?
Message-Id: <95pfml$hjm$1@nnrp1.deja.com>
Hello,
I have a perl script which takes values from a web page (a form). Some
of these have check boxes - and I want to user to either check a value
off - if they don't - I still want a value pass - either a 1 or 0 -
no 'null' values. How do I have either a blank or check?
Any help?
Thanks
Victor
--
He who fights and runs away, lives to run another day!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 06 Feb 2001 16:08:42 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: Convert from base 10 to hex
Message-Id: <slrn9806bp.g9s.trammell@bayazid.hypersloth.net>
On Tue, 06 Feb 2001 16:00:26 GMT, Studio 51 <leekembel@hotmail.com> wrote:
> What's the easiest way to convert a number from base 10 to hex? The value
> will always be between 0 and 255.
sprintf
------------------------------
Date: Tue, 06 Feb 2001 16:11:34 GMT
From: "Studio 51" <leekembel@hotmail.com>
Subject: Re: Convert from base 10 to hex
Message-Id: <WmVf6.90817$V22.18396493@news4.rdc1.on.home.com>
"John Joseph Trammell" <trammell@bayazid.hypersloth.net> wrote in message
news:slrn9806bp.g9s.trammell@bayazid.hypersloth.net...
> sprintf
Thanks!
------------------------------
Date: Tue, 6 Feb 2001 18:24:17 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: Convert from base 10 to hex
Message-Id: <slrn980cq1.2sm.rpolzer@rebounce.rpolzer-lx>
Studio 51 <leekembel@hotmail.com> schrieb Folgendes:
> "John Joseph Trammell" <trammell@bayazid.hypersloth.net> wrote in message
> news:slrn9806bp.g9s.trammell@bayazid.hypersloth.net...
> > sprintf
>
> Thanks!
THIS is how questions here should be answered! Not like in
de.comp.lang.perl, where the only answer would be:
(to UNIX users) look in your HTML documentation
(to Windows users) man perlfunc
--
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote
------------------------------
Date: Tue, 06 Feb 2001 10:56:09 -0800
From: Steve Mayer <Stephen.Mayer@oracle.com>
Subject: Re: Convert from base 10 to hex
Message-Id: <3A8048C9.F7E18EBD@oracle.com>
Studio 51 wrote:
>
> What's the easiest way to convert a number from base 10 to hex? The value
> will always be between 0 and 255.
>
> LKembel
Try the following:
foreach (0..255) {
print (sprintf "%X\n", $_);
}
Steve
------------------------------
Date: Tue, 6 Feb 2001 16:57:45 -0000
From: "Géry" <ducateg@info.bt.co.uk>
Subject: er, how?
Message-Id: <95pajr$2l7$1@pheidippides.axion.bt.co.uk>
Hi
I have a config file that looks like
package mypackage;
$FOO = "Hello";
$BAR = "Yadayada";
...
I would like to be able to update the config file. I can manage that, the
problem is that the script does not pick up the changes. I guess it is
because it compiles the code once and then every variable is in the
"mypackage" variable table. How do I get Perl to compile the config file
again?
many thanks in advance
--
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Géry
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
------------------------------
Date: Tue, 6 Feb 2001 17:41:30 -0000
From: "Géry" <ducateg@info.bt.co.uk>
Subject: Re: er, how?
Message-Id: <95pd5s$38s$1@pheidippides.axion.bt.co.uk>
I have found my answer myself. You guys can stop bothering ;)
and in case you wonder
do 'thenameofmyconfigfile.pl';
does the trick. Simple but effective :)
"Géry" <ducateg@info.bt.co.uk> wrote in message
news:95pajr$2l7$1@pheidippides.axion.bt.co.uk...
> Hi
>
> I have a config file that looks like
>
> package mypackage;
>
> $FOO = "Hello";
> $BAR = "Yadayada";
>
> ...
>
> I would like to be able to update the config file. I can manage that, the
> problem is that the script does not pick up the changes. I guess it is
> because it compiles the code once and then every variable is in the
> "mypackage" variable table. How do I get Perl to compile the config file
> again?
>
> many thanks in advance
>
> --
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Géry
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
>
------------------------------
Date: Tue, 06 Feb 2001 18:11:16 GMT
From: tigra@sky.deep.ru
Subject: Re: er, how?
Message-Id: <95pens$gmg$1@nnrp1.deja.com>
In article <95pajr$2l7$1@pheidippides.axion.bt.co.uk>,
"Géry" <ducateg@info.bt.co.uk> wrote:
> Hi
>
> I have a config file that looks like
>
> package mypackage;
>
> $FOO = "Hello";
> $BAR = "Yadayada";
>
> ...
>
> I would like to be able to update the config file. I can manage that,
the
> problem is that the script does not pick up the changes. I guess it is
> because it compiles the code once and then every variable is in the
> "mypackage" variable table. How do I get Perl to compile the config
file
> again?
>
Please, be more specific. Is this a code that pushed into your program
via eval? Or is this a modperl handler?
Anyway this should always work:
$mypackage::FOO = "bar";
$mypackage::BAR = "foo";
Of course, if these vars were lexically scoped (with 'my'), you just
won't be able to see them from another package (but according to the
snippet you posted they are pretty global).
Sergey
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 06 Feb 2001 17:55:34 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: getting line number n of a file
Message-Id: <t80ekm9fm3fc8d@corp.supernews.com>
Abigail (abigail@foad.org) wrote:
: FooQuuxShell isn't a "standard" Unix command; head and tail are.
: For most commands, it's quite clear whether they are "standard Unix",
: or not.
Yes, but a fair number of people are running Perl on NT, or Win9x, or
BeOS, or... In my view, a golf submission should be pure perl, useable on
any platform.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "When the going gets weird, the weird turn pro."
| - Hunter S. Thompson
------------------------------
Date: Tue, 06 Feb 2001 11:17:43 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Re: Help with <
Message-Id: <hj808tk4anlrvg68v63153hbl1hu2d0aeo@news.supernews.net>
"Joelle Lavergne" <jlavergne@drs.ca> wrote:
} Hello all. I have no experience with perl. I am trying to understand a
} script that I found on the internet. ...
}
} $x < < $y;
The problem is that you're looking at the HTML source for the Perl program
instead of the actual "display" of the PERL program. It is VERY VERY VERY
dangerous to put a "less than" symbol into anything that is going to go
anywhere near a browser, lest the browser interpret what follows the less
than sign as an HTML tag. And so, it is completely routine [even within
<PRE> sections!] just to blindly replace EVERY "<" with "<" [the latter
being the HTML character entity that renders as a "less than sign"].
You can either just replace all of the <'s with "<", or more simply go
back to the place you got found the text and instead of viewsource/saveas,
highlight the perl code in your browser window and copy/paste it into an
editor...
} Here is another one
}
} $x |= @$table[$z++]
}
} what is the meaning of this " |= " ?
for this, you need to RFTM... Perl is a fairly complicated language with a
lot of subtleties, and "|=" isn't even one of them, so best to do some
reading/learning... It is an assign-op and checking in perlop will get
you started...
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Tue, 6 Feb 2001 18:04:31 +0000 (UTC)
From: real.email@signature.this.is.invalid (Csaba Raduly)
Subject: Re: How to tell which Perl is running
Message-Id: <Xns9040B7E8Equuxi@194.203.134.135>
And so it came to pass that "Dimitri Gunsing"
<somewhere@planet.earth> on 06 Feb 2001 wrote
<95od9n$uhr$1@list.pbnec.nl>:
>> Is there a $Variable that will tell me the name of the perl that
>> I'm
>running under (not $] $PERL_VERSION which only tells me 5.006 etc.)?
>>
>
>How about $ENV{'OS'} which tells you which operating system you are
For small values of 'operating system' only (namely: Windows_NT).
Perl on Linux and on OS/2 reports the empty string.
Did you mean $^O ( a.k.a. $OSNAME in English ) ?
--
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
You are in a maze of twisted little minds, all different.
------------------------------
Date: Tue, 06 Feb 2001 17:46:12 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: How to tell which perl is running?
Message-Id: <t80e34b811k1ca@corp.supernews.com>
Lynn Wilson <lynn@swcp.com> wrote:
> I want to write some perl scripts that will run under ActiveState
> (launched from a DOS shell) and under the /usr/local/bin/perl in a
> Cygwin
> environment. The ActiveState doesn't understand that a '/c/program
> files/path' is the same as the 'c:/program files/path' that it
> understands.
> Cygwin contains a built-in 'cygpath' function that will convert between
> the two but how do I know when to call it?
> Is there a $Variable that will tell me the name of the perl that I'm
> running under (not $] $PERL_VERSION which only tells me 5.006 etc.)?
$] gives you the perl version.
$^O gives you the operating system.
$^X gives you the name of the executable.
These together should let you know where you are running and such.
This isn't as helpful as 'perl -v' from the command line. Perhaps
you could either:
A) make sure perl is in your path, backtick `perl -v`;
then parse out the result
B) backtick `$^X -v`; and partse out what you need from
the result
...yadda yadda... Either of these does basically the same thing.
Using q<$^X> assures you have whatever was necessary to launch the
script in the backticks in case you don't have perl in the path.
Calling perl from Perl might not be the most glamourous way to do
things, but until/unless a variable from within the language returns
the string that would be returned by the q<-v> option, it may help.
Chris
--
Christopher E. Stith
Try not. Do, or do not. The Force is binary. -- Yoda,
The Empire Strikes Back (paraphrased)
------------------------------
Date: Tue, 06 Feb 2001 10:41:28 -0700
From: Lynn Wilson <lynn@swcp.com>
Subject: Re: How to tell which perl is running?
Message-Id: <3A803748.628BC396@swcp.com>
Actually ^X returns the path to the executable. Using this on different systems where various perls are installed on different drives, etc. would require me to code for these various installations.
Is there a way to tell if I'm running ActiveState perl without parsing the path to the executable?
thanks.
Lynn
------------------------------
Date: Tue, 06 Feb 2001 18:09:15 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: How to tell which perl is running?
Message-Id: <x78znjr8dw.fsf@home.sysarch.com>
>>>>> "CS" == Chris Stith <mischief@velma.motion.net> writes:
CS> Calling perl from Perl might not be the most glamourous way to do
CS> things, but until/unless a variable from within the language returns
CS> the string that would be returned by the q<-v> option, it may help.
use Config ;
all the -v/-V stuff is generated from %Config.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 6 Feb 2001 16:37:10 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: Is scalar a float, int or string?
Message-Id: <slrn9806h6.21u.rpolzer@rebounce.rpolzer-lx>
> --
> @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
> @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
> ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
> close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
Are there ANY real JAPH scripts? Either they are very easy to read (like
yours) or use lame encryption and therefore cannot do very much (like
mine).
--
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote
------------------------------
Date: 6 Feb 2001 16:56:15 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Is scalar a float, int or string?
Message-Id: <slrn980b5f.4f2.abigail@tsathoggua.rlyeh.net>
Rudolf Polzer (rpolzer@web.de) wrote on MMDCCXVI September MCMXCIII in
<URL:news:slrn9806h6.21u.rpolzer@rebounce.rpolzer-lx>:
() > --
() > @P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub
() > @p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^o
() > ($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/
() > close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;pri
()
() Are there ANY real JAPH scripts? Either they are very easy to read (like
() yours)
Oh, easy to read? Care to explain the about Japh, without peeking in
the long explaination on the authors website?
It took me a long time to unravel this one, and I didn't get all the
details until after I read mjds page.
Abigail
--
perl -wle'print"Êõóô áîïôèåò Ðåòì Èáãëåò"^"\x80"x24'
------------------------------
Date: Tue, 06 Feb 2001 16:52:29 GMT
From: Daniel Pfeiffer <occitan@esperanto.org>
Subject: Re: Is scalar a float, int or string?
Message-Id: <95pa48$buh$1@nnrp1.deja.com>
> Daniel Pfeiffer <occitan@esperanto.org> writes:
>> Background is that I am currently rewriting Math::BigInt, which
>> was lousy and has now become faster by a varying (enormous in
>> some cases) factor. And I need this for an optimal "new"
>> method.
In article <slrn97vant.79s.rgarciasuarez@rafael.kazibao.net>,
rgarciasuarez@free.fr (Rafael Garcia-Suarez) wrote:
> To determine if a scalar $x holds an integer, you can try
> $x eq 0 + $x
> This will fail for integers out of range. I don't know if this will
> be useful to you.
Besides Abigail's remark that you are only checking for a number, this
is exactly what I don't want to do. After all eq is a string-op which
will convert both sides no matter whether I did have an int or a string.
In article <wkofwgne1w.fsf@math.uio.no>,
jacklam@math.uio.no (Peter J. Acklam) wrote:
> Umm...if you don't know enough Perl to answer this question,
> perhaps you shouldn't be messing with the Math::BigInt module.
Umm...obviously you don't know any more than me, so maybe you just
hold your breath!
In article <3a7ffe27.502$39a@news.op.net>,
mjd@plover.com (Mark Jason Dominus) wrote:
> I think the Devel::Peek module has a function that will tell you which
> of the NV, IV, and PV slots in a scalar is populated. I suggest you
> look at that.
> I don't think there is any way to do it in pure Perl without using an
> extension.
That is my feeling from all I have read. If it isn't standard Perl, I
can't make it a prerequisite for a standard Math::BigInt.
-- Daniel
--
Bring text-docs to life! Erwecke Textdokumente zum Leben!
http://beam.to/iPerl/
Vivigu tekstodokumentojn!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 6 Feb 2001 18:00:55 +0100
From: Thoren Johne <thoren@southern-division.com>
Subject: Re: Is scalar a float, int or string?
Message-Id: <MPG.14ea4c328e008d1798984e@news.btx.dtag.de>
In article <slrn9806h6.21u.rpolzer@rebounce.rpolzer-lx>, Rudolf Polzer
aka rpolzer@web.de says...
> Are there ANY real JAPH scripts? Either they are very easy to read (like
> yours) or use lame encryption and therefore cannot do very much (like
> mine).
what about
eval('+qjmw!:wqv"C/kplavyVctj&Aacke`\l "I &8%im_"'^(1x42)^((((((('j'.'2'x
5).'a'.'3'x5).'p'.'5'x5).'h'.'7'x5).'8'.'11'x2).'#'.'13'x2).'X'.'17'x2));
or
print(eval(reverse'88.53.65.23.23.23.23.23.01.411.101.701.99.79.27.23.801
.411.101.08.23.411.101.401.611.111.011.56.23.611.511.711.47'))=>=>=>=>=>;
or (see sig)
--
# Thoren Johne - 8#X - thoren@southern-division.com
# Southern Division Classic Bikes - www.southern-division.com
open(0x666^101620,$0)=>($_=eval(reverse('isx*)]?n\[(},2{.)h(},5{.)P(},7{.
?)?Ca(},42{.)j(*rq')))=>print((uc(reverse(goto=><101010>))=~/$_/)=>'8#X')
------------------------------
Date: Tue, 06 Feb 2001 08:05:50 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: JAPH
Message-Id: <3A8020DE.E47A9806@stomp.stomp.tokyo>
Chris Stith wrote:
> amonotod wrote:
> > Godzilla! wrote:
(snipped ignorance, hatred and Ad Hominem)
> Agreed. .sig blocks have been around a while. A JAPH has to
> reproduce the string 'Just another Perl Hacker' or something
> very similar. If it's a .sig that's not a JAPH, just call it
> a .sig so people don't jump into terminology wars, please. ;)
My presumption is you boys actually expect this girl
to genuflect before you, as always. Not a chance.
Producing a stereotypical Just Another Perl Hacker
is so mundane, so unimaginative and oh so very boring.
This is an inactivity best left to Perl 5 Cargo Cultists.
Your comments are self-contradictory. Duh?
Godzilla
--
print "Just Amazing Perl Hacker";
------------------------------
Date: Tue, 6 Feb 2001 18:29:11 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: JAPH
Message-Id: <slrn980d37.2sm.rpolzer@rebounce.rpolzer-lx>
Godzilla! <godzilla@stomp.stomp.tokyo> schrieb Folgendes:
> Chris Stith wrote:
>
> > amonotod wrote:
> > > Godzilla! wrote:
>
> (snipped ignorance, hatred and Ad Hominem)
>
> > Agreed. .sig blocks have been around a while. A JAPH has to
> > reproduce the string 'Just another Perl Hacker' or something
> > very similar. If it's a .sig that's not a JAPH, just call it
> > a .sig so people don't jump into terminology wars, please. ;)
(snipped ignorance, hatred and Ad Hominem)
> --
> print "Just Amazing Perl Hacker";
--
Micro:0<!--$x;print "do not read\n";$x-->0:soft
# perhaps a good idea for a JAPH: HTML/Perl code
--
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote
------------------------------
Date: Tue, 6 Feb 2001 20:00:28 +0100
From: "Philipp Lenssen" <lenssen@hitnet.rwth-aachen.de>
Subject: Re: MSIE, XML and Accents
Message-Id: <95phng$dvv$1@nets3.rz.RWTH-Aachen.DE>
Mark A. Williams <maw@markaw.com> schrieb in im Newsbeitrag:
3a7fff08_1@nnrp1.news.uk.psi.net...
>..
> I am having troubles with this peice of XML in MSIE 5.5. Basically it
fails
> on the accented e (é) in the <description> data - specifically the word
> ingénieur . Can anyone help me out? Is there something I am missing? As
you
> can see I have changed characters like & ' " < and > Does this mean I need
> to change all accented characters as well?
>..
> <?xml version="1.0"?>
>..
I always include the following encoding for special characters
<?xml version="1.0" encoding="iso-8859-1" ?>
--
http://www.outer-court.com
------------------------------
Date: Tue, 06 Feb 2001 16:35:10 GMT
From: webbgroup <webbgroup@my-deja.com>
Subject: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <95p93u$as8$1@nnrp1.deja.com>
I am writing a script right now that is asking for an IP address.
It needs to check the syntax with limiting it to a valid IP address.
Obviously the end user should be able to put in any three numbers, but
not > 256 for each octect.
Does anybody know a simpler way of doing it than the following?
unless (($ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-
9][0-9][0-9]) || ($ipadd =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9]
[0-9].[0-9][0-9]) || (ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-
9].[0-9][0-9][0-9]) || ($ip2add =~ [0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]
[0-9].[0-9][0-9][0-9]))
{
print "Invalid IP address.";
}
Any suggestions??? Comments???
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 6 Feb 2001 18:20:29 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <slrn980cis.2sm.rpolzer@rebounce.rpolzer-lx>
webbgroup <webbgroup@my-deja.com> schrieb Folgendes:
> I am writing a script right now that is asking for an IP address.
> It needs to check the syntax with limiting it to a valid IP address.
> Obviously the end user should be able to put in any three numbers, but
> not > 256 for each octect.
>
> Does anybody know a simpler way of doing it than the following?
>
> unless (($ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-
> 9][0-9][0-9]) || ($ipadd =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9]
> [0-9].[0-9][0-9]) || (ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-
> 9].[0-9][0-9][0-9]) || ($ip2add =~ [0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]
> [0-9].[0-9][0-9][0-9]))
Does this even work? The slashes or m operators are missing.
my @nums = split /./, $ip;
die "wrong addr"
unless @nums == 4;
for (@nums)
{
die "wrong addr"
if ($_ != $_ & 255); # checks for too big/too small numbers
die "wrong addr"
if ($_ !~ /^\d+$/); # checks for non-digits
}
BTW: you could also use Socket and try
$ip = inet_ntoa ($ip);
die "invalid address"
unless $ip;
$ip = inet_aton ($ip);
This also resolves hostnames and removes leading zeroes.
--
$p=q;.;;$_=<<'learn.to/quote';s/./pack"C",9^unpack"C",$&/gem;eval;'RP'
-u""2of{!zye`}&&%+khza)*)'{'d')'$'{'o')'&'Ug'''khza)*)'e'f'n'f'|'}'UgU
C|z})b`mm`gn.g.hgf}al{)'Y'l'{'e)ahjbl{Ug+ r-V)lx-y//zelly)8'9uuy{`g}2t
learn.to/quote
------------------------------
Date: Tue, 06 Feb 2001 17:35:51 GMT
From: egwong@netcom.com
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <XBWf6.5793$tv5.458398@news.flash.net>
In comp.lang.perl.misc webbgroup <webbgroup@my-deja.com> wrote:
> I am writing a script right now that is asking for an IP address.
> It needs to check the syntax with limiting it to a valid IP address.
> Obviously the end user should be able to put in any three numbers, but
> not > 256 for each octect.
> Does anybody know a simpler way of doing it than the following?
> unless (($ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-
> 9][0-9][0-9]) || ($ipadd =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9]
> [0-9].[0-9][0-9]) || (ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-
> 9].[0-9][0-9][0-9]) || ($ip2add =~ [0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]
> [0-9].[0-9][0-9][0-9]))
> {
> print "Invalid IP address.";
> }
Given your criteria, something like
print "Bad\n" if (grep { $_ >= 255 } split (/\./));
should do. No doubt you'll want to do some other checking (make
sure you're only passed four numbers, 0.0.0.0 isn't passed, etc.)
[removed alt.perl from followups]
------------------------------
Date: Tue, 06 Feb 2001 18:27:32 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Need Help Checking IP Address Syntax w/ PERL?
Message-Id: <qdf08tg88kngcrs8asrhkq3ek0km0v4ore@4ax.com>
webbgroup wrote:
>Obviously the end user should be able to put in any three numbers, but
>not > 256 for each octect.
>
>Does anybody know a simpler way of doing it than the following?
>
>unless (($ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9][0-9].[0-
>9][0-9][0-9]) || ($ipadd =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-9]
>[0-9].[0-9][0-9]) || (ip2add =~ [0-9][0-9][0-9].[0-9][0-9][0-9].[0-9][0-
>9].[0-9][0-9][0-9]) || ($ip2add =~ [0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]
>[0-9].[0-9][0-9][0-9]))
> {
> print "Invalid IP address.";
> }
That doesn't even look like Perl. You must have retyped it from scratch.
But, anyway: you can use \d instead of [0-9]. A tiny bit shorter.
What do you have against IP numbers with just 1 or 2 digits for a byte?
You don't even seem to think that "127.0.0.1" is a valid IP address.
A (theoretically) interesting approach is to use regex assertions in
plain Perl code, except that they're a bit of a chore right now.
$_ = '127.0.0.1';
print /^ (\d+)(?(?{$1>=256})(?!))
\.(\d+)(?(?{$2>=256})(?!))
\.(\d+)(?(?{$3>=256})(?!))
\.(\d+)(?(?{$4>=256})(?!))$/x
? "Match!" : "No match!";
If you insist, feel free to replace "\d+" with "\d{1,3}" or "\d\d?\d?".
But currently, I think I'd do something like this:
4 == grep { $_ <= 255 } /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/
--
Bart.
------------------------------
Date: Tue, 06 Feb 2001 16:19:01 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Passwd and Shadow
Message-Id: <t808vlmjeebdd2@corp.supernews.com>
shawn@flurg.com wrote:
> Hello,
> I recently ran into this problem as well, creating a web based
> interface to 'passwd' and the like. The first problem (running your
> script as root) can be fixed by using suidperl. However, I would
> caution against using this without taint checking (and some other
> security measures like general sanity checking of /all/ input data)
> turned on.
Sure, do sanity checks. Make sure you don't allow root's password
to be reset. Make sure you don't leave a blank password for any
users. Make sure the passwords aren't dictionary words or a rot13
of dictionary words. Make sure the passwords aren't more than 40%
numeric digits. Make sure the passwords aren't more than 25% the
same character. Make sure the passwords don't have more than two
characters in a run of letters in alphabetical order.
Make sure that whoever can change passwords from the web is
someone you would otherwise properly authenticate. This means you
at the very minimum must require a login form on every page and the
use of SSL. Cookies are dangerous, as is the method of allowing
an IP in use for a login page to be considered the same user several
pages later.
Be aware that Webmin exists, and that serious administrators don't
use it. We have it on a handful of colocated servers for clients
who don't mind paying us consulting rates to fix their screwups.
We're paranoid enough about it that these servers are partitioned
from the bulk of the colocated machines, all of which are partitioned
away from our own network.
> Additionally, I tried using the modules Linux::Passwd and the like. One
> thing I found here was, any perl script that actually modifies any
> system files is a Bad Thing(tm) and should be avoided at all costs, due
> to the fact that they are prone to failure and are guaranteed to do so.
> Instead, use system() or `` to use regular unix shell commands to due
> the grunt work.
I've never seen any evidence that all Perl programs are guaranteed to
fail or even prone to failure. Nor have I seen this evidence for all
Perl programs that work with system files. A carefully crafted and
tested program in Perl is generally very stable and dependable.
I still don't like the idea of administering my boxes from the web.
Chris
--
Christopher E. Stith
Where there's a will, there's a lawyer.
------------------------------
Date: Tue, 6 Feb 2001 10:44:14 -0800
From: "Jürgen Exner" <juex@deja.com>
Subject: Re: Perl & arrays
Message-Id: <3a8045fe$1@news.microsoft.com>
"Mario" <m_ario@my-deja.com> wrote in message
news:95gvte$81$1@nnrp1.deja.com...
> In article <95g53v$e2q$1@nnrp1.deja.com>,
> T <tommylebrun@yahoo.com> wrote:
> > Does anyone know if Perl has a limitation on the number of elements an
> > array can have? Thanks, T.
>
> It has not.Of course there is the phisical limit of the ram.
Actually, the limit is more the amount of available swap space.
And the available address space of the OS (which can range from 64KB to a
couple of TB).
jue
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 223
**************************************