[7034] in Perl-Users-Digest
Perl-Users Digest, Issue: 659 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 25 06:07:14 1997
Date: Wed, 25 Jun 97 03:00:37 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 25 Jun 1997 Volume: 8 Number: 659
Today's topics:
Re: ***How to get info from the HTML files in other ser (Bob)
Re: a string to an array <ajohnson@gpu.srv.ualberta.ca>
Re: a string to an array (Clay Irving)
Re: a string to an array <flg@vhojd.skovde.se>
Re: back quote problem <Tony.Arnold@mcc.ac.uk>
calling perl from within .bat files <scott_clark@merck.com>
Re: Can I step out in perldb? <joe@harp.gsfc.nasa.gov>
Re: Checking a string for "@' and "." <rra@stanford.edu>
checking for blanks (Ed Lufker)
Re: checking for blanks <esupu@warwick.ac.uk>
DB_File Locking (open) (Brian Mathis)
Re: distributed objects in perl <sfairey@adc.metrica.co.uk>
Re: get end of string (easy question) (Clay Irving)
Grade my first Perl Project (Brian Foddy)
Re: Help with script <sfairey@adc.metrica.co.uk>
How do I read password when using basic authentication? <gangadhar_vaddepalli@dbna.com>
IO::File / 5.004_01 problem jimenez@houston.omnes.net
Re: IO::File / 5.004_01 problem (M.J.T. Guy)
Is perl support recursion <chiyung@b1.hkstar.com>
Re: long file rename to 8.3 (Tim Smith)
Re: Making a MUD with CGI carl@tradewinds.com
match within a number range (Darwin O.V. Alonso)
Re: microsoft personal web server parsing perl scripts (J.R. Dean)
Re: need help in sockets - test a port is all (Magnus Bodin)
New beginner to Perl <kbrown@ee.net>
Re: New beginner to Perl <rootbeer@teleport.com>
Newbie question: 500 Server Error <ip201945@ip.pt>
Re: Newbie: 500 Server Error message (Billy Chambless)
Re: OOP - class variables and inheritance? <friedman@uci.edu>
Re: Passing object references to a subroutines <sfairey@adc.metrica.co.uk>
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 24 Jun 1997 02:18:14 GMT
From: xxbbell@voicenet.com (Bob)
Subject: Re: ***How to get info from the HTML files in other server??***
Message-Id: <5onb4v$9rk$1@news2.voicenet.com>
Jens M Andreasen <jens-and@NO.dsv.su.se.SPAM> wrote:
>You can use:
>
> lynx -dump http://www.somewhere/path/file.html | grep whatever
>
>This will give a text only output. If you want to keep the formatting use:
>
> lynx -source etc etc
>
Or, if you can telnet easily, telnet to port 80 yourself and
make the request.
--
- Bob
http://www.voicenet.com/~bbell
xxbbell@voicenet.com
remove x's to reply
------------------------------
Date: Tue, 24 Jun 1997 14:19:37 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: a string to an array
Message-Id: <33B01DC9.4D1F712E@gpu.srv.ualberta.ca>
mike mah wrote:
>
> > I'm pretty new to the perl language, but have come to love it. I just
> > have one question. Is it possible to convert a string to an array of
> > letters. Like converting "HELP" to (H,E,L,P)? If so, how cna I do
> > this.
> You can try the code below although there is a lot of better way
> to do it.
> #!/usr/local/bin/perl -w
> $a= "d.jfdksfj";
> $a=~ s/(\S)/\1\t/g;
> @a= split(/\s/,$a);
> print @a;
>
> Hope it helps.
>
$_="HELP";
@array=split //;
regards
andrew
------------------------------
Date: 23 Jun 1997 22:07:31 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: a string to an array
Message-Id: <5ona53$c8q@panix.com>
In <33AEC935.6D30@rose-hulman.edu> "Jason D. Borneman" <Jason.D.Borneman@rose-hulman.edu> writes:
>I'm pretty new to the perl language, but have come to love it. I just
>have one question. Is it possible to convert a string to an array of
>letters. Like converting "HELP" to (H,E,L,P)? If so, how cna I do
>this.
#!/usr/local/bin/perl5.003 -w
$word = "HELP";
@chars = split //, $word; # split into individual characters and put in
# an array called chars
foreach (@chars) { # foreach element in the array
print; # - print it
print "\n"; # - print a newline
}
Prints:
H
E
L
P
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 24 Jun 97 06:34:25 GMT
From: "Fredrik Lindberg" <flg@vhojd.skovde.se>
Subject: Re: a string to an array
Message-Id: <01bc8068$aa5ff220$e20f10c2@odens.di.vhojd.skovde.se>
Jason D. Borneman <Jason.D.Borneman@rose-hulman.edu> wrote in article
<33AEC935.6D30@rose-hulman.edu>...
> I'm pretty new to the perl language, but have come to love it. I just
> have one question. Is it possible to convert a string to an array of
> letters. Like converting "HELP" to (H,E,L,P)? If so, how cna I do
> this.
I guess you've seen the "@chars = split(//,$string)" solution by now
but since there are so many, here is one other way of doing it (but
it is slower than split though)
@chars = /(.)/g; # Assuming $_ contains letters.
The (.) will capture each character in the string
and the /g modifier will iterate over the string.
Note that this way, it doesnt match newline.. You can
fix this by either using the /s modifier, or use
a regexp like this ([\x00-\xff]), instead of the dot.
/Fredrik
------------------------------
Date: 24 Jun 1997 13:21:20 GMT
From: "Tony Arnold" <Tony.Arnold@mcc.ac.uk>
Subject: Re: back quote problem
Message-Id: <01bc80a1$6f5eb920$96c95882@aca.mcc.ac.uk>
I found the answer to this problem, after much experimenting!
It turns out that this operation gets messed up by my anti virus package
VET. Disable the real time file and macro virus detection solves the
problem.
Tony Arnold <Tony.Arnold@mcc.ac.uk> wrote in article
<01bc7d93$c27f04e0$96c95882@aca.mcc.ac.uk>...
> I am running Perl 5.001 on a Windows 95 system both in the office and on
my
> home machine and they behave differently! So far as I can I'm running the
> same version of everything, but one machine is a Pentium 166MMX and the
> other is a Cirix 586 33Mhz 4x system.
>
> The following perl script shows up the problem:
>
> $cd = `cd`;
> print "CD = $cd\n";
>
> On the Cirix system it does just what you would expect. On the 166
system,
> the cd command gets executed but its output goes to the screen and the
$cd
> variable gets assigned an empty string.
------------------------------
Date: Tue, 24 Jun 1997 20:31:34 -0700
From: "S. Clark" <scott_clark@merck.com>
Subject: calling perl from within .bat files
Message-Id: <33B09116.4BB5@merck.com>
Hello,
I am looking for an example of calling perl scripts from within DOS batch
files with the capability of parsing out the switches or trailing
agruements on the command line such as filenames to pass to perl??
Any leads would be great...
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.
------------------------------
Date: Tue, 24 Jun 1997 18:37:15 -0400
From: Joe McMahon <joe@harp.gsfc.nasa.gov>
Subject: Re: Can I step out in perldb?
Message-Id: <33B04C17.1277@harp.gsfc.nasa.gov>
To finish the current routine and return, use "r".
--- Joe M.
------------------------------
Date: 24 Jun 1997 15:47:12 -0700
From: Russ Allbery <rra@stanford.edu>
Subject: Re: Checking a string for "@' and "."
Message-Id: <m3bu4vboun.fsf@windlord.Stanford.EDU>
Scott Blanksteen <sibsib@hotmail.com> writes:
> Dean Hollister wrote:
>> Can anyone point me to the required code to check whether or not a
>> string has BOTH the "@" and "." characters in it?
> if ( index($string, '@') + index($string, '.') > -2 ) {
> # you didn't set the '$[' variable, did you?
> print "Got both!\n";
> }
Er?
$string = 'Some string with no at sign but with a period.';
if (index ($string, '@') + index ($string, '.') > -2) {
print "Whoops! Looks like that didn't work quite right.\n";
}
prints out
Whoops! Looks like that didn't work quite right.
Addition will reach out and bite you every time. :)
--
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
------------------------------
Date: 24 Jun 1997 17:13:03 GMT
From: elufker@swcp.com (Ed Lufker)
Subject: checking for blanks
Message-Id: <5oov6v$oa1$1@sloth.swcp.com>
Hi All:
I have the need to check for blanks or alphanumeric data in $_,
how would a line like that look in perl.
I have something like this:
$i[$x]=($_);
if ($i[$x] == " ") I don't know what to put in the " ".
Everything I have tried gives an error.
thanks in advance
eddie lufker
------------------------------
Date: Tue, 24 Jun 1997 23:49:07 +0100
From: mike mah <esupu@warwick.ac.uk>
To: Ed Lufker <elufker@swcp.com>
Subject: Re: checking for blanks
Message-Id: <Pine.SOL.3.95.970624234640.16620A-100000@lupin>
|
| I have the need to check for blanks or alphanumeric data in $_,
|how would a line like that look in perl.
try this
if (/\s/){ do something} #\s stands for tab, space, and
other blank.
Hope this helps.
--
Yours sincerely,
Mike Mah
First year computer systems engineering student.
University of Warwick
http://www.warwick.ac.uk/~esupu
------------------------------
Date: 24 Jun 1997 9:21:55 GMT
From: gentry@csh.rit.edu (Brian Mathis)
Subject: DB_File Locking (open)
Message-Id: <M6+RsD.pOC@csh-newsserver.csh.rit.edu>
I was looking at the DB_File docs, and under the locking section I
noticed something I thought was strange. The 'open' that is used to
get the file descriptor of the DB object:
$db = tie(%hash, "DB_File", database.dbm, O_RDWR, 0, $DB_HASH);
$fd = $db->fd();
open(DBFILE, "+<&=$fd");
What Im confused about is the '=' sign in the open. The '+<' would open
the file for read/write. the '&' would presumably cast $fd to a
function (as $db->fd() returns a reference to a function that will
return the file descriptor). So that leaves the '=' sign. ????
Brian Mathis
--
Brian Mathis gentry@csh.rit.edu
Computer Science House http://www.csh.rit.edu/~gentry
PGP Public key: finger gentry@csh.rit.edu
Fingerprint: 5A 44 8F FA 2D 27 93 6C AF 64 84 38 7D 92 4E 8C
------------------------------
Date: Tue, 24 Jun 1997 16:45:50 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: distributed objects in perl
Message-Id: <33AFEBAE.1372@adc.metrica.co.uk>
Randal Schwartz wrote:
>
> >>>>> "German" == German Cancio Melia <German.CancioMelia@cern.ch> writes:
>
> German> PS. I forgot to say that I cannot use Perl/Tk since the system has to
> German> be 100% reliable.
>
> There's no such thing. What do you *really* mean?
>
I would imagine he means not a standard recognised package like an
operating system which comes with formal support lines. I spent a
considerable amount of time convincing superiors at my last company that
the support you get for Perl/Tk etc can often be far better, cheaper and
faster than you will get paying for overpriced support contracts.
You will be pleased to know that I won :) ( thanks to some speedy
responses to the odd problem I had ) and that now a rather well know
international petroleum company and also a large UK building society
both use Perl/Tk in the solution we provided them.
Simon 'I used to be a novice, now I can answer some problems!!' Fairey.
------------------------------
Date: 23 Jun 1997 22:00:08 -0400
From: clay@panix.com (Clay Irving)
Subject: Re: get end of string (easy question)
Message-Id: <5on9n8$amj@panix.com>
In <33ADE513.47E8@cs.berkeley.edu> Cathy Huang <cathyh@cs.berkeley.edu> writes:
>Say
>$IMAGE = http://www.women.com/guide/guide/gifs/nav.7.gif
>This is wrong:
>---------------------
>if ($IMAGE =~ /\/(.*?)$/i)
> {
> $END = $+;
> }
>-----------------------
>$END = /www.women.com/guide/guide/gifs/nav.7.gif
>------------------------
>How can I get $END = nav.7.gif? I just want to get the string between
>the last / and the end of the line.
Try:
#!/usr/local/bin/perl5.003
$IMAGE = "http://www.women.com/guide/guide/gifs/nav.7.gif";
@split_path = split /\//, $IMAGE; # split on /
$END = "$split_path[$#split_path]\n"; # get the last element of the array
--
Clay Irving See the happy moron,
clay@panix.com He doesn't give a damn,
http://www.panix.com/~clay I wish I were a moron,
My God! Perhaps I am!
------------------------------
Date: 25 Jun 1997 03:21:04 GMT
From: bkfoddy@skypoint.com (Brian Foddy)
Subject: Grade my first Perl Project
Message-Id: <5oq2r0$ilo$1@shadow.skypoint.net>
Hi all,
I just finished my first Perl project and I thought I'd
post the problem and my code to see how the experts would
grade my work.
First the problem: You have two files.
"UserFile" contains lines like this:
===============================================
*connectionModule: UTSTCP
*terminalModule: UTS
*fileTransferModule:
*connectionSettings: Terminal: uts60\n\
Connection: tp0\n\
Hostname: 139.72.100.50\n\
Application: TIP\n\
Message: ^\n\
TSAP: TIPCSU\n\
ID: LA025179\n\
Session: MSG 25179
Caption: LA025179\n\
"ControlFile" contains lines like this:
=================================================
ID: LA0999\n\
Session: Session Here
Caption: Title Here\n\
The Control file contains override values for the User file.
Substitute the values from the Control file for the corresponding
values in the User file, and create a new User file with the
merged result. So the new file should look like:
*connectionModule: UTSTCP
*terminalModule: UTS
*fileTransferModule:
*connectionSettings: Terminal: uts60\n\
Connection: tp0\n\
Hostname: 139.72.100.50\n\
Application: TIP\n\
Message: ^\n\
TSAP: TIPCSU\n\
ID: LA0999\n\
Session: Session Here
Caption: Title Here\n\
There can be any (but limited) number of control lines, and any
number of User lines.
My solution:
=====================
#!/usr/bin/perl
{
open (Control, "<./pid.1") || die "Cannot open pid file\n";
open (UserFile, "<./unisys.1.xwp") || die "Cannot open User file\n";
open (NewFile, ">./temp.1.xwp") || die "Cannot open new temp file\n";
@control = <Control>; #read a limited number of controls
while ($line = <UserFile>)
{
foreach $control (@control)
{
$control =~ /\b(.+:)/; # Find string before :
$test = $1; # the test string
$new_value = $'; # the value
if ($line =~ /(\b$test)/) # match on word in $line
{
$pre = $`; # anything before string
$line = $pre. $1. $new_value; #build the new string last; # out of
foreach loop
}
}
print NewFile $line;
}
}
=====================
Some whiz with regular expressions and substitutions could probably
write this in a couple lines, not me. I had the roughest time
with the expressions I used. 'C' doesn't use them, and I felt it
was a cop-out to use something like the C string functions.
So there you go. Give me your honest impressions and grades. And
if somebody wants show me "How it should be done", feel free, I won't
be hurt.
Brian Foddy
Eagan, MN
------------------------------
Date: Tue, 24 Jun 1997 12:10:27 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
Subject: Re: Help with script
Message-Id: <33AFAB23.ABD@adc.metrica.co.uk>
Eric Blessner wrote:
>
> Hello, I dont really know alot about perl but I do need help with a script.
> Someone wrote this script for me and Im almost there but I would really
^^^^^^^
Shoot him or her :)
> appreciate any help.
>
> Here is what I have. The script pulls the data out of a flat file and loop
> through until finished. My problem is I dont know how to do a if else
> statement. I want the first if to run and just output the data. If it does
> not qualify I want it to run the next senerio. Everytime I try it with the
> if and else I get a server area. Please help
>
> Code before.
Um it looks like your {} have got a bit out of sync..
> while (<F>) {
>
> &getfields();
>
> if($JobCategory eq "Development and Fund Raising"){
> &listitem3();
>
> }
^
This one matches with the previous if()
> next if ($jobcat ne $JobCategory);
> &listitem();
> }
^
While this one matches with the while()
> } elsif ($command eq "jobcode") {
^
So this little piggy has no-one to match with :(
If you want the elsif to be paired with the first if then try:
while (<F>) {
&getfields();
if($JobCategory eq "Development and Fund Raising"){
&listitem3();
} elsif ($command eq "jobcode") {
rest of code...
}
}
> next if ($jobcat ne $JobCategory);
> &listitem();
Not sure where you want these lines so you can slot them in where you
like.
I find <ctrl>% in vi when you are positioned over a '(' or '{' is very
useful for detecting these sort of errors.
Have fun.
Simon
------------------------------
Date: Mon, 23 Jun 1997 11:23:51 -0400
From: Gangadhar <gangadhar_vaddepalli@dbna.com>
Subject: How do I read password when using basic authentication?
Message-Id: <33AE9507.5169@dbna.com>
Hello,
Can any body out there know how to read the password entered in the
dialog box when using HTACCESS basic authentication?
I am using Apache web server.
Thanks
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Gangadhar Vaddepalli, 47 Grace St, Jersey City, NJ -07307
Voice: 201-222-5033(R), 212-469-5027(W)
Email: gangadhar_vaddepalli@dbna.com
------------------------------
Date: Mon, 23 Jun 1997 19:11:43 -0600
From: jimenez@houston.omnes.net
Subject: IO::File / 5.004_01 problem
Message-Id: <867109301.15869@dejanews.com>
I'm having a really weird problem w/ IO::File and perl
5.004_01. basicly, my problem is with the following script:
---------BEGIN-----------
#!/usr/bin/perl -w
use diagnostics;
use IO::File;
sub test_sub {
return @_;
}
my $functionRef = \&test_sub;
my $HANDLE = new IO::File;
open($HANDLE, ">out");
#print to bogus file handle, compiles OK
print HANDLE &{$functionRef}("bogus");
#dereference function, place output in temp variable, print temp variable
to
#handle, compiles OK
$output = &{$functionRef}("bogus");
print $HANDLE $output;
#dereference function ref, print result to handle,
#compiles OK
print $HANDLE &{$functionRef};
close($HANDLE);
#dereference function ref, give it arguments, print result to handle,
#blows up with:
# syntax error at ./doit line 37, near "}("
# Execution of ./doit aborted due to compilation errors (#1)
#
# (F) The final summary message when a Perl compilation fails.
#
# Uncaught exception from user code:
# Execution of ./doit aborted due to compilation errors.
print $HANDLE &{$functionRef}("bogus");
close($HANDLE);
----------END-------------
I've gone over and over this, but I'm stuck. if anyone can tell
me what obvious item I've missed, or if this is in fact a bug, I'd be most
appreciative
-------------------==== Posted via Deja News ====-----------------------
http://www.dejanews.com/ Search, Read, Post to Usenet
------------------------------
Date: 24 Jun 1997 12:48:46 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: IO::File / 5.004_01 problem
Message-Id: <5oofne$lae@lyra.csx.cam.ac.uk>
In article <867109301.15869@dejanews.com>, <jimenez@houston.omnes.net> wrote:
>#dereference function ref, give it arguments, print result to handle,
>#blows up with:
># syntax error at ./doit line 37, near "}("
># Execution of ./doit aborted due to compilation errors (#1)
>#
># (F) The final summary message when a Perl compilation fails.
>#
># Uncaught exception from user code:
># Execution of ./doit aborted due to compilation errors.
>print $HANDLE &{$functionRef}("bogus");
This seems to be a case of Perl's sailing-close-to-the-wind near-ambiguous
syntax. You can circumvent the problem with
print $HANDLE +&{$functionRef}("bogus");
or
print $HANDLE (&{$functionRef}("bogus"));
I've passed this on to perlbug in case it's considered a bug rather than
a feature.
Mike Guy
------------------------------
Date: Tue, 24 Jun 1997 13:58:42 +0800
From: Aldoliu Chan <chiyung@b1.hkstar.com>
Subject: Is perl support recursion
Message-Id: <Pine.SOL.3.95.970624135821.12505A-100000@b1.hkstar.com>
Hi,
As title. Thanks.
Cheers,
Aldoliu Chan
==========================================================================
Senior Programmer e-mail: aldoliu@mailhost.net
Citybus Limited chiyung@hkstar.com
(HONG KONG) isbyron@citybus.com.hk
------------------------------
Date: 24 Jun 1997 06:44:34 -0700
From: trs@azstarnet.com (Tim Smith)
Subject: Re: long file rename to 8.3
Message-Id: <5ooj02$3lg@web.azstarnet.com>
In article <33AFCCC9.6201@adc.metrica.co.uk>,
Simon Fairey <sfairey@adc.metrica.co.uk> wrote:
>next if !/^(........).*\.(...)$/;
substr might be easier on the eyes ;-).
Tim
------------------------------
Date: Wed, 25 Jun 1997 02:26:30 GMT
From: carl@tradewinds.com
Subject: Re: Making a MUD with CGI
Message-Id: <33b08121.3232725@netnews.worldnet.att.net>
On Mon, 23 Jun 1997 18:36:04 -0600, darkmanlives@hotmail.com wrote:
>Hi all,
>
>I need to know how I can make a multi-user-dungeon with Perl 5.0...
>it can be done, I've seen it, but I am quite new at Perl so be
>patient with me while I explain... I want to make a small adventure
>game in CGI for telnet... So, if you could give me a brief overview
>of what I need and how to use it, I would be very greatful.
>
Dave,
I have no idea. I'm sure it's probably easy to make a "dungeon" style
game, but i'm not sure how to implement the multiuser part...using
only PERL.
actually, I've been toying with doing something similar using Visual
C++ to create activeX controls. the limitation would be that users
would most likely only be able to play if they have MS INternet
Explorer 3.0 or better.
What system area you planning to develop this for? Unix? NT?
and what kind of internet connection will you be using?
I am coming to PERL from C so i'm not an expert, but sounds like an
interesting project. I'd love to hear more about it!
Thanks
carl@tradewinds.com
------------------------------
Date: 23 Jun 1997 21:38:28 GMT
From: dalonso@u.washington.edu (Darwin O.V. Alonso)
Subject: match within a number range
Message-Id: <5omqck$13ao@nntp6.u.washington.edu>
Is there a more concise way to match within a number range
than the following (@F are the fields):
if ($F[0] >= 10 && $F[0] <= 20 ){...}
(preferably one that works with floats as well as integers)
It becomes very confusing when I do the following:
if (
($F[0] >= 10 && $F[0] <= 20 ) && ($F[1] >= 30 && $F[1] <= 60 )
||
($F[1] >= 10 && $F[1] <= 20 ) && ($F[0] >= 30 && $F[0] <= 60 )
){...}
Thanks,
Darwin
------------------------------
Date: Wed, 25 Jun 1997 05:32:43 GMT
From: jrd@spam.blows_see.sig (J.R. Dean)
Subject: Re: microsoft personal web server parsing perl scripts
Message-Id: <5oqai4$am7@news.scruz.net>
In article <5omt2j$ad2@linet06.li.net>, lparillo@newshost.li.net (Parillo) wrote:
>Try http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html
>and also read the Microsoft Knowledge Base article covering this issue,
>"Configuring and Testing a PERL [sic] Script with IIS,"
>(http://www.microsoft.com/kb/articles/q150/6/29.htm).
>
That's not the same as the MS Personal Web server, though,
is it? I believe he's talking about the little web server
that's now bundled with the latest OEM version of Windows95.
I played with it briefly on a contract (normally, I prefer
to use WebSite for Win95/NT). I don't think the configuration
for IIS will necessarily help in this case.
-- Dean
-------------
jrd@enclave.org -- URL = <http://www.enclave.org/jrd/>
"The Enclave" -- Boulder Creek, California -- +1 408 336-0610
=+! Public Access Usenet BBS for Writers & Other Fiends !+=
------------------------------
Date: Tue, 24 Jun 1997 12:01:41 GMT
From: magnus.bodin@tychonides.se (Magnus Bodin)
Subject: Re: need help in sockets - test a port is all
Message-Id: <33afb591.454018634@news1.telenordia.se>
Tony Reeves wrote:
>
> I don't know much about sockets in perl.. but here is what I need to
> do..
>
> I have a list of ip addresses in our intranet.
> I want to check each ip address at port 80 to see if a webserver is
> there.
>
> seems to me that a socket would do this nicely, just connect, if
> connect web must be there, else no web..
>
>
> Tony Reeves
> N7SF - areeves@goodnet.com, tony@toners.com - HF: 14.242Mhz or 7.239Mhz
#!/usr/bin/perl
use strict;
use Socket;
my($host,$port,$iaddr,$paddr,$proto,$addr);
$host = shift; $port = 80;
if (!$host)
{ print "A hostname must be provided. Ex: www.flanell.com\n"; }
$iaddr=inet_aton($host);
$paddr=sockaddr_in($port,$iaddr);
$proto = getprotobyname('tcp');
socket(S, AF_INET, SOCK_STREAM, $proto) or die "no web server";
connect(S,$paddr) or die "no web server";
close S;
This is a simple script testing one site.
It would not be that difficult to change it to traverse a list and
not die when a non-connect is made.
> The secret to imortality: 4A 65 73 75 73
isn't it immortality?
73 de SM7UMG (non-active though. Still have 2 QRP)
------------------------------
Date: 24 Jun 1997 17:15:27 GMT
From: "Ken C. Brown" <kbrown@ee.net>
Subject: New beginner to Perl
Message-Id: <01bc80c2$072afdc0$08261fce@ken.ee.net>
Does anyone know where or how to wite a script that enables security to run
on a site to ask for and accept a username and password. when going ti a
temporary FTP site.?? Please help.
------------------------------
Date: Tue, 24 Jun 1997 11:41:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Ken C. Brown" <kbrown@ee.net>
Subject: Re: New beginner to Perl
Message-Id: <Pine.GSO.3.96.970624113147.3042Z-100000@kelly.teleport.com>
On 24 Jun 1997, Ken C. Brown wrote:
> Subject: New beginner to Perl
>
> Does anyone know where or how to wite a script that enables security to
> run on a site to ask for and accept a username and password. when going
> ti a temporary FTP site.?? Please help.
Yes, many people know how to do this. But frankly, it's not a job for a
beginner. You're dealing with things which, if mishandled, could make it
easy (or perhaps trivial) for somebody to break into your system. You may
be able to put together something that seems to work, but how can you
trust it?
It's cheaper to pay an expert to write good code in the first
place than to pay an expert to fix the damages after a break-in.
If you need an expert to write a script, I can recommend one. I could
even recommend somebody _else_. :-)
But you may be able to do all you need with your webserver's user
authentication; check your server's docs or ask your webmaster for more
information. If you have more questions, check in a server newsgroup or
its FAQ.
Hope this helps!
--
Tom Phoenix http://www.teleport.com/~rootbeer/
rootbeer@teleport.com PGP Skribu al mi per Esperanto!
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 24 Jun 1997 18:17:43 +0200
From: Andre Pinheiro <ip201945@ip.pt>
Subject: Newbie question: 500 Server Error
Message-Id: <33AFF327.4931@ip.pt>
I have this script on my server, in the cgi-bin directory.
By the way, I have other .pl scripts there, and they all work fine.
The script is called "games_search.pl".
Here is its source:
----
#!/usr/local/bin/perl
&showHTML_header;
&showHTML_footer;
exit;
sub showHTML_header {
print 'Content-type: text/html' . "\n\n";
print '<HTML><HEAD><TITLE>xxxx</TITLE></HEAD>' . "\n";
print '<BODY TEXT="#000000" LINK="#008000" VLINK="#800000" BGCOLOR="#FFFFCC">' . "\n";
print '<CENTER>' . "\n";
print '<IMG SRC="Images/Logo.jpg" WIDTH=272 HEIGHT=175 BORDER=0 ALT="xxxxxxx">' . "\n";
print '<BR>' . "\n";
print '<IMG SRC="Images/GreenBlackStripe.gif" WIDTH=536 HEIGHT=5><BR>' . "\n";
print '<IMG SRC="Images/GreenBlackStripe.gif" WIDTH=536 HEIGHT=5>' . "\n";
print '<P>' . "\n";
}
sub showHTML_footer {
print '<FONT SIZE=-1>' . "\n";
print 'Feedback:<BR>' . "\n";
print '<P>' . "\n";
print '</FONT>' . "\n";
print '</CENTER></BODY></HTML>' . "\n";
}
----
When I specify http://bla, bla, bla/cgi-bin/games_search.pl the browser says:
----
500 Server Error
The server encountered an internal error or misconfiguration and was unable to complete
your request.
Please contact the server administrator and inform them of the time the error occurred,
and anything you might have done that may have caused the error.
Error: HTTPd: malformed header from script /usr/local/etc/httpd/cgi-bin/games_search.pl
----
Can anyone tell me what's happening?
------------------------------
Date: 24 Jun 1997 15:11:52 GMT
From: billy@cast.msstate.edu (Billy Chambless)
Subject: Re: Newbie: 500 Server Error message
Message-Id: <5ooo3o$9fd$1@NNTP.MsState.Edu>
In article <33AF097D.762C@ip.pt>, Andre Pinheiro <ip201945@ip.pt> writes:
|> I have a script called "games_search.pl" in the "cgi-bin" dir.
|> By the way, I have other .pl scripts here and they work fine.
|> When I specify "http://www.mysite.com/cgi-bin/games_search.pl"
|> in the browser, the server returns:
|> 500 Server Error
This usually means that you forgot to read
http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
and
http://www.perl.org/CPAN/doc/FAQs/cgi/perl-cgi-faq.html
|> The server encountered an internal error or misconfiguration and was
|> unable to complete your request.
Fast-track hint -- run games_search.pl from the command line. I'll
bet you've got a syntax error or something like that.
|> Error: HTTPd: malformed header from script
|> /usr/local/etc/httpd/cgi-bin/games_search.pl
|> ----
|>
|> Here is the script source code:
|>
|> #!/usr/local/bin/perl
|>
|> &showHTML_header;
|> &showHTML_footer;
You also should look into the CGI.pm module, which is a totally cool
package that gives you functions for creating HTML headers, footers,
forms, and all kinds of groovy things.
Quoting from one of the documents listed above:
Q:Did you use the standard CGI.pm module to do this for you instead of
parsing by hand (which would be a really idiotic idea) or use the more
limited cgi-lib.pl library?
A:Gee, you mean somebody else has actually done this kind of
thing before? I had no idea I didn't know I didn't have to do it
all myself, and and that I could get the latest
version of the neat CGI module from
<URL:http://www.perl.com/cgi-bin/cgi_mod?modules=CGI>.
--
* "We all agree on the necessity of compromise. We just can't agree on
* when it's necessary to compromise."
* --Larry Wall in <1991Nov13.194420.28091@netlabs.com>
------------------------------
Date: 24 Jun 1997 18:30:30 GMT
From: "Eric D. Friedman" <friedman@uci.edu>
Subject: Re: OOP - class variables and inheritance?
Message-Id: <5op3o6$bva@news.service.uci.edu>
[mailed, posted]
In article <slrn5qtvqs.7qi.felix@chance.em.nytimes.com>,
felix k sheng <felix@nytimes.com> wrote:
<i think i've checked the book and man pages and have not discovered
<the answer to my dilemma. suppose i have a module WingedThing
<in which is @appendages = qw(wings feet). then i have a module
<Bird which @ISA=('WingedThing') and it has @appendages=qw(wings feet beak).
<(ok so a beak isn't really an appendage). now in WingedThing is
<a method pringAppendages which goes and looks at the array and
<prints them out. if i don't define this in Bird it finds the method
<in WingedThing and prints out "wings feet". however, i'd like
<it to print out "wings feet beak". is this possible to do? am i
<missing something terribly obvious? any help is appreciated. thanks!
The perltoot man page explains this in some detail, with examples.
The executive summary, however, is that class data is specific to
a particular package and is not subject to inheritance. If a method
comes from one package (a superclass, as in your case) and depends
on class data defined in that package, a subclass will NOT be able
to supply its own data. If you know java, this is something like the
difference between having private data that subclasses cannot
manipulate or override and protected or public data that they can
change.
What's the solution? Store a reference to your class data in your
object hash and have your method use that. Examples are in perltoot
after the following (more precise) rendering of what I've just said:
It turns out that this is not really a good way to go about handling
class data. A good scalable rule is that you must never reference class
data directly from an object method. Otherwise you aren't building a
scalable, inheritable class. The object must be the rendezvous point
for all operations, especially from an object method. The globals
(class data) would in some sense be in the ``wrong'' package in your
derived classes. In Perl, methods execute in the context of the class
they were defined in, not that of the object that triggered them.
Therefore, namespace visibility of package globals in methods is
unrelated to inheritance.
Got that? Maybe not. Ok, let's say that some other class ``borrowed''
(well, inherited) the DESTROY method as it was defined above. When
those objects are destroyed, the original $Census variable will be
altered, not the one in the new class's package namespace. Perhaps this
is what you want, but probably it isn't.
Here's how to fix this. We'll store a reference to the data in the
value accessed by the hash key ``_CENSUS''. Why the underscore? Well,
mostly because an initial underscore already conveys strong feelings of
magicalness to a C programmer. It's really just a mnemonic device to
remind ourselves that this field is special and not to be used as a
public data member in the same way that NAME, AGE, and PEERS are.
(Because we've been developing this code under the strict pragma, prior
to perl version 5.004 we'll have to quote the field name.)
HTH,
Eric
--
Eric D. Friedman
friedman@uci.edu
------------------------------
Date: Tue, 24 Jun 1997 12:21:44 +0100
From: Simon Fairey <sfairey@adc.metrica.co.uk>
To: Toutatis <toutatis@remove.this.toutatis.net>
Subject: Re: Passing object references to a subroutines
Message-Id: <33AFADC8.31DF@adc.metrica.co.uk>
Toutatis wrote:
>
> Hello,
> Quite new to perl, etcetera etcetera, here's my problem:
>
> In somescript.pl i create a databasehandle like this:
> use DBI;
> $drh = DBI->install_driver( 'my_driver' ) ;
> $dbh = $drh->connect( 'localhost', 'my_database', '' ) ;
>
> and now, i want to give this handle to another script,
> like this:
Firstly is it finding the function? i.e. have you setup a package or
'use'd the otherscript?
If thats not the problem then I would recommend passing a reference to
the handle; see comments below.
>
> $answer = otherscript::subroutine($dbh) || exit(0);
Change '$dbh' to '\$dbh', this will pass a reference to $dbh to your
subroutine.
>
> Other script:
> use DBI;
> sub one {
> my $dbh = shift @_;
> return two($dbh);
No change req'd here as its passing straight through.
> }
> sub two {
> $cursor = $dbh->prepare( "some query" )
Change '$dbh' to '$$dbh', this will de-reference it and give you the
handle.
> $cursor->execute;
> etcetera.
> }
>
> Now this doesn't work, because i understand &^%$^ about
> object oriented programming, but maybe someone would like to tell me
> how i pass such a filehandle. (Yeah, have the perlbook, and 've
> read it too. Now working on understanding it :-) )
Have fun.
Simon
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 659
*************************************