[24391] in Perl-Users-Digest
Perl-Users Digest, Issue: 6579 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue May 18 18:06:00 2004
Date: Tue, 18 May 2004 15:05:09 -0700 (PDT)
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, 18 May 2004 Volume: 10 Number: 6579
Today's topics:
aggregating single IP addresses into CIDRs? <gj@freeshell.org>
Re: Easier test for "regular file"? <please_post@nomail.edu>
Re: how to clear the terminal (Hobbit HK)
Re: How to open a socket through a proxy server? <usenet@morrow.me.uk>
Re: installing modules on shared server continued <wunkalunka@elvis.com>
Re: My Example - Regex for "not any words(lines) precee (Sundaram Ramasamy)
Re: My Example - Regex for "not any words(lines) precee <lallip@dishwasher.cs.rpi.edu>
Re: object oriented perl ? <jtc@shell.dimensional.com>
Re: Parsing a text file..... <xx087@freenet.carleton.ca>
Re: Parsing a text file..... <krahnj@acm.org>
Re: Passing variables from Perl to other programs <stjm2@cam.ac.uk.remove>
Re: Password scheme/Persistent session... (krakle)
Re: Password scheme/Persistent session... (krakle)
Re: Password scheme/Persistent session... (krakle)
Re: Password scheme/Persistent session... <uri@stemsystems.com>
Re: Password scheme/Persistent session... (Malcolm Dew-Jones)
Re: Password scheme/Persistent session... <flavell@ph.gla.ac.uk>
Re: Password scheme/Persistent session... <gnari@simnet.is>
Re: Password scheme/Persistent session... <remorse@partners.org>
Perl apache <xuxu_18@yahoo.com>
Re: perlmagick and image size <gnari@simnet.is>
Re: random IP <usenet@morrow.me.uk>
Re: random IP <krahnj@acm.org>
Strange !exists/foreach/read interaction <blgl@hagernas.com>
Re: Strange !exists/foreach/read interaction <ittyspam@yahoo.com>
Telnet.pm question regarding buffer size <ranclay@nortelnetworks.com>
Testing whether given file is open? (Charles Packer)
Re: Understanding Scope with 'my' <roger1023@yahoo.com>
Using DBI to retrieve exit code of stored procedure <domenico_discepola@quadrachemicals.com>
Re: validating IP addresses <stjm2@cam.ac.uk.remove>
Re: validating IP addresses <usenet@morrow.me.uk>
Re: validating IP addresses <krahnj@acm.org>
Re: validating IP addresses <bob.lockie.NOSPAM@mail.com>
Re: validating IP addresses <bob.lockie.NOSPAM@mail.com>
Re: XML::Simple Example perl help needed <davezx1@yahoo.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 18 May 2004 21:41:51 +0000 (UTC)
From: Gerald Jones <gj@freeshell.org>
Subject: aggregating single IP addresses into CIDRs?
Message-Id: <c8dvuv$7gd$1@chessie.cirr.com>
Is there a perl way to take a list of IP unordered addresses in dotted quad
format and group them into more compact CIDR format?
TIA,
Gerald.
------------------------------
Date: Tue, 18 May 2004 19:09:46 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: Easier test for "regular file"?
Message-Id: <c8dn1q$qu7$1@reader2.panix.com>
In <c8bqu7$f96$1@wisteria.csv.warwick.ac.uk> Ben Morrow <usenet@morrow.me.uk> writes:
>Quoth bill <please_post@nomail.edu>:
>>
>> I'm writing a package that needs to interact with cvs. For what
>> I want to do I need the ability to determine whether or not a file
>> is considered "regular" by cvs.
>>
>> sub is_regular {
>> local $_ = shift; # argument is a filename
>>
>> # brute-force elimination
>> !(-b||-c||-d||-l||-p||-S||-t);
>> }
>>
>> (Note: having is_regular return -f --instead of the above--would
>> be no good; for example -f evaluates to 1 if $_ is the name of a
>> symlink.)
>Yes, but that is the only case, so
>not -l and -f _;
>is what you want (the tests must come in this order: -f and not -l _
>would do a stat(2) not an lstat(2) and thus not catch symlinks).
Great. Thanks!
>OTOH, are you sure that a symlink to a regular file is unacceptable:
>what does cvs do about following symlinks?
According to the docs, "cvs import" reports it whenever it encounters
a symlink, but otherwise it ignores them. As for the rest, I don't
know of any "official" description of cvs's behavior, but in my
experience "cvs commit" replaces symlinks with their targets, which
is usually unacceptable. As for hard links, both import and commit
replace hard links with distinct files containing identical copies
of the data originally associated with the hard links.
-bill
------------------------------
Date: 18 May 2004 12:04:06 -0700
From: hobbit_hk@hotmail.com (Hobbit HK)
Subject: Re: how to clear the terminal
Message-Id: <22ee5d47.0405181104.68b85c89@posting.google.com>
Robert Meyer <egoist99NO@SPAMyahoo.de> wrote in message news:<pan.2004.05.17.16.16.02.824151@SPAMyahoo.de>...
> Hi NG,
>
> sorry for my question, but i didn't found anything about how to clear the
> terminal.
> I try `clear`; in the script but this does not work.
>
You can always print the output of clear:
print `clear`;
> Any ideas?
>
> thx
> Robert
------------------------------
Date: Tue, 18 May 2004 19:23:51 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: How to open a socket through a proxy server?
Message-Id: <c8dns7$h2p$2@wisteria.csv.warwick.ac.uk>
Quoth mnarvaja@yahoo.com (Marcelo):
> Ben Morrow <usenet@morrow.me.uk> wrote in message news:<c8b763$7ki$1@wisteria.csv.warwick.ac.uk>...
> > Quoth mnarvaja@yahoo.com (Marcelo):
> > What sort of proxy server? HTTP? SOCKS?
> >
> > If you're talking about SOCKS, you can use IO::Socket::Socks. If HTTP,
> > then you need to make a CONNECT request.
>
> I have both proxies, HTTP and SOCKS proxy servers.
> I tried using IO::Socket::Socks, but it fails by timeout. The original
> version of this module uses IO::Socket::INET that is timeout
> customizable.
IO::Socket::Socks inherits IO::Socket::INET (well, actually
IO::Socket)'s new method, so you can specify a timeout parameter in the
same way.
Ben
--
perl -e'print map {/.(.)/s} sort unpack "a2"x26, pack "N"x13,
qw/1632265075 1651865445 1685354798 1696626283 1752131169 1769237618
1801808488 1830841936 1886550130 1914728293 1936225377 1969451372
2047502190/' # ben@morrow.me.uk
------------------------------
Date: Tue, 18 May 2004 20:00:46 GMT
From: Derf <wunkalunka@elvis.com>
Subject: Re: installing modules on shared server continued
Message-Id: <Xns94ED9A1BD3CA5wunkalunkaelviscom@24.93.44.119>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in news:2gtvlfF6kmaaU1@uni-
berlin.de:
> I do recommend that you ask the server administrator to install
> libwww-perl.
Thanks for your help - I didn't realize MIME::Lite was that easy - I had
been looking at LWP and all its craziness. My server administrator had
originally disabled LWP due to some other patron abusing (how, I have no
idea), but he now has allowed me to use LWP again, so all I needed was
MIME::Lite. Thanks again!
Derf
------------------------------
Date: 18 May 2004 11:10:32 -0700
From: sundaram@sfg.homeunix.com (Sundaram Ramasamy)
Subject: Re: My Example - Regex for "not any words(lines) preceeded by spaces"
Message-Id: <b029225f.0405181010.501ced04@posting.google.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<c8d3s3$es9$1@mamenchi.zrz.TU-Berlin.DE>...
> Edward Wijaya <ewijaya@singnet.com.sg> wrote in comp.lang.perl.misc:
>
> [please don't to-post]
>
> > This is the example of the input (verbatim).
> >
> > AGATTAGT
> > GCATTAGT
> > AGGGTAGT
> > GGAGTAGG
> > A C G T Info Ptn Pattern
> > TOTAL INFORMATION CONTENT
> >
> >
> > I just want to remove the last two lines (that comes
> > with spaces before it).
>
> grep /^\S/, @input;
>
> [fullquote snipped]
>
> Anno
Here is another method.
perl -ne 'print if /^[A-Z]+/' a.out
perl -ne 'print if /^\w+/' a.out
-sundaram
------------------------------
Date: Tue, 18 May 2004 14:27:33 -0400
From: Paul Lalli <lallip@dishwasher.cs.rpi.edu>
Subject: Re: My Example - Regex for "not any words(lines) preceeded by spaces"
Message-Id: <20040518142244.H15402@dishwasher.cs.rpi.edu>
On Tue, 18 May 2004, Sundaram Ramasamy wrote:
> > Edward Wijaya <ewijaya@singnet.com.sg> wrote in comp.lang.perl.misc:
> >
> > [please don't to-post]
> >
> > > This is the example of the input (verbatim).
> > >
> > > AGATTAGT
> > > GCATTAGT
> > > AGGGTAGT
> > > GGAGTAGG
> > > A C G T Info Ptn Pattern
> > > TOTAL INFORMATION CONTENT
> > >
> > >
> > > I just want to remove the last two lines (that comes
> > > with spaces before it).
>
> Here is another method.
>
> perl -ne 'print if /^[A-Z]+/' a.out
>
>
> perl -ne 'print if /^\w+/' a.out
>
Neither of those meet the specs the OP specified. The requirements were
to print lines that do not begin with spaces. Your methods print only
those lines that begin with Capital letters and letters, numbers, &
underscores (respectively). Granted, the input he chose to show contains
only capital letters as the first non-whitespace. That does not mean,
however, that *all* input the OP will use meets that format, nor should it
be assumed his input will never change.
perl -ne 'print if /^\S/' a.out
Paul Lalli
------------------------------
Date: 18 May 2004 15:01:52 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: object oriented perl ?
Message-Id: <slrncakue4.sks.jtc@shell.dimensional.com>
In article <c8cu23$bha$1@mamenchi.zrz.TU-Berlin.DE>, Anno Siegel wrote:
> ngoc <linh@chello.no> wrote in comp.lang.perl.misc:
>> Hi
>> This code does not work. It only creates test.xls, but write nothing in
>> it.I don't know why. Please help me. Thanks a lot.
>
> ...
>
>> Test.pm
>> package Test;
>> use strict;
>> use Spreadsheet::WriteExcel;
>> use Spreadsheet::WriteExcel::Big;
>> use vars qw {$workbook $sheet1 $title_format};
>
> You seem to use these global variables to hand objects from one
> routine to another. That isn't how objects are supposed to work.
> They are passed as the first parameter in a method call, and that
> is how methods should learn about them.
Or, in some cases, it is appropriate to store a reference to another
object as part of the data for 'this' object (AKA attributes). This is
especially the case when these 'attributes' make sense in terms of the
data abstraction that you are designing with respect to the current class
you are working on. The fields for such attributes are usually set via
arguments to the constructor and/or via set_... methods. (And if you
are not thinking in terms of a data abstraction, AKA abstract data type,
then this is another step you should consider if you want to produce an
OO design.)
--
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: 18 May 2004 18:45:54 GMT
From: Glenn Jackman <xx087@freenet.carleton.ca>
Subject: Re: Parsing a text file.....
Message-Id: <slrncakmf2.g18.xx087@smeagol.ncf.ca>
Sundaram Ramasamy <sundaram@sfg.homeunix.com> wrote:
> Here is the perl one-line, I tested this in Linux
>
> cat test.txt | perl -ne 'if( $_ =~ /^_xml\w+\s+x?merge/) {
> s/cleardiff|xmldiffmrg/cleardiffmrg/g; print } else { print }'
> test.txt
Why the leading "cat test.txt|" *and* the trailing "test.txt"?
Because $_ is the default variable, you don't need to explicitly bind it
to the match in your if condition.
Watch out blindly replacing cleardiff with cleardiffmrg -- if the line
already contains cleardiffmrg you'll get cleardiffmrgmrg
Also, don't use -n if you're going to print every line: that's what
-p is for:
perl -pe 'next unless /^_xml\w+\s+x?merge/; s/\b(cleardiff|xmldiffmrg)\b/cleardiffmrg/g;' test.txt
--
Glenn Jackman
NCF Sysadmin
glennj@ncf.ca
------------------------------
Date: Tue, 18 May 2004 20:24:55 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Parsing a text file.....
Message-Id: <40AA710F.30D4D97B@acm.org>
Sundaram Ramasamy wrote:
>
> Here is the perl one-line, I tested this in Linux
>
> cat test.txt | perl -ne 'if( $_ =~ /^_xml\w+\s+x?merge/) {
> s/cleardiff|xmldiffmrg/cleardiffmrg/g; print } else { print }'
> test.txt
A verbose and incorrect way of writting:
perl -i~ -pe'/^_xml\w+\s+x?merge/&&s/cleardiff|xmldiffmrg/cleardiffmrg/g' test.txt
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 18 May 2004 19:32:47 +0100
From: Stuart Moore <stjm2@cam.ac.uk.remove>
Subject: Re: Passing variables from Perl to other programs
Message-Id: <c8dksg$ivq$2@pegasus.csx.cam.ac.uk>
Efialtis wrote:
> I have a fun situation using a testing tool with VBA. However, to do
> some of the things in VBA it would take too long, and it wouldn't work
> right with this particular application...
>
> I am passing in to perl, a chunck of HTML. VBA has a really easy
> command for this "getHTML"...
>
> In perl, I am parsing out some necessary items from the
> HTML...standard, easy, and working.
>
> What I don't know how to do is pass the results back out to VBA
> without using a TEMP file, which will not work with this
> application...
>
> Is there a way to pass out a string from perl back into vba?
How are you running perl from vba? Can you track perl's output and parse
it in vba? Otherwise I've used sockets to communicate between Perl and
another process quite sucesfully.
Stuart
------------------------------
Date: 18 May 2004 12:03:26 -0700
From: krakle@visto.com (krakle)
Subject: Re: Password scheme/Persistent session...
Message-Id: <237aaff8.0405181103.20db23cb@posting.google.com>
anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<c82i7e$n92$1@mamenchi.zrz.TU-Berlin.DE>...
> krakle <krakle@visto.com> wrote in comp.lang.perl.misc:
> > Thank you. However, the whole point to my post was to see if I could
> > do a session with out cookies...
>
> ...which is way off topic for clpm. Why ask that here?
>
> Anno
Because I wanted to know how to maintain state IN perl without
utilizing cookies. It seems like a miscellaneous perl question that
fits right in with comp.lang.perl.misc (note: Comp = Computer. Lang =
Language. Perl = duh!. Misc = Miscellaneous). So, how doesn't a
miscellaneous perl question belong here?
------------------------------
Date: 18 May 2004 12:04:04 -0700
From: krakle@visto.com (krakle)
Subject: Re: Password scheme/Persistent session...
Message-Id: <237aaff8.0405181104.74cb8d90@posting.google.com>
James Willmore <jwillmore@remove.adelphia.net> wrote in message news:<pan.2004.05.14.15.20.56.237532@remove.adelphia.net>...
> On Fri, 14 May 2004 06:24:35 -0700, krakle wrote:
>
> > Thank you. However, the whole point to my post was to see if I could
> > do a session with out cookies...
>
> I don't see how you can.
>
> You could try posting this question to a CGI newsgroup -or- using Google
> to see what others have done.
I guess i'll just use cookies. Thanks though.
------------------------------
Date: 18 May 2004 12:07:46 -0700
From: krakle@visto.com (krakle)
Subject: Re: Password scheme/Persistent session...
Message-Id: <237aaff8.0405181107.162a37c6@posting.google.com>
Sherif Zaroubi <blah@blah.com> wrote in message news:<opr7z5yhkqcx74rp@news.videotron.ca>...
> On 14 May 2004 06:24:35 -0700, krakle <krakle@visto.com> wrote:
>
> > Thank you. However, the whole point to my post was to see if I could
> > do a session with out cookies...
>
>
> If you are running apache.
> Check .htaccess files and .htpasswd files.
If you completed reading my post you would see that I stated "Please
don't refer me to .htpasswd because...".
>
> You don't need a session. All you need is a password file.
I need a session. .htpasswd does linear style look ups. Users
beginning with 'Z' will take longer to look up than users beginning
with the letter 'A'. It doesn't make sense to have hundreds of
thousands or even 10's of thousands of usernames in a plaintext file.
Imagine how poor performance will be. I also need session control to
be able to set time limits, expire as well as some other general
session tasks. Apaches .htpasswd just isn't enough or performance
driven.
Thank you however.
------------------------------
Date: Tue, 18 May 2004 19:15:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Password scheme/Persistent session...
Message-Id: <x7brklsg1u.fsf@mail.sysarch.com>
>>>>> "k" == krakle <krakle@visto.com> writes:
k> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message news:<c82i7e$n92$1@mamenchi.zrz.TU-Berlin.DE>...
>> krakle <krakle@visto.com> wrote in comp.lang.perl.misc:
>> > Thank you. However, the whole point to my post was to see if I could
>> > do a session with out cookies...
>>
>> ...which is way off topic for clpm. Why ask that here?
>>
>> Anno
k> Because I wanted to know how to maintain state IN perl without
k> utilizing cookies. It seems like a miscellaneous perl question that
k> fits right in with comp.lang.perl.misc (note: Comp = Computer. Lang =
k> Language. Perl = duh!. Misc = Miscellaneous). So, how doesn't a
k> miscellaneous perl question belong here?
because you can't do WEB sessions without cookies. and how to do web
sessions is a web problem. perl can implement those sessions but the
problem is inherently not perl specific. now if you have tried various
modules and such and need help with them, ask away.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 18 May 2004 12:20:19 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Password scheme/Persistent session...
Message-Id: <40aa61f3@news.victoria.tc.ca>
krakle (krakle@visto.com) wrote:
: Sherif Zaroubi <blah@blah.com> wrote in message news:<opr7z5yhkqcx74rp@news.videotron.ca>...
: > On 14 May 2004 06:24:35 -0700, krakle <krakle@visto.com> wrote:
: >
: > > Thank you. However, the whole point to my post was to see if I could
: > > do a session with out cookies...
: >
: >
: > If you are running apache.
: > Check .htaccess files and .htpasswd files.
: If you completed reading my post you would see that I stated "Please
: don't refer me to .htpasswd because...".
: >
: > You don't need a session. All you need is a password file.
: I need a session. .htpasswd does linear style look ups. Users
: beginning with 'Z' will take longer to look up than users beginning
: with the letter 'A'. It doesn't make sense to have hundreds of
: thousands or even 10's of thousands of usernames in a plaintext file.
: Imagine how poor performance will be. I also need session control to
: be able to set time limits, expire as well as some other general
: session tasks. Apaches .htpasswd just isn't enough or performance
: driven.
I'm not an apache expert, I may be wrong, but I think that apache has
various implementations of security that are functionaly equivalent to
.htpasswd but do not use that specific file.
And as long as you trust the server to correctly identify the user, then
everything else, including sesion data and timeouts, can surely be indexed
from the user's id.
But, I guess it's up to you to decide.
--
(Paying) telecommute programming projects wanted. Simply reply to this.
------------------------------
Date: Tue, 18 May 2004 20:36:22 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Password scheme/Persistent session...
Message-Id: <Pine.LNX.4.53.0405182028250.22723@ppepc56.ph.gla.ac.uk>
On Tue, 18 May 2004, Malcolm Dew-Jones wrote:
> krakle (krakle@visto.com) wrote:
>
> : If you completed reading my post you would see that I stated "Please
> : don't refer me to .htpasswd because...".
And this is directly relevant to programming in the Perl
language because...?
> : > You don't need a session. All you need is a password file.
>
> : I need a session. .htpasswd does linear style look ups.
That makes no kind of sense, but is anyway entirely off-topic for
here.
> : Users : beginning with 'Z' will take longer to look up than users
> beginning : with the letter 'A'.
Apache has excellent documentation. Apacheweek has articles about
authentication, which are cited in the Apache documentation. Kindly
read them before making such preposterous claims.
> : It doesn't make sense to have hundreds of
> : thousands or even 10's of thousands of usernames in a plaintext file.
Quite so, but this still has no relevant to the Perl programming
language.
> : Imagine how poor performance will be.
Not half as poor a "performance" as asking about Apache configuration
in a Perl programming group, gorblimey...
> : I also need session control to
> : be able to set time limits,
Actually, you don't "need" sessions for that purpose. They *might* be
useful, but this isn't the place to discuss those details.
> I'm not an apache expert, I may be wrong, but I think that apache has
> various implementations of security that are functionaly equivalent to
> .htpasswd but do not use that specific file.
I'm confident that the documentation reveals this and more!
------------------------------
Date: Tue, 18 May 2004 19:25:03 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Password scheme/Persistent session...
Message-Id: <c8dnrg$ks3$1@news.simnet.is>
"krakle" <krakle@visto.com> wrote in message
news:237aaff8.0405181107.162a37c6@posting.google.com...
> Sherif Zaroubi <blah@blah.com> wrote in message
news:<opr7z5yhkqcx74rp@news.videotron.ca>...
> > You don't need a session. All you need is a password file.
>
> I need a session. .htpasswd does linear style look ups. Users
> beginning with 'Z' will take longer to look up than users beginning
> with the letter 'A'. It doesn't make sense to have hundreds of
> thousands or even 10's of thousands of usernames in a plaintext file.
> Imagine how poor performance will be. I also need session control to
> be able to set time limits, expire as well as some other general
> session tasks. Apaches .htpasswd just isn't enough or performance
> driven.
did you look at the other apache auth_* modules
like mod_auth_dbm or mod_auth_db ?
these provide much better performance with large user sets.
there are also extentions that allow the use of full-blown DBMS's,
if you need better management of your user database.
gnari
------------------------------
Date: Tue, 18 May 2004 17:04:30 -0400
From: Richard Morse <remorse@partners.org>
Subject: Re: Password scheme/Persistent session...
Message-Id: <remorse-F11608.17043018052004@plato.harvard.edu>
In article <237aaff8.0405181103.20db23cb@posting.google.com>,
krakle@visto.com (krakle) wrote:
> anno4000@lublin.zrz.tu-berlin.de (Anno Siegel) wrote in message
> news:<c82i7e$n92$1@mamenchi.zrz.TU-Berlin.DE>...
> > krakle <krakle@visto.com> wrote in comp.lang.perl.misc:
> > > Thank you. However, the whole point to my post was to see if I could
> > > do a session with out cookies...
> >
> > ...which is way off topic for clpm. Why ask that here?
> >
> > Anno
>
> Because I wanted to know how to maintain state IN perl without
> utilizing cookies. It seems like a miscellaneous perl question that
> fits right in with comp.lang.perl.misc (note: Comp = Computer. Lang =
> Language. Perl = duh!. Misc = Miscellaneous). So, how doesn't a
> miscellaneous perl question belong here?
URL rewriting. Include the session ID in the URL, and dynamically
rewrite all urls to include this value, probably in the extra path info
after the script name.
Ricky
--
Pukku
------------------------------
Date: Tue, 18 May 2004 16:40:35 -0400
From: "Profetas" <xuxu_18@yahoo.com>
Subject: Perl apache
Message-Id: <fea742b87b5abbdcc12eb3aef29c4c9f@localhost.talkaboutprogramming.com>
I didn't know where to go.
If this question shouldn't be posted here, just ignore it
I have been trying to config perl and apache.
My apache has been running for a while.
and I already had perl installed, but I guessed
a new installation would be better. when I start to install
it ask for the apache src. and I can't find the apache src
I eve downloaded the leatest version to check that out.
then I jumped this stage. later on the documentation say
that I should add a Include conf/mod_perl.conf but I can't
find the conf file.
Thanks
------------------------------
Date: Tue, 18 May 2004 19:12:42 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: perlmagick and image size
Message-Id: <c8dn4c$kpv$1@news.simnet.is>
"Rossz" <rosszNOSPAM@sonic.net> wrote in message
news:Yqrqc.11882$Fo4.154014@typhoon.sonic.net...
> Never mind, I got it working. Thanks for your suggestions, it did the
job.
that's good, I didn't relish the thought of installing imagemagick
just for this.
gnari
------------------------------
Date: Tue, 18 May 2004 19:20:06 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: random IP
Message-Id: <c8dnl6$h2p$1@wisteria.csv.warwick.ac.uk>
Quoth Richard Voss <erutiurf@web.de>:
> Bob wrote:
> > On 05/18/04 10:28 Jürgen Exner spoke:
> >
> >> Bob wrote:
> >>
> >>> I need to generate an IP address based on a random number.
> >>
> >> Of course you realize that the current time is not random at all, are
> >> you?
> >
> > I meant different each time to program is run.
> >
>
> Today's computers can start a program more than once within a second. (Seriuos!)
> You might get closer to unique values using more exact times than just seconds.
> Time::HiRes provides a time() function that returns floats. Still, that's not
> strictly unique.
Include the pid, $$, and sleep for at least a second. Unless you are
using threads, the combination (host, time, pid) will then be unique.
Also, I would MD5 it, just to make it less deterministic.
Ben
--
Like all men in Babylon I have been a proconsul; like all, a slave ... During
one lunar year, I have been declared invisible; I shrieked and was not heard,
I stole my bread and was not decapitated.
~ ben@morrow.me.uk ~ Jorge Luis Borges, 'The Babylon Lottery'
------------------------------
Date: Tue, 18 May 2004 20:40:55 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: random IP
Message-Id: <40AA74CF.B84287E0@acm.org>
Bob wrote:
>
> I need to generate an IP address based on a random number.
use Socket;
print inet_ntoa inet_aton int rand ~0;
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 18 May 2004 20:04:06 +0200
From: Bo Lindbergh <blgl@hagernas.com>
Subject: Strange !exists/foreach/read interaction
Message-Id: <blgl-230E74.20040618052004@news.bahnhof.se>
use strict;
use warnings;
my($index,@array);
$#array=2;
$index=0;
foreach my $element (@array) {
printf STDERR ("index=%d\n",$index++);
read(DATA,$element,2);
}
print STDERR "array=('",join("','",@array),"')\n";
__DATA__
Random line of text which is irrelevant to the matter.
With either 5.6.1 or 5.8.1, the above program prints this on STDERR:
index=0
index=1
Use of uninitialized value in read at oddity line 10.
index=2
Use of uninitialized value in read at oddity line 10.
array=('Ra','nd','om')
Why does read complain about an output-only parameter being undefined?
And why _doesn't_ it complain on the first iteration of the loop?
/Bo Lindbergh
------------------------------
Date: Tue, 18 May 2004 14:38:43 -0400
From: Paul Lalli <ittyspam@yahoo.com>
Subject: Re: Strange !exists/foreach/read interaction
Message-Id: <20040518143521.B15402@dishwasher.cs.rpi.edu>
On Tue, 18 May 2004, Bo Lindbergh wrote:
> use strict;
> use warnings;
>
> my($index,@array);
>
> $#array=2;
> $index=0;
> foreach my $element (@array) {
> printf STDERR ("index=%d\n",$index++);
> read(DATA,$element,2);
> }
> print STDERR "array=('",join("','",@array),"')\n";
>
> __DATA__
> Random line of text which is irrelevant to the matter.
>
>
> With either 5.6.1 or 5.8.1, the above program prints this on STDERR:
> index=0
> index=1
> Use of uninitialized value in read at oddity line 10.
> index=2
> Use of uninitialized value in read at oddity line 10.
> array=('Ra','nd','om')
>
>
> Why does read complain about an output-only parameter being undefined?
> And why _doesn't_ it complain on the first iteration of the loop?
From perldoc -f read:
read FILEHANDLE,SCALAR,LENGTH,OFFSET
Attempts to read LENGTH characters of data into variable SCALAR from
the specified FILEHANDLE. Returns the number of characters actually
read, 0 at end of file, or undef if there was an error (in the latter
case $! is also set). SCALAR will be grown or shrunk so that the last
character actually read is the last character of the scalar after the
read.
That description seems to imply that $element is not an output-only
parameter. It seems like Perl would have to read the contents of $element
in order to possibly have to shrink it to fit the new size of the incoming
data. That could be the cause of the warning.
(As for why no warning the first time around, I have no idea).
Just my guess. I could be completely wrong.
Paul Lalli
------------------------------
Date: Tue, 18 May 2004 16:37:49 -0500
From: "Scott Clay" <ranclay@nortelnetworks.com>
Subject: Telnet.pm question regarding buffer size
Message-Id: <c8dvj6$kb5$1@zcars0v6.ca.nortel.com>
#!/usr/bin/perl
use Net::Telnet();
use Net::FTP;
$telnetObj->cmd("ll 12345678901234567890123456789012345678"); //works
## The above command works fine passing it to a second linux box (41 chars
all together) . However, the command below (42 chars) errors out. I think it
has to do with ## the strings length. Is there anyway to increase the buffer
size that I need to pass the string?
$telnetObj->cmd("ll 123456789012345678901234567890123456789"); //DOESN'T
Work
Input.txt File From the Telnet Object (Longer Command I'm trying to pass on
the 2nd machine):
[cliuser3@pcaccli1 cliuser3]$ mkdir /tmp/public/20040518163708
[cliuser3@pcaccli1 cliuser3]$ chmod 755 /tmp/public/20040518163708
[cliuser3@pcaccli1 cliuser3]$ cd /tmp/public/20040518163708
[cliuser3@pcaccli1 20040518163708]$ ll
12345678901234567890123456789012345678^M<163708]$ ll
123456789012345678901234567890123456789
^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H
Perl Version
[ranclay@tatu swift]$ perl -v
This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2002, Larry Wall
Linux Kernel
[ranclay@tatu swift]$ uname -a
Linux tatu 2.4.20-20.9smp #1 SMP Mon Aug 18 11:32:15 EDT 2003 i686 i686 i386
GNU/Linux
------------------------------
Date: 18 May 2004 14:25:33 -0700
From: mailbox@cpacker.org (Charles Packer)
Subject: Testing whether given file is open?
Message-Id: <f88bc493.0405181325.357e062f@posting.google.com>
A large data file is being pushed to us via FTP. We can assume that as
long as the file is open, the FTP transfer hasn't completed. How do we
test whether the file is still open? We know about fuser and lsof, but
we (my colleague, at least, who has to code the Perl) would prefer
using a purely Perlish approach. Is there a Perl module out there
somewhere that performs such a test?
------------------------------
Date: 18 May 2004 18:22:31 GMT
From: Roger <roger1023@yahoo.com>
Subject: Re: Understanding Scope with 'my'
Message-Id: <2004518-202231-725744@foorum.com>
"The other warning comes from the fact that the assignment $seed = 1 is
not executed until after the call to my_rand. There are two fixes for
this: either move the whole block up above any calls to the sub, so that
the variable is initialised properly, or, better, make it into a BEGIN
block that will *definitely* be run before anything else."
Yes that's right as it turns out. Just like a shell script if not for the BEGHIN
block. Thank you for pointing this out and I might say that URL I referenced
might be improved with this tidbit of info and the Llama book never explains
about begin blocks, although I'm sure it mentions the way the interpreter parses
a file... but then again the BEGIN block info is important to that.
Thanks again.
Roger
--
Use our news server 'news.foorum.com' from anywhere.
More details at: http://nnrpinfo.go.foorum.com/
------------------------------
Date: Tue, 18 May 2004 15:34:13 -0400
From: "Domenico Discepola" <domenico_discepola@quadrachemicals.com>
Subject: Using DBI to retrieve exit code of stored procedure
Message-Id: <mxtqc.42787$kc2.641595@nnrp1.uunet.ca>
Hello all. I'm using DBI to connect via ODBC to Microsoft SQL Server 2000.
I wish to execute a stored procedure and return the exit code of the stored
procedure. The stored procedure only returns 1 numerical value. In this
stored proc, I'm calling gzip with a non-existent file in order to produce
an error. I do not get any results back. Any thoughts?
Stored procedure:
create procedure sp_test1 as
DECLARE @result int
EXEC @result = master..xp_cmdshell 'gzip h', no_output
return @result
Perl code:
#!perl
use strict;
use warnings;
use DBI;
our ( $g_dbhandle, $g_dsn );
$g_dsn = 'bcp';
sub main {
my ( $stmt, $sth, $res );
$g_dbhandle = DBI->connect("DBI:ODBC:${g_dsn}") || die
"$g_dbhandle->errstr\n\n$!\n";
$stmt = "exec northwind..sp_test1";
$sth->prepare('{? = call northwind..sp_test1}');
$sth->bind_param_inout( 1, \$res, 50 ); #code I got from somewhere
$sth->execute or die $g_dbhandle->errstr;
print "$res\n";
$sth->finish;
$g_dbhandle->disconnect or die $g_dbhandle->errstr;
}
exit 0;
------------------------------
Date: Tue, 18 May 2004 19:31:28 +0100
From: Stuart Moore <stjm2@cam.ac.uk.remove>
Subject: Re: validating IP addresses
Message-Id: <c8dkq0$ivq$1@pegasus.csx.cam.ac.uk>
Bob wrote:
> I need a function to accept an IP address (V4 or V6) and return if it is
> valid or not.
>
Define valid?
If it's v4, then either do something like
/(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ && $1<=255 && $2<=255 && $3
<= 255 && $4<=255;
(although I think you might also want to check for no 0s in certain places)
or if you want to find out if it's an allocated one, some kind of dns
query - or maybe just ping.
v6 I guess is similar, although the regexp will look different. There's
possibly a module that does this for you
Stuart
------------------------------
Date: Tue, 18 May 2004 19:25:38 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: validating IP addresses
Message-Id: <c8dnvi$h2p$3@wisteria.csv.warwick.ac.uk>
Quoth Bob <bob.lockie.NOSPAM@mail.com>:
> I need a function to accept an IP address (V4 or V6) and return if it is
> valid or not.
Regexp::Common has regexen for IPv4 addresses. I guess you could submit
a patch to Abigail for IPv6.
Ben
--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
ben@morrow.me.uk
------------------------------
Date: Tue, 18 May 2004 20:45:30 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: validating IP addresses
Message-Id: <40AA75E2.4762BED6@acm.org>
Bob wrote:
>
> I need a function to accept an IP address (V4 or V6) and return if it is
> valid or not.
perldoc Net::CIDR
[snip]
$ip=Net::CIDR::cidrvalidate($ip);
Validate whether $ip is a valid IPv4 or IPv6 address.
Returns its argument or undef. Spaces are removed, and
IPv6 hexadecimal address are converted to lowercase.
John
--
use Perl;
program
fulfillment
------------------------------
Date: Tue, 18 May 2004 16:45:09 -0400
From: Bob <bob.lockie.NOSPAM@mail.com>
Subject: Re: validating IP addresses
Message-Id: <lBuqc.42640$325.904269@news20.bellglobal.com>
On 05/18/04 14:31 Stuart Moore spoke:
> Bob wrote:
>
>> I need a function to accept an IP address (V4 or V6) and return if it
>> is valid or not.
>>
>
> Define valid?
Just all numbers less than 256, etc.
Like what you wrote. :-)
Thanks.
>
> If it's v4, then either do something like
>
> /(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/ && $1<=255 && $2<=255 && $3
> <= 255 && $4<=255;
>
> (although I think you might also want to check for no 0s in certain places)
--
-------------------------------------------------------
Remove .NOSPAM from my email address to reply directly.
------------------------------
Date: Tue, 18 May 2004 16:45:26 -0400
From: Bob <bob.lockie.NOSPAM@mail.com>
Subject: Re: validating IP addresses
Message-Id: <CBuqc.42651$325.904335@news20.bellglobal.com>
On 05/18/04 15:25 Ben Morrow spoke:
> Quoth Bob <bob.lockie.NOSPAM@mail.com>:
>
>>I need a function to accept an IP address (V4 or V6) and return if it is
>>valid or not.
>
>
> Regexp::Common has regexen for IPv4 addresses. I guess you could submit
> a patch to Abigail for IPv6.
>
> Ben
>
Thanks.
--
-------------------------------------------------------
Remove .NOSPAM from my email address to reply directly.
------------------------------
Date: Tue, 18 May 2004 17:56:14 -0400
From: "David Staschover" <davezx1@yahoo.com>
Subject: Re: XML::Simple Example perl help needed
Message-Id: <xCvqc.288$ri.35893@dfw-read.news.verio.net>
Not sure how not to top post.. Deleting the text below..
Although I rtfm'd, I have no idea what they're talking about :) The example
below worked.. thanks!
>
> for (@{ $struct->{top}[0]{top1}[0]{field} }) {
>
> The reason you need the extra [0] is almost certainly because of the
> 'forcearray => 1' you specified. Do you read the docs for the modules
> you use?
>
> Ben
>
> --
> I've seen things you people wouldn't believe: attack ships on fire off
> the shoulder of Orion; I watched C-beams glitter in the dark near the
> Tannhauser Gate. All these moments will be lost, in time, like tears in
rain.
> Time to die.
ben@morrow.me.uk
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 6579
***************************************