[19025] in Perl-Users-Digest
Perl-Users Digest, Issue: 1220 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jun 29 18:06:23 2001
Date: Fri, 29 Jun 2001 15:05:10 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <993852309-v10-i1220@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 29 Jun 2001 Volume: 10 Number: 1220
Today's topics:
Re: CGI modules : Can I run modules on a webserver with (Tony L. Svanstrom)
Re: Code Review Needed! (Dave Hoover)
Re: Create unique file in dir? (Craig Berry)
Re: how do I return a hash var <jestersi@metacrawler.com>
Re: how do I return a hash var (Tad McClellan)
Re: how do I return a hash var <jestersi@metacrawler.com>
how to Walk/dump Win32 registry? <john.stumbles@ntlworld.com>
Re: how to Walk/dump Win32 registry? (Greg Bacon)
Is the Perl working...or what have I messed up now? (gail pickens-barger)
Re: Is the Perl working...or what have I messed up now <godzilla@stomp.stomp.tokyo>
Re: limiting cgi input from specific IP's (Craig Berry)
Re: limiting cgi input from specific IP's <andras@mortgagestats.com>
Re: limiting cgi input from specific IP's <godzilla@stomp.stomp.tokyo>
Re: limiting cgi input from specific IP's <jestersi@metacrawler.com>
Net::DNS zone transfer requires that transfer-format be (Darrell Shane)
Re: PERL and CGI under NT IIS <ddNOSPAM0001@yahoo.com>
Perl/CGI script to validate email addresses <gasperds@rediffmail.com>
Re: Perl/CGI script to validate email addresses <godzilla@stomp.stomp.tokyo>
Re: Perl/CGI script to validate email addresses (Brian Pontz)
Re: Regexp problem <mbudash@sonic.net>
Re: regular expression problem (Xtreme)
Re: releasing array memory (isterin)
SMTP, should be simple <noemail@noemail.com>
Re: SMTP, should be simple (Brian Pontz)
undef question. (mahesh)
Re: undef question. (Clinton A. Pierce)
unix `ps` <todd@designsouth.net>
Re: unix `ps` <djberge@uswest.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Jun 2001 18:52:06 GMT
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: CGI modules : Can I run modules on a webserver without having to install them?
Message-Id: <1evs75v.hw4ibi1n5e1gaN%tony@svanstrom.com>
toreLG <torelg@hotmail.com> wrote:
> I'd like to use a few non-standard modules on a webserver hosted by a
> commercial company. The modules I'd like to use aren't installed on their
> webserver.
>
> Can I use the modules I want without having to installing them on the
> server?
Depends on the modules, some could be viewed as nothing more than just
another script, while others require you to compile C(++)-kod... Take a
look at the modules and see what they look like to you.
/Tony
--
the truth is dead, faith is gone, reality killed... ruled by the plastic
laws of modern life we're pushed towards the hell of personal doubt,
betrayal, hate, lust and murder... the now has become an illusion, a
paradise of a dead tomorrow... (c)2000-2001 tony@svanstrom.com
------------------------------
Date: 29 Jun 2001 14:19:36 -0700
From: redsquirreldesign@yahoo.com (Dave Hoover)
Subject: Re: Code Review Needed!
Message-Id: <812589bb.0106291319.7f701134@posting.google.com>
Craig Berry wrote...
> Uri Guttman (uri@sysarch.com) wrote:
> : that is one reason i almost always run tar ztvf foo.tar.gz on tarballs
> : of unknown origin. it is amazing how many don't have a parent dir they
> : create and they would untar all their files into the current dir. what
> : were those people thinking when they made that tarball?
>
> Your question contains a hidden assumption. :)
Hey, it was the first tarball I've ever made, I was literally reading
the GNU tar and gzip manpages as I was making it. I'll readily admit
I'm a newbie which is why I was asking for a code review in the first
place.
--
Dave Hoover
"Twice blessed is help unlooked for." --Tolkien
http://www.redsquirreldesign.com/dave
------------------------------
Date: Fri, 29 Jun 2001 18:40:38 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Create unique file in dir?
Message-Id: <tjpit6m8b6oofa@corp.supernews.com>
Tony L. Svanstrom (tony@svanstrom.com) wrote:
: Personally i use time-pid-[4 random numbers], if that fails then the you
: most likely have a lot more serious server-related problems to deal with
: then non-unique files. Besides, since you lock the file nothing bad will
: happen anyways...
I'd prefer something deterministic (I know, I'm obsessive). The FAQ
answer (perldoc -q temp, as suggested in another response) involving POSIX
tmpnam and sysopen seems to be the right course. I missed finding it
because my intended use is not as a temporary file.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Magick is the art and science of causing change in conformity
| with Will." - Aleister Crowley
------------------------------
Date: Fri, 29 Jun 2001 11:46:05 -0700
From: "news.sohoskyway.com" <jestersi@metacrawler.com>
Subject: Re: how do I return a hash var
Message-Id: <3b3ccc69$1_1@sohoskyway.net>
ok I've figured out a few of the problems with the script. it now looks like
this.
sub rethash {
local($somehash);
$somehash = { };
print "somehash:" .ref($somehash)."\n"; #this worx, it prints
HASH
$somehash{"100"} = 'purple people eater';
print "Somehash:" . $somehash{"100"} . "\n"; #this worx it print
'purple...'
return($somehash);
}
$myhash = &rethash();
print $myhash{'100'} #this prints nothing.
it now prints the right data type HASH with ref is called, I'm fairly new to
perl but I've know C/C++ for ages when I hear reference I think of it as a
pointer to a vairable wich means when the var is out of scope there is no
garantee that the values and stuff are intact. I think that I perhaps may be
interpreting the jargon "reference" incorrectly?
basicaly what I want the function to do is copy all the data from $somehash
to $myhash through the return.
This is just an stripped down concept version of a func I'm creating that
parses the QUERY_STRING variable and creates a hash list of all the var's
passed from a browser in the query string.
"Rickey Ingrassia" <r1ckey@home.com> wrote in message
news:E43%6.2414$wr.12359@news1.frmt1.sfba.home.com...
> news.sohoskyway.com <jestersi@metacrawler.com> on Fri, 29 Jun 2001
10:16:52 -0700 wrote:
> >i.e.
>
> >sub somefunc {
> > %somevar = {"100","green","200","red" };
> ^ shouldn't this be () ^
> > return($somevar);
> >}
>
> >$myhash = &somefunc();
> >print ref($myhash); #this prints NOTHIN!!
>
> >any guru's figure this out?
> By no measure am I a guru...
>
> Are you trying to return a reference to the hash? If so use this,
>
> return(\%somevar); # returns a reference to %somevar
>
> Or are you trying to return one of the values of the hash? If so try this,
>
> %somevar = (100 => green,
> 200 => red);
> return($somevar{100}); # will return green
>
>
>
>
> --
>
------------------------------
Date: Fri, 29 Jun 2001 14:21:23 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: how do I return a hash var
Message-Id: <slrn9jphp3.odt.tadmc@tadmc26.august.net>
[ Please put your comments *following* the quoted text that you
are commenting on.
All context snipped rather than try to sort it out.
]
news.sohoskyway.com <jestersi@metacrawler.com> wrote:
>ok I've figured out a few of the problems with the script. it now looks like
>this.
>sub rethash {
>
> local($somehash);
^^^^^
my($somehash);
You should always use my() instead of local() unless you are
expert enough to know why you need local() instead (or if you
are local()ing a built-in variable) of my().
Perl FAQ, part 7:
"What's the difference between dynamic and lexical (static) scoping?
Between local() and my()?"
> $somehash = { };
> print "somehash:" .ref($somehash)."\n"; #this worx, it prints
>HASH
> $somehash{"100"} = 'purple people eater';
^^
You did not de-reference the ref that is in $somehash:
$somehash->{"100"} = 'purple people eater';
>$myhash = &rethash();
>print $myhash{'100'} #this prints nothing.
You have not derefed that ref either:
print $myhash->{'100'};
>it now prints the right data type HASH with ref is called, I'm fairly new to
>perl but I've know C/C++ for ages when I hear reference I think of it as a
>pointer to a vairable wich means when the var is out of scope there is no
>garantee that the values and stuff are intact.
scoping of dynamic (local) variables is strange.
lexical variables (my) behave as you seem to be describing.
>I think that I perhaps may be
>interpreting the jargon "reference" incorrectly?
No, Perl has two types of variables. You chose the wrong type.
Choose the other one :-)
>This is just an stripped down concept version of a func I'm creating that
>parses the QUERY_STRING variable
That is easy to get wrong, consider using a module to do that for you.
>and creates a hash list of all the var's
>passed from a browser in the query string.
A "hash slice" may help with that, see the "Slices" section in 'perldata.pod'
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 29 Jun 2001 13:49:50 -0700
From: "news.sohoskyway.com" <jestersi@metacrawler.com>
Subject: Re: how do I return a hash var
Message-Id: <3b3ce96a$1_2@sohoskyway.net>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9jphp3.odt.tadmc@tadmc26.august.net...
> [ Please put your comments *following* the quoted text that you
> are commenting on.
>
> All context snipped rather than try to sort it out.
> ]
Guess this a news group thingy, sorry barely go on.
>
>
> news.sohoskyway.com <jestersi@metacrawler.com> wrote:
> >ok I've figured out a few of the problems with the script. it now looks
like
> >this.
> >sub rethash {
> >
> > local($somehash);
> ^^^^^
>
> my($somehash);
>
> You should always use my() instead of local() unless you are
> expert enough to know why you need local() instead (or if you
> are local()ing a built-in variable) of my().
>
> Perl FAQ, part 7:
>
> "What's the difference between dynamic and lexical (static) scoping?
> Between local() and my()?"
From what I can tell my() makes it so a variable is only available within
the given scope where as local() will propagate variables downwards so any
var decalared inside local() are available to functions called within the
same scope, where as with my() there not.
>
>
> > $somehash = { };
> > print "somehash:" .ref($somehash)."\n"; #this worx, it
prints
> >HASH
> > $somehash{"100"} = 'purple people eater';
> ^^
>
> You did not de-reference the ref that is in $somehash:
>
> $somehash->{"100"} = 'purple people eater';
I think I'm going to have to read up on referneces and stuff cuz that really
did the trick.
Is there an analogy out there that describes the similarity's between C and
perl as far as references go?
>
>
> >$myhash = &rethash();
> >print $myhash{'100'} #this prints nothing.
>
>
> You have not derefed that ref either:
>
> print $myhash->{'100'};
>
>
> >it now prints the right data type HASH with ref is called, I'm fairly new
to
> >perl but I've know C/C++ for ages when I hear reference I think of it as
a
> >pointer to a vairable wich means when the var is out of scope there is no
> >garantee that the values and stuff are intact.
>
>
> scoping of dynamic (local) variables is strange.
>
> lexical variables (my) behave as you seem to be describing.
>
>
> >I think that I perhaps may be
> >interpreting the jargon "reference" incorrectly?
>
>
> No, Perl has two types of variables. You chose the wrong type.
> Choose the other one :-)
And what type would that be?
I want to use a HASH type
>
>
> >This is just an stripped down concept version of a func I'm creating that
> >parses the QUERY_STRING variable
>
>
> That is easy to get wrong, consider using a module to do that for you.
seems simple to me, I just can't seem to return the data into a var
here's the code I have so far, this is the first function i've ever written
in perl
I've only been using it for four days, www.codebits.com is a god sent
it actually is built to parse the POST thingy as well depending on all.
any comments on it would be much appreciated, especialy to do with var
naming, I dunno if there's any hungarian notation kinda stuff w/perl
sub hash_gpdata {
my($data_string,$method);
$DATAHASH = { };
$data_string = "";
$envdata{"QUERY_STRING"} = "Login=1";
#$envdata = $env;
$method = $_[0]; # 0 = GET, 1 = POST, NULL =
AUTO DETECT
if( exists( $envdata{'QUERY_STRING'} ) && $method != 1)
{ $data_string = $envdata{'QUERY_STRING'}; }
if( exists( $envdata{'CONTENT_LENGTH'} ) && $method != 0) {
read(STDIN, $data_string, $envdata{'CONTENT_LENGTH'});
}
if( length($data_string )){
$data_string =~ tr/+/ /;
$data_string =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",
hex($1))/eg;
@array = split(/&/,$data_string);
foreach $qsline ( @array ) {
($name,$value) = split(/=/,$qsline);
$DATAHASH{$name} = $value;
}
return($DATAHASH);
}
return(0);
}
>
>
> >and creates a hash list of all the var's
> >passed from a browser in the query string.
>
>
> A "hash slice" may help with that, see the "Slices" section in
'perldata.pod'
>
>
> --
> Tad McClellan SGML consulting
> tadmc@augustmail.com Perl programming
> Fort Worth, Texas
------------------------------
Date: Fri, 29 Jun 2001 20:31:22 +0100
From: "John Stumbles" <john.stumbles@ntlworld.com>
Subject: how to Walk/dump Win32 registry?
Message-Id: <uI4%6.31989$QM1.5174472@news2-win.server.ntlworld.com>
I need to maintain a bunch of PCs running Win95/98/NT & 2K in consistent
configurations and want to be able to change apps and configs by making the
changes on one PC and propagating them to all the others. To this end I have
it in mind to examine the filesystems, registries and various .INI files
(for win9x), noting diffs after changes and cloning to the other machines.
(Given that we have several different hardware bases and each machine can
boot into any of the OSes, making disk or partition clones using Ghost or
suchlike would be very time-sonsuming and is not an attractive option.)
Walking the filesystems is not too difficult, but the registries are more
so: using Win32::TieRegistry I can walk through at least the major key
systems, but I'm not sure how to interpret the various values I get. It
occurs to me that this is surely re-inventing the wheel: someone must
already have done this?! (ISTR that there was something like this as a
sample app in some version of Perl for Windows 95 -- PerlBuilder I think --
many years ago). Can any kind soul point me in the direction of such a
thing? (If not I am quite happy to persevere with my own efforts and share
the results with the Perl community, but with my coding skills that's more
of a threat than a promise ;-)
The other thing I'm looking for is a Perl 'diff' module. I can use an
external diff, but it would be neat to do it all 'in house' as it were.
tia
--
John Stumbles http://www.stumbles.org/John
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
------------------------------
Date: Fri, 29 Jun 2001 20:27:43 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: how to Walk/dump Win32 registry?
Message-Id: <tjpp5vq4ecd33b@corp.supernews.com>
In article <uI4%6.31989$QM1.5174472@news2-win.server.ntlworld.com>,
John Stumbles <john.stumbles@ntlworld.com> wrote:
: Walking the filesystems is not too difficult, but the registries are
: more so: using Win32::TieRegistry I can walk through at least the
: major key systems, but I'm not sure how to interpret the various
: values I get. [...]
_Managing the Windows 2000 Registry_ by Paul Robichaux[*] contains
several Perl examples, including a general Win32 registry walker and a
registry dumper. The code examples don't seem to be available on the
web, though. (FULL DISCLOSURE: I wrote the Perl section of this book
but stand to gain no financial benefit from sales of the book.)
[*] <URL:http://www.oreilly.com/catalog/mwin2reg/>
: The other thing I'm looking for is a Perl 'diff' module. I can use an
: external diff, but it would be neat to do it all 'in house' as it were.
Take a look at Algorithm::Diff, which is available on the CPAN.
Greg
--
Good times and riches and son of a bitches
I've seen more than I can recall.
-- Jimmy Buffett
------------------------------
Date: 29 Jun 2001 12:30:22 -0700
From: gaileee@yahoo.com (gail pickens-barger)
Subject: Is the Perl working...or what have I messed up now?
Message-Id: <b65ab7bb.0106291130.52ad0f0@posting.google.com>
Hi all,
I'm trying the first thing that the perl books suggest the hello
script.
I am trying to call the script from an shtml file. I have no
telnet/shell access to the unix machine that my web page is hosted on.
Here are my machine particulars:
And I am using the Apache/1.3.14 (Unix) (Red-Hat/Linux) mod_ssl/2.7.1
OpenSSL/0.9.5a PHP/4.0.4pl1 mod_perl/1.24 Web Server.
You are using Mozilla/4.0 (compatible; MSIE 5.01; Windows 98).
This server is using CGI/1.1.
.... My ISP guys claim that my permissions and directory structures
are okay. I ftp the files, chmod them then..
I access the following web page to try to test out the Perl-ness.
http://www.gpbwebworks.com/gail/hello.shtml The html code prints
out but the simple print statement in the cgi does not.
.....Files that are used..... hello.cgi, hello.shtml
hello.cgi file contents
#!/usr/local/bin/perl
print "Hello, World!\n;
...
hello.shtml file contents
<html>
<head>
<title>Hello the world</title>
</head>
<body bgcolor=#ffffff>
<center>
<h3>Title - Hello World</h3>
<!-- #exec cgi="gail/hello.cgi" --><br>
<hr>
<h3>After</h3></center>
</body>
</html>
....
The following are what my error logs say on my web site/.
Error log statements.
[Fri Jun 29 11:33:32 2001] [error] (13)Permission denied: exec of
/home/p/i/pickens/www/gail/hello.cgi failed
[Fri Jun 29 11:33:32 2001] [error] [client 66.90.152.69] Premature end
of script headers: /home/p/i/pickens/www/gail/hello.cgi
Appreciate any clues as to what to do next, or what to ask my ISP
to look into. When I had access to the shell a couple of years ago,
I was able to do scripts. There is probably something pretty obvious,
to someone else, but not to me! Thank you kindly!
Gail P-B.
------------------------------
Date: Fri, 29 Jun 2001 13:19:54 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Is the Perl working...or what have I messed up now?
Message-Id: <3B3CE2EA.BEB98CEE@stomp.stomp.tokyo>
gail pickens-barger wrote:
> I'm trying the first thing that the perl books suggest the hello
> script.
> I am trying to call the script from an shtml file.
> My ISP guys claim that my permissions and directory structures
> are okay.
This statement about permissions is untrue per my following comments
about cgi-wrap usage.
> I access the following web page to try to test out the Perl-ness.
> http://www.gpbwebworks.com/gail/hello.shtml The html code prints
> out but the simple print statement in the cgi does not.
> .....Files that are used..... hello.cgi, hello.shtml
> hello.cgi file contents
> #!/usr/local/bin/perl
> print "Hello, World!\n;
> hello.shtml file contents
> <html>
> <head>
> <title>Hello the world</title>
> </head>
> <body bgcolor=#ffffff>
> <center>
> <h3>Title - Hello World</h3>
> <!-- #exec cgi="gail/hello.cgi" --><br>
> <hr>
> <h3>After</h3></center>
> </body>
> </html>
This is untrue. Your shtml page actually contains:
<html>
<head>
<title>Hello the world</title>
</head>
<body bgcolor=#ffffff>
<center>
<h3>Title - Hello World</h3>
<!-- #exec cgi="gail/hello.cgi" --><br>
<h3>include next</h3>
<!-- #include="gail/hello.cgi" --><br>
<hr>
<h3>After</h3></center>
</body>
</html>
> The following are what my error logs say on my web site/.
> Error log statements.
> [Fri Jun 29 11:33:32 2001] [error] (13)Permission denied: exec of
> /home/p/i/pickens/www/gail/hello.cgi failed
Error number 13 is generated by a program known as cgi-wrap which
is still a beta program. Error number 13 pertains to permissions
not being set correctly; no www execute / www read permission.
Almost always, systems operators fail to configure cgi-wrap correctly.
It is possible cgi-wrap is messing up your execute call; cgi-wrap is
well known for causing more problems than does it resolve and,
again, few systems operators know how to configure cgi-wrap.
My suspicion is your server is mis-configured in many ways
based on this inexcusable error in, an error message:
The server encountered an internal error or misconfiguration
and was unable to complete your request.
Please contact the server administrator, webmaster$DomainName and....
> [Fri Jun 29 11:33:32 2001] [error] [client 66.90.152.69] Premature end
> of script headers: /home/p/i/pickens/www/gail/hello.cgi
You need to add a content type print to your script. Lack of
this content type print will not cause your script to fail
to return results to your shtml page but will generate an
error message within your server's log record.
No promises on correcting your problems.
Change your cgi script to:
#!/usr/local/bin/perl
print "Content-type: text/plain\n\n";
print "Hello World!";
exit;
Change your server side include call to:
<!--#exec cgi="gail/hello.cgi" -->
Remove the space before #exec as shown.
A correct format will be hidden from a browser.
I am somewhat surprised your script is called
with this incorrect format, but this is not
entirely impossible.
You may also try:
<!--#exec cmd="gail/hello.cgi" -->
Double check your path. You may need to use
a full path to satisfy your server's specific
configuration needs. My guess is, based on
information you are giving, your call should be:
<!--#exec cgi="hello.cgi" -->
Your script resides in the same directory as your
shmtl file. No need to include "gail/" in your call,
unless a full path is needed per server configuration.
For testing, set your script permissions to 777.
With successful testing, reset your permissions
to 755. With success, try 711 for permissions
to establish high security. Mode 711 is not
allowed on all servers. Test this well.
Do not leave persmissions set to 777 save
for testing; this is a security risk.
Your directory containing your shtml file may
also need to have execute permissions turned
on as well, including parent directories.
A lot of your problem resolution centers
on server configuration. You may need to
experiment extensively to discover what
methods work and, what methods do not.
Based upon my research of your server,
you would be well advised to use some
skepticism regarding what your server
technicians tell you.
Godzilla!
------------------------------
Date: Fri, 29 Jun 2001 18:45:09 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: limiting cgi input from specific IP's
Message-Id: <tjpj5lgfm28e@corp.supernews.com>
Gordon Vrdoljak (vrdoljak@uclink.berkeley.edu) wrote:
: Is it possible to limit some perl/cgi scripts so that they can only be
: run from certain ip addresses?
That's generally easier to manage at the web server level than at the
script level. See
http://www.nswc.navy.mil/ISSEC/Docs/Ref/GeneralInfo/web_server.html
for some useful discussion.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Magick is the art and science of causing change in conformity
| with Will." - Aleister Crowley
------------------------------
Date: Fri, 29 Jun 2001 14:46:21 -0400
From: Andras Malatinszky <andras@mortgagestats.com>
Subject: Re: limiting cgi input from specific IP's
Message-Id: <3B3CCCFD.B09888AA@mortgagestats.com>
Gordon Vrdoljak wrote:
> hello,
> Is it possible to limit some perl/cgi scripts so that they can only be run from
> certain ip addresses?
> Gordon
>
> --
> \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
> Gordon Ante Vrdoljak Electron Microscope Lab
> ICQ 23243541 http://nature.berkeley.edu/~gvrdolja 26 Giannini Hall
> vrdoljak@uclink.berkeley.edu UC Berkeley
> phone (510) 642-2085 Berkeley CA 94720-3330
> fax (510) 643-6207 cell (510) 290-6793
Your script could read the remote_host() environment variable and then execute or
exit based on what it finds. Read the docs for CGI.pm for details.
Alternatively -- and this has nothing to do with Perl -- you can probably set up
your server to allow or deny access based on the IP address of the remote host. If
you have the Apache server, you might want to look at .htaccess.
------------------------------
Date: Fri, 29 Jun 2001 12:42:05 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: limiting cgi input from specific IP's
Message-Id: <3B3CDA0D.6BA52EF9@stomp.stomp.tokyo>
Andras Malatinszky wrote:
> Gordon Vrdoljak wrote:
(snippage)
> > Is it possible to limit some perl/cgi scripts so that they can only be run from
> > certain ip addresses?
> Your script could read the remote_host() environment variable and then execute or
> exit based on what it finds. Read the docs for CGI.pm for details.
Many local servers have remote host name lookup disabled for
efficiency. Just as many remote servers do not provide a
host name. Caution is advised pertaining to reliance upon
a host name for critical program operations.
Godzilla!
------------------------------
Date: Fri, 29 Jun 2001 13:52:15 -0700
From: "news.sohoskyway.com" <jestersi@metacrawler.com>
Subject: Re: limiting cgi input from specific IP's
Message-Id: <3b3ce9fb$1_1@sohoskyway.net>
"Craig Berry" <cberry@cinenet.net> wrote in message
news:tjpj5lgfm28e@corp.supernews.com...
> Gordon Vrdoljak (vrdoljak@uclink.berkeley.edu) wrote:
> : Is it possible to limit some perl/cgi scripts so that they can only be
> : run from certain ip addresses?
>
> That's generally easier to manage at the web server level than at the
> script level. See
>
> http://www.nswc.navy.mil/ISSEC/Docs/Ref/GeneralInfo/web_server.html
>
> for some useful discussion.
>
> --
> | Craig Berry - http://www.cinenet.net/~cberry/
> --*-- "Magick is the art and science of causing change in conformity
> | with Will." - Aleister Crowley
You should read the book "Satan wants me" is a good read and some of the
plot has to do w/mr. crowley
although they kinda depict him as a fat heroine addict.
------------------------------
Date: 29 Jun 2001 11:21:57 -0700
From: dshane@qual-pro.com (Darrell Shane)
Subject: Net::DNS zone transfer requires that transfer-format be set to one-answer
Message-Id: <f9941d63.0106291021.ab32a72@posting.google.com>
It appears that using Net::DNS to perform a zone transfer (the axfr
method) requires that the nameserver return one record per packet. If
not, axfr randomly returns an empty list.
Has anyone else experienced this?
Regards,
Darrell Shane
------------------------------
Date: Fri, 29 Jun 2001 18:10:16 GMT
From: David <ddNOSPAM0001@yahoo.com>
Subject: Re: PERL and CGI under NT IIS
Message-Id: <3B3CC488.39803AA6@yahoo.com>
SOLUTION: pieced together with the NT admin - this was guesswork and
some science:
Sample:
$myName = "formatDataCool.pl";
$ACMMFile = $ENV {"PATH_TRANSLATED"};
$ACMMFile =~ s/$myName/datafile.dat/;
This should work on any NT server.
Pardon me, but what do IHMO and IMNHSO mean?
nobull@mail.com wrote:
>
> David <nospamdd0001@yahoo.com> writes:
> > Subject: PERL and CGI under NT IIS
>
> > $testData = "testdata.dat";
>
> > open (TESTDATA, $testData) or &crash ("Can't open $testData:
> > $OS_ERROR");
>
> > testdata.dat is in the same folder and contains:
>
> The GCI standard makes no stipulation about the setting of the current
> working directory when a CGI script is invoked. (IHMO this was a
> mistake).
>
> Most Unix web servers will set the CWD to the directory containing the
> script anyhow. (IMNSHO this should be stipulated by CGI).
>
> IIS runs CGI scripts with a different CWD (server root IIRC). (IMNHSO
> this was bloody-mindedness).
>
> This, of course, has nothing to do with Perl.
>
> > now is the time for all good men to get their PERL scripts running
>
> "Good men" know that it's "Perl" not "PERL".
>
> --
> \\ ( )
> . _\\__[oo
> .__/ \\ /\@
> . l___\\
> # ll l\\
> ###LL LL\\
------------------------------
Date: Fri, 29 Jun 2001 20:30:32 -0000
From: Gasper <gasperds@rediffmail.com>
Subject: Perl/CGI script to validate email addresses
Message-Id: <tjppb8kdrqvl9f@corp.supernews.com>
I am currently a webmaster for a small news site. We accept email
addresses to send daily news letters as well as for registration to post
messages on our message board.
For this, it is important that the email addresses are valid.
Is there any cgi-script to automatically validate an email address?
Thanks
Gasper.
--
Posted via CNET Help.com
http://www.help.com/
------------------------------
Date: Fri, 29 Jun 2001 13:46:53 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl/CGI script to validate email addresses
Message-Id: <3B3CE93D.2F5978F6@stomp.stomp.tokyo>
Gasper wrote:
(snippage)
> Is there any cgi-script to automatically validate an email address?
No. Validation of email addresses is impossible short of
sending email to an address and receiving a valid response
either directly or indirectly.
As an alleged webmaster, you should know to read about
and research this topic well. Extensive documentation
is available via Perl sites and other resources.
You will discover upon performing appropriate homework,
as any truly professional webmaster would, your best
success rate at validation of email addresses will
be less than ninety percent, usually much less.
As an example, your own email address is not a valid address.
Godzilla!
------------------------------
Date: Fri, 29 Jun 2001 20:59:52 GMT
From: pontz@NO_SPAMchannel1.com (Brian Pontz)
Subject: Re: Perl/CGI script to validate email addresses
Message-Id: <3b3cebc7.76427844@news.ne.mediaone.net>
>Is there any cgi-script to automatically validate an email address?
http://www.perl-news.com/search/search-perl?new=validate+email+address
perldoc -q 'valid mail address'
Brian
------------------------------
Date: Fri, 29 Jun 2001 12:15:41 -0700
From: Michael Budash <mbudash@sonic.net>
Subject: Re: Regexp problem
Message-Id: <mbudash-BC62CC.12154129062001@news.pacbell.net>
In article <9hh929$1rb3$1@scavenger.euro.net>, "Jan Klaverstijn"
<jan@klaverstijn.nl> wrote:
> Hi all,
>
> This is what looks to me a simple regexp challenge but it drove me crazy.
> I'm clearly a newbie at Perl regexp's. So now I turn to you.
>
> What I want is to extract the date from a mail header line. The "Date:"
> line
> comes can have an optional timezone at the end. That timezone must be
> stripped, together with the Date: at the beginning.
>
> Date: Mon, 25 Jun 2001 17:56:26 +0200 (CEST)
>
> If the timezone was always there it would be easy: $date = $1 if
> /^Date:\s(.+)\s(\(.+\))/;
> But this fails to match when the timezone is not there.
>
> Date: Mon, 25 Jun 2001 17:56:26 +0200
>
> I thought making the timezonepart optional: (\(.+\))?. No luck.
>
> How should I approach this to make it work with a single regular
> expression?
as an alternative, how 'bout not using a regexp at all?
join " ", (split(/\s+/))[1..6];
hth-
--
Michael Budash ~~~~~~~~~~ mbudash@sonic.net
------------------------------
Date: 29 Jun 2001 12:19:35 -0700
From: lxl22@visto.com (Xtreme)
Subject: Re: regular expression problem
Message-Id: <91ff860e.0106291119.2d7ff730@posting.google.com>
Ren Maddox <ren@tivoli.com> wrote in message news:<m3ofrg9l8y.fsf@dhcp9-173.support.tivoli.com>...
> On 22 Jun 2001, lxl22@visto.com wrote:
>
> > jacklam@math.uio.no (Peter J. Acklam) wrote in message
> > news:<cxclmmk388v.fsf@masterblaster.uio.no>...
> >> lxl22@visto.com (Xtreme) wrote:
> >>
> >> > Assuming I have a string of the form "a_b_b_c" in which I don't
> >> > know how many "b_" substrings it has, how can I, in one single
> >> > s/// line replace every b_ for a "x_"? My main problem is that
> >> > I don't know how to tell the re engine how to replace it the
> >> > same number of times as it occurred.
> >>
> >> s/b_/x_/g;
> >
> > Thanks, Peter. I had forgotten to mention that a,b and c can each be
> > distinct or the same -- I don't know ahead of time, and that I don't
> > want to replace a or c (i.e. not the first or last in the string). I
> > figured it out in the mean time by going through (of all things) the
> > faq:
> > s/\G_b_/_x_/g;
> > I still don't really grasp the \G, but it works!
>
> Wow.
>
> I'm not sure what's going on there, as \G does not appear to have a
> defined behavior in a global substitute. And the behavior it exhibits
> certainly isn't what I would expect. In fact, the behavior I see
> doesn't achieve your stated goal:
Apologies for starting this thread up again, but I stumbled upon
something when I was looking for something completely different. In
perlfaq6, under the question "What good is \G in a regular
expression?" I read the following:
<quoted>
The notation \G is used in a match or substitution in conjunction with
the /g modifier to anchor the regular expression to the point just
past where the last match occurred, i.e. the pos() point.
</quoted>
A little lower down, an example is given:
<quoted>
s/\G>/:/g;
</quoted>
This leads me to believe that, as opposed to what was discussed in
this thread, \G in conjunction with a /g *is* valid.
Cheers,
Xtreme
------------------------------
Date: 29 Jun 2001 12:03:06 -0700
From: isterin@hotmail.com (isterin)
Subject: Re: releasing array memory
Message-Id: <db67a7f3.0106291103.536e773f@posting.google.com>
nobody@nowhere.com wrote in message news:<iuPR6.741$v4.27959@www.newsranger.com>...
> I have a tool which runs in the background.
>
> I use an array @arrayname to store the data in it.
> for eg,
> while (1) {
> @arrayname = `cat filename` ;
> do processing ..
> undef @arrayname ;
> sleep(30);
> }
>
> Is this a proper procedure to release memory associated with @arrayname.
Yes it is. It will completely undefine (empty) the array.
Ilya
>
> I don't want memory leak in my code.
>
> Thanks.
------------------------------
Date: Fri, 29 Jun 2001 19:47:41 GMT
From: "Thing" <noemail@noemail.com>
Subject: SMTP, should be simple
Message-Id: <xX4%6.4960$eL5.509322@newsread1.prod.itd.earthlink.net>
is there an obvious reason that this does not work ? I telnet and run the
commands, and it doesnt work.
#!/perl/bin/perl.exe
use CGI qw/:standard/;
use Socket;
my $sock = IO::Socket::INET->new (PeerAddr => 'NTSRV4',
PeerPort => 'smtp(25)',
Proto => 'tcp');
print $sock "HELO\r\n";
print $sock "MAIL From:dr@insurance.com";
print $sock "RCPT To:dr@insurance.com\r\n";
print $sock "DATA\r\n";
print $sock "Subject: NT";
print $sock "\r\n";
print $sock "This was from Perl\r\n";
print $sock ".\r\n";
print $sock "QUIT";
close ($sock)
------------------------------
Date: Fri, 29 Jun 2001 20:54:37 GMT
From: pontz@NO_SPAMchannel1.com (Brian Pontz)
Subject: Re: SMTP, should be simple
Message-Id: <3b3cea57.76059865@news.ne.mediaone.net>
>print $sock "MAIL From:dr@insurance.com";
Dont you need a newline for this? And you need to escape the '@'s as
well if your going to use double qoutes..
Brian
------------------------------
Date: 29 Jun 2001 13:40:04 -0700
From: msrividya@yahoo.com (mahesh)
Subject: undef question.
Message-Id: <5ba0862f.0106291240.2b35560a@posting.google.com>
Hi
I am trying to use 'undef' as boolean.
for example
sub x {
my @x;
if (some condition) {
return undef;
} else {
return @x;
}
}
@y = x();
if (@y) {
print "True";
} else {
print "false";
}
This is not working when I return an array. @y says it is defined always.
Any suggestions.
thanks
mahehs
------------------------------
Date: Fri, 29 Jun 2001 21:23:34 GMT
From: clintp@geeksalad.org (Clinton A. Pierce)
Subject: Re: undef question.
Message-Id: <ql6%6.141669$DG1.23612663@news1.rdc1.mi.home.com>
[Posted and mailed]
In article <5ba0862f.0106291240.2b35560a@posting.google.com>,
msrividya@yahoo.com (mahesh) writes:
> Hi
>
> I am trying to use 'undef' as boolean.
> for example
>
> sub x {
> my @x;
> if (some condition) {
> return undef;
Don't do this. Just:
return;
In a scalar context the return value is "undef", in a list context it's
an empty list (conveniently false).
--
Clinton A. Pierce Teach Yourself Perl in 24 Hours *and*
clintp@geeksalad.org Perl Developer's Dictionary
"If you rush a Miracle Man, for details, see http://geeksalad.org
you get rotten Miracles." --Miracle Max, The Princess Bride
------------------------------
Date: Fri, 29 Jun 2001 19:22:32 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: unix `ps`
Message-Id: <Yz4%6.18595$P5.5841196@news1.rdc1.tn.home.com>
My server was rooted today by some script-kiddie, and ls, ps, and du were
trojaned. Is there a way to list all the pids and process names with perl,
similar to the unix ps but without all the options?
------------------------------
Date: Fri, 29 Jun 2001 15:22:51 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: unix `ps`
Message-Id: <3B3CE39B.453EB1F@uswest.com>
Todd Smith wrote:
> My server was rooted today by some script-kiddie, and ls, ps, and du were
> trojaned. Is there a way to list all the pids and process names with perl,
> similar to the unix ps but without all the options?
I think Proc::ProcessTable does what you want. It's on CPAN.
Regards,
Dan
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 1220
***************************************