[7032] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 657 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 25 02:08:02 1997

Date: Tue, 24 Jun 97 23:00:25 -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           Tue, 24 Jun 1997     Volume: 8 Number: 657

Today's topics:
     a string to an array <Jason.D.Borneman@rose-hulman.edu>
     Re: Checking an entered date (Abigail)
     Re: Delete specific element from list (M.J.T. Guy)
     Re: File Permissions - 'nobody' can't open file (Tad McClellan)
     Re: Filedate under WinNT is januari the first 1970? <rootbeer@teleport.com>
     forking without wait <lev@apple.com>
     Generating random numbers fast <MoNoLiTH+@CMU.EDU>
     help with perl compiler <jfoley@vt.edu>
     Makefile.pl Without Perl Sources Installed (Shelle)
     Re: match within a number range <rootbeer@teleport.com>
     Newbie question: 500 Server Error <ip201945@ip.pt>
     Newbie question: 500 Server Error <ip201945@ip.pt>
     Newbie question: 500 Server Error <ip201945@ip.pt>
     passing sort subroutines? <rueger@io.com>
     Re: passing sort subroutines? <rootbeer@teleport.com>
     Re: Perl "compiler" or how do you protect your code? (Michael Fuhr)
     Re: Perl and Internet Information Server <loconnor@conctrls.com>
     Re: perl script on WinNT (Danny Aldham)
     Re: Perl script retrieving URL's <rootbeer@teleport.com>
     Re: Perl5 & win 95 alan_k'necht@canadalife.com
     PLEASE HELP A NEWBIE!! <wwegner@uiuc.edu>
     Re: Q: an alternative to this use of "goto"? (Lloyd Zusman)
     Re: Q: MacPerl, MacHTTP and CGI <mxu@eecs.ukans.edu>
     Re: Quick PERL question for anyone who knows the answer <rootbeer@teleport.com>
     removing trailing whitespace (Eric Finley)
     Re: removing trailing whitespace (Craig Berry)
     Re: RFC: Xlib.pm (Abigail)
     SShell Windoww in Win95 disappes <rafalk@hyde.park.uga.edu>
     Validating E-Mail addresses and URL's (Mark Thompson)
     Re: Validating E-Mail addresses and URL's (Nathan V. Patwardhan)
     Re: What does "UNIX" stand for.. (Ron McFarland)
     Re: what is my, lc and etc and where to learn it? (Abigail)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Mon, 23 Jun 1997 14:06:29 -0500
From: "Jason D. Borneman" <Jason.D.Borneman@rose-hulman.edu>
Subject: a string to an array
Message-Id: <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.

Thanks,
Jason Borneman
Class of '00 CS
Rose-Hulman Institute of Technology
http://www.rose-hulman.edu/~bornemjd/

"Three men can keep a secret if two of them are dead" 
 	-Benjamin Franklin


------------------------------

Date: Mon, 23 Jun 1997 16:52:58 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Checking an entered date
Message-Id: <EC8MwA.63E@nonexistent.com>

Dean Hollister (deanh@nospam.mail) wrote on 1392 September 1993 in
<URL: news:33ADE375.150B@nospam.mail>:
++ Hello,
++ 
++ Can anyone point me to the relevant code to parse the information
++ supplied in a date (ie, date of birth) and check its validity, then
++ check if the person is over 18?

There are many Date:: and Time:: modules on CPAN. I'm sure you
find the answer there.

++ Would it be easier to have the form parse the information, ie, enter the
++ day, month and year in seperate boxes?

Boxes? Perl has boxes? I don't think so.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


------------------------------

Date: 24 Jun 1997 19:40:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Delete specific element from list
Message-Id: <5op7rq$67f@lyra.csx.cam.ac.uk>

Douglas Wilson  <dgwilson@gte.net> wrote:
>Calle Dybedahl wrote:
>> The easiest way is probably to do it somethin like this:
>> 
>> sub listdel {
>>         my ($del, @arr) = @_;    # Note order of arguments
>> 
>>         return grep { $_ ne $del } @arr;
>> }
>
>This is untested, but something like this might work for the
>return statement instead:
>
>return map { $_ == $del ? "" : $_ } @arr
>
>I'm not sure offhand if you'll end up with blank elements,
>or if the element will actually be deleted.

Two mistakes in one line.   You would of course get blank elements, as
you'd know if you RTFM.    Also that == should be  eq, shouldn't it?

And when you've corrected these, you simply have a way of using map to
simulate grep.    Hardly the most efficient way of doing things.


Mike Guy


------------------------------

Date: Mon, 23 Jun 1997 06:02:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: File Permissions - 'nobody' can't open file
Message-Id: <54llo5.2l.ln@localhost>

J. Linder (jann@jann.com) wrote:
: In article <EBsInM.6yq@nonexistent.com>, abigail@fnx.com wrote:

: >Mission Hills Association (mha@dunraven.com) wrote on 1383 September 1993
: >in <URL: news:33A31586.23AE@dunraven.com>:
: >++ Hi - 
: >++ 
: >++ I'm running a CGI script that needs to open a file and append data.  
: >++ It works fine from the shell, but not when it's invoked from a 
: >++ browser.  
: >++ 
: >++ I think the problem must be that 'nobody' doesn't have permission
: >++ to create a file in the cgi-bin directory, or in my own (I've tried
: >++ both.)
: >
: >Bingo! 99.9% of the cgi "problems" is failing to see this.
: >
: >++ Can someone let me know a good workaround?  
: >
: >Yes. Read a faq. Or ask it in a CGI group.
: >It's not a Perl question.
: >
: >
: >Abigail

: Sorry, abigail...this is a perl question...seeing as how their cgi is
                   ^^^^^^^^^^^^^^^^^^^^^^^

Sorry J. Linder, it is NOT a perl question.

If the CGI was written in Bourne shell, would the answer be different?

No it would not. You would still need to change the file permissions!

Any question where the answer would be the same if the program were
written in a language other than Perl, is not a Perl question...


: written in perl.

: I get tired of lazy people who, instead of answering, give a smart-alek reply.


I get tired of silly people who, when answering off-topic questions,
claim that they are on-topic questions.


: The answer is simple.  chmod the directory to 755.  That will allow nobody
: access...just ensure that you move the file later to a secure directory or

That will only allow 'nobody' access if 'nobody' is the owner of
the directory in question. The poster did not tell us who the directory
owner is.


: chmod the structure afterwards with your cgi script if the data is
: sensitive.


--
    Tad McClellan                          SGML Consulting
    Tag And Document Consulting            Perl programming
    tadmc@flash.net


------------------------------

Date: Tue, 24 Jun 1997 21:16:04 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: HdV <J.A.deVries@lr.tudelft.nl>
Subject: Re: Filedate under WinNT is januari the first 1970?
Message-Id: <Pine.GSO.3.96.970624210309.17167L-100000@kelly.teleport.com>

On Wed, 25 Jun 1997, HdV wrote:

> I tried to use the stat() function to retrieve the date of the file.
> But it always returns the same date: januari the first 1970. Is this a
> Windows NT problem? 

First, let's make sure that you're really seeing what you think you're
seeing. Could you run this test script, putting in the location of your
Perl binary, and see whether it gives the same date? 

    $filename = 'C:/Perl/perl.exe';	# Or wherever
    die "Can't find file '$filename': $!" unless -e $filename;
    $date = localtime((stat _)[9]);
    print "$filename last modified on $date\n";

If it says that it can't find the file, that's a whole different problem!
:-) Be sure to put the filename into single quotes, especially if you use
backslashes instead of slashes. (Nevertheless, I'm told that you can (and
should) use regular slashes and Perl figures it out.)

If that gives the wrong date, then try using the command 'perl -V' and
make sure that you aren't using an old version or build. The current
version for NT is 5.003 and build is 304, if I'm not mistaken. (I don't
have an NT machine handy to find out, but if your numbers are any earlier
than those, you should see whether you can get a newer Perl from CPAN.) 

If you're using the latest build of Perl and the problem still exists,
it's a bug to be reported. Your distribution should come with perlbug to
report the bug, or you can follow instructions in the README. Thanks!

-- 
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 17:37:37 -0700
From: lloyd Vancil <lev@apple.com>
Subject: forking without wait
Message-Id: <33B0684E.450D@apple.com>

Is it possible in perl to fork a child using fork or system or ``,
without having to wait for the child to exit?

Thanks
L.


------------------------------

Date: Mon, 23 Jun 1997 12:32:21 -0400
From: Aveek Datta <MoNoLiTH+@CMU.EDU>
Subject: Generating random numbers fast
Message-Id: <snfeIJS00iWS0401U0@andrew.cmu.edu>

I want to find a quick way to generate decent random numbers fast.
The srand specified in the Perl book seems to call ps -auwx and gzip to get
the random seed. Won't this be relatively slow on CGI's which get dozens of
hits per sec?

Hence I'd like a fast way to get a random number. The number itself isnt too
important, I'm using it to implement a 'percentage chance' thing where let's
say I want 50% chance that something happens.

I'm running on Linux systems and I know /dev/random might be useful. How can
I use that in Perl? Of course if there is a non-Linux specific way that
would be useful too.

  Network Administrator, Monolith Internet Services [TM]  _ _ _   _  Aveek
  SysAdmin, Carnegie Mellon Univ ITC   _ __  ___ _ _  ___| (_) |_| |_Datta
  Personal Website @ datta.ml.org    _| '  \/ _ \ ' \/ _ \ | |  _| ' \ _
  All opinions are ONLY mine.       (_)_|_|_\___/_||_\___/_|_|\__|_||_(_)
  [Get a free domain for your website or machine at http://www.ml.org]



------------------------------

Date: Tue, 24 Jun 1997 17:00:39 -0400
From: joe foley <jfoley@vt.edu>
Subject: help with perl compiler
Message-Id: <33B03577.45CC88B7@vt.edu>

hello,

i was wondering if anyone could offer any help installing/running the
perl compiler.  i found the release notes missing a few details.  if
anyone could give me a better idea of the install procedure (including
where to put it) i would be very greatful

system details:
    sunOS 5.5.1
    gcc installed in /opt/PUBgcc/bin/
    perl5.003 installed in /usr/local/bin/

thanks in advance

joe



------------------------------

Date: Mon, 23 Jun 1997 16:26:39 GMT
From: shelle@interaccess.com (Shelle)
Subject: Makefile.pl Without Perl Sources Installed
Message-Id: <5om83v$1e8_004@interaccess.interaccess.com>

I haven't seen anything here about this problem; Since I installed Perl from 
the pre-compiled sources, I have a problem running the "makefile.pl"s as they 
nees access to Perl.h.

Other than completely reinstalling Perl is there a way to add those necessary 
files without screwing over my current config?

As always, TIA

Michelle ----,-'-(@

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Michelle Feigen      ----,-'-(@      shelle@interaccess.com
                     MEAN PEOPLE SUCK!    
          http://homepage.interaccess.com/~shelle/
       http://homepage.interaccess.com/~shelle/grafx/       
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


------------------------------

Date: Tue, 24 Jun 1997 21:41:59 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Darwin O.V. Alonso" <dalonso@u.washington.edu>
Subject: Re: match within a number range
Message-Id: <Pine.GSO.3.96.970624213822.17167R-100000@kelly.teleport.com>

On 23 Jun 1997, Darwin O.V. Alonso wrote:

> 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 ){...}

You can make it more concise, but I'm not sure about the efficiency. If
your subscripts are small constants, as in your example, you probably
can't do much better than that. 

But if you want to give up some efficiency for conciseness (or if your
array lookup is expensive), you could use something like this. 

    if (&range(10, $F[0], 20)) {...}

Of course, writing that sub is trivial. (But you could stay out all night
arguing about what order of arguments is best. :-) 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:19:12 +0200
From: Andre Pinheiro <ip201945@ip.pt>
Subject: Newbie question: 500 Server Error
Message-Id: <33AFF380.7B91@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: Tue, 24 Jun 1997 17:54:08 +0200
From: Andre Pinheiro <ip201945@ip.pt>
Subject: Newbie question: 500 Server Error
Message-Id: <33AFEDA0.674C@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: Tue, 24 Jun 1997 17:55:27 +0200
From: Andre Pinheiro <ip201945@ip.pt>
Subject: Newbie question: 500 Server Error
Message-Id: <33AFEDEF.7B57@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: 25 Jun 1997 02:17:16 GMT
From: Tim Rueger <rueger@io.com>
Subject: passing sort subroutines?
Message-Id: <5opv3c$rd3$1@nntp-2.io.com>

Hi, all,

I'd like to make a generalized "dump sorted data" subroutine, with the
comparison function for the sort passed into the subroutine.  How do you
pass a variable sort subroutine into a subroutine?  The closest I've
been able to come is something like:

    while(<>) {
        chop;
        ($first{$_}, $last{$_}) = split(' ', $_);
        push(@globalarray, $_);
    }

    sub by_first {
        ($first{$a} cmp $first{$b}) || ($a cmp $b);
    }
    sub by_last {
        ($last{$a} cmp $last{$b}) || ($a cmp $b);
    }
    sub print_sorted {
        ($routine) = @_;
        print join("\n", sort $routine @globalarray), "\n";
    }

    &print_sorted("by_first");
    &print_sorted("by_last");

But (well, I wouldn't be posting if it worked), it doesn't work.  What's
the right way to think about implementing this?  If I need to use
anonymous subs, how do I dereference them?  Thanks...

-Tim
-- 
Tim and/or Shelley Rueger - rueger@io.com
also --> Tim:     trueger@crystal.cirrus.com
try: --> Shelley: q11559@email.mot.com
WWW page: http://www.io.com/~rueger/


------------------------------

Date: Tue, 24 Jun 1997 21:32:48 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Tim Rueger <rueger@io.com>
Subject: Re: passing sort subroutines?
Message-Id: <Pine.GSO.3.96.970624213013.17167Q-100000@kelly.teleport.com>

On 25 Jun 1997, Tim Rueger wrote:

> How do you pass a variable sort subroutine into a subroutine? 

I use references, as documented in perlref. 

	&do_something(\&my_sub);	# Passes a reference

	&do_something( sub { whatever } );

	sub do_something {	
	    my($code_ref) = @_;
	    &$code_ref(parameters);
	    ...
	}

You also may do some cool things with prototypes. 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: 24 Jun 1997 22:47:53 -0600
From: mfuhr@dimensional.com (Michael Fuhr)
Subject: Re: Perl "compiler" or how do you protect your code?
Message-Id: <5oq7tp$jh5@flatland.dimensional.com>

subodh@best.com (Subodh Desai) writes:

> Is there some way to compile the perl code into an executable?
> Asked other way around -- if you make product that uses perl/cgi scripting
> extensively, how do you protect the perl source code which is part your 
> product?

See the Perl FAQ:

    http://www.perl.com/perl/faq/

-- 
Michael Fuhr
http://www.dimensional.com/~mfuhr/


------------------------------

Date: 24 Jun 1997 15:07:38 GMT
From: "Lance O'Connor" <loconnor@conctrls.com>
Subject: Re: Perl and Internet Information Server
Message-Id: <01bc80b0$7a26e4e0$06808080@lance>

It's a registry hack to make it recoginize you're Perl scripts, and that
is...

HKLM\System\CurrentControlSet\Services\W3SVC\Paramaters\Script Map

Add a new REG_SZ value.  The value name is the file extension of your
script 
(i.e. ".pl") (no quotes "") and the value is the full path to the perl
files 
(i.e. "d:\perl\perl.exe %s %s") You must add the two(2) %s for it to run
properly.

I added two entries, one for .pl and one for .cgi, just to keep users
happy.

Regards,
Lance O'Connor
MIS/Tech Support
Concurrent Controls, Inc.
loconnor@conctrls.com

Almudena Eustaquio <aeustaquio@sip.es> wrote in article
<5onubn$ie5@wendy.mad.servicom.es>...
> I have written some code in perl who is called from a html file. The
> code works on a server for Windows 95 and on a server for Unix but
> when I try to use the code with the Internet Information server for
> Windows NT server 4.0 it doesnt work, netscape just ask me if I want
> to
> save the code. Can someone tell me how to fix this, or what
> the problem is?
> 
> Please mail any responses to aeustaquio@sip.es
> 
> Thanks
> 
> Almudena
> 
> 
> 


------------------------------

Date: 24 Jun 1997 19:24:45 -0700
From: danny@hendrix.postino.com (Danny Aldham)
Subject: Re: perl script on WinNT
Message-Id: <5opvhd$50s$1@hendrix.postino.com>

Miko3aj Morzy (kola@cs.put.poznan.pl) wrote:
: on Unix machines every script begins with #!/usr/bin/perl or whatever
: the path to the interpreter is. How does this line look like on Windows
: NT machine (assuming interpreter perl386.exe)? I still get 500 server
: error and I would appreciate your help.
: Please help me- I'm getting more and more desperate

The first line doesn't matter on NT. What you need to do is
configure script mapping, which is much like a Windows 
association to a suffix, in the case of perl it is common
to use the suffix .pl . Using regedt32 edit HKEY_LOCAL_MACHINE
and add a value to System\CurrentControlSet\Services\W3SVC\
Parameters\ScriptMap . Add a value called .pl with data-type
of REG_SZ. In the string editor type the value:
full\path\to\perl.exe %s
DO NOT put perl.exe in your HTTP directory. Stop and restart
IIS and you should be away.

--
Danny Aldham    SCO Ace, MCSE    www.postino.com


------------------------------

Date: Tue, 24 Jun 1997 16:34:05 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ivo Bieleveldt <obp@onlinebp.com>
Subject: Re: Perl script retrieving URL's
Message-Id: <Pine.GSO.3.96.970624163152.24884R-100000@kelly.teleport.com>

On Tue, 24 Jun 1997, Ivo Bieleveldt wrote:

> Does anyone of a perl script that allows you to retrieve WWW pages. 

Does anyone dream of one? Yes.   :-)

> I want to make a list of URLS, store these URL's in a seperate file. 
> Then I want to let the Perl script retrieve the first URL and store the
> output in a seperate file and so on until the last URL. 

That's easily done in Perl. I'd use the LWP module to make it. It should
take about half a dozen lines of code, more or less, since it's not much
different than the examples in the docs. 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 12:25:01 GMT
From: alan_k'necht@canadalife.com
Subject: Re: Perl5 & win 95
Message-Id: <33afbbce.64747642@news.worldlinx.com>

On 23 Jun 1997 15:16:07 GMT, "Philip Smith"
<arthur_dent@rocketmail.com> wrote:

>sorry for asking a stupid question, but maybe someone can help?
>
>I need to know how to change the registry settings so my server can
>recognize perl. Does anyone have any suggestions?
>
>My server is Personal Web server for Windows 95.
>
>Thanks,
>
>Arthur_dent@rocketmail.com

Well it's actually very simple, but not well documented. In Windows 95
(or NT 4.0) open up your Windows Explorer program. Double click on any
Perl file (note it must end with .pl). Windows will prompt you for
what program to associate with this this file type. Use the browse
function and select PERL.

>From then on, every time a file with the ending .pl is called, it will
automatically launch and be run in PERL.

Alan K'necht


------------------------------

Date: Tue, 24 Jun 1997 21:15:17 -0500
From: Wade Wegner <wwegner@uiuc.edu>
Subject: PLEASE HELP A NEWBIE!!
Message-Id: <33B07F35.4670@uiuc.edu>

Hello everyone --

	I need some help with one of my scripts.  I downloaded a program
written in "C".  When running the C script, four lines of output are
printed to the screen.  So, I wrote a perl script to look at these 4
lines, and mail me if they say anything they shouldn't.  However, when I
try to call the C script, and write it's output to a file, it doesn't
work.  For example, the C script is called "check" and I'm trying to
write it to a file called tmp. I tried:

   system ("$CHECKDIR/check > tmp");

but that doesn't work.  I have used that system command before
(obviously for systemy commands though) and it has worked beautifully.

any help is greatly apprecieated!!!!!

thanks --

Adam Kass
a-kass@uiuc.edu


------------------------------

Date: 25 Jun 1997 00:59:13 GMT
From: asfast@asfast.com (Lloyd Zusman)
Subject: Re: Q: an alternative to this use of "goto"?
Message-Id: <slrn5r0r75.mca.asfast@ljz.asfast.net>

On Tue, 24 Jun 1997 10:05:26 -0700, Tom Phoenix <rootbeer@teleport.com> wrote:
> On Mon, 23 Jun 1997, Larry D'Anna wrote:
> 
> > Randal Schwartz wrote:
> 
> > > It's also amazingly slow.  
> 
> > Did you guys do that on purpose?  :-)
> 
> There's no need to spend lots of time and energy optimizing goto, since
> it's used quite rarely, and it should never be used when efficiency is an
> issue.

But that's a circular argument.  If "goto" were well optimized, then
there wouldn't be a problem using it when efficiency is an issue.

> [ ... ]


-- 
 Lloyd Zusman
 ljz@asfast.com


------------------------------

Date: Tue, 24 Jun 1997 23:52:46 -0500
From: Mousheng Xu <mxu@eecs.ukans.edu>
To: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Q: MacPerl, MacHTTP and CGI
Message-Id: <Pine.ULT.3.96.970624234740.6642A-100000@venus>

On Tue, 24 Jun 1997, Tom Phoenix wrote:

>On Tue, 24 Jun 1997, Mousheng Xu wrote:
>
>> 	I installed machttp and MacPerl and I have some unix perl scripts.
>> But how I don't know how to convert the unix perl to mac perl.
>
>This should be covered in the documentation which comes with MacPerl. If
>you read that and still have questions, please ask again. Thanks!

	MacPerl, 5.13.
	"should be" but actually not. It talks about how to write perl
script -- no, unix perl script only! They even didn't include enough
information on how to run this script for cgi. 
	1. What is the difference of "MacPerl" and UNIX perl? As I posted
in the newsgroup;
	2. what should I do to the perl scripts? Should I run and save it
as another file in another format or just leave it? 
	Your help is highly appreciated.

				Sincerely,
				Mousheng Xu



------------------------------

Date: Tue, 24 Jun 1997 16:31:30 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Vince Betro <vinbetro@vantek.net>
Subject: Re: Quick PERL question for anyone who knows the answer
Message-Id: <Pine.GSO.3.96.970624163015.24884Q-100000@kelly.teleport.com>

On Tue, 24 Jun 1997, Vince Betro wrote:

> How do i tell a script to open and view a previously created web page?

Once it's written, you run it. See the manpages for details on how to do
those things. You may want to use the LWP module to write it. If something
is still unclear after you've read the docs, post again. 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: 24 Jun 1997 23:58:19 GMT
From: ez041407@boris.ucdavis.edu (Eric Finley)
Subject: removing trailing whitespace
Message-Id: <5opmur$pqm$1@mark.ucdavis.edu>

Hi,
I am trying to remove all trailing whitespace from a scalar and am having
very little luck.  What worked best so far is s/(.*)\s*?/$1/ but this only
removes the last whitespace since the .* is greedy and matches everything
up to the last whitespace.  At least that is what I think is happening
from what I know of regex.  How can I do this?  Part of the problem is
that spaces and any other chars are allowed in the string so "!A + B    "
is allowed and I want to strip it down to "!A + B".  Any suggestions?
Thanks,
Eric Finley



------------------------------

Date: 25 Jun 1997 00:26:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: removing trailing whitespace
Message-Id: <5opoj5$i4a$3@marina.cinenet.net>

Eric Finley (ez041407@boris.ucdavis.edu) wrote:
: I am trying to remove all trailing whitespace from a scalar and am having
: very little luck.  What worked best so far is s/(.*)\s*?/$1/ but this only
: removes the last whitespace since the .* is greedy and matches everything
: up to the last whitespace.  At least that is what I think is happening
: from what I know of regex.  How can I do this?  Part of the problem is
: that spaces and any other chars are allowed in the string so "!A + B    "
: is allowed and I want to strip it down to "!A + B".  Any suggestions?

The trick is to listen to what you're asking for -- "*trailing* 
whitespace," that is to say, "whitespace at the *end of the string*."  
Perl provides a mechanism for anchoring regexes to either end of a string 
(or logical line, if you want to get technical, which I don't right 
now).  It's the $ character.  So, to remove all trailing whitespace from 
a string (including a newline, if present), you'd use:

  s/\s+$//;

 ...that is, "If you can find one or more whitespace characters right up 
against the end of the string, ditch them."

Hope this helps!

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


------------------------------

Date: Mon, 23 Jun 1997 17:40:55 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: RFC: Xlib.pm
Message-Id: <EC8p48.8zM@nonexistent.com>

Brian Wheeler (bdwheele@indiana.edu) wrote on 1392 September 1993 in
<URL: news:5oltsc$1o5$1@dismay.ucs.indiana.edu>:
++ I'm currently writing an Xlib clone in perl.
++ Any thoughts?

Sounds nice to me.


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


------------------------------

Date: Mon, 23 Jun 1997 17:56:03 -0400
From: "Rafal S. Konopka" <rafalk@hyde.park.uga.edu>
Subject: SShell Windoww in Win95 disappes
Message-Id: <Pine.SOL.3.91.970623174912.3400A-100000@hyde.park.uga.edu>

I browsed through all the FAQ's available, but I couldn't find a satisfactory
answer.  If I run a perl perogram byy double clicking on the actual script,
the shell window appears with the outpout, and then disappears.  Yes, I
know, somebody in one of the FAQ's DID say that perl is not meant to be 
run lie that, but ut DOES run,  The thing is I cannot see the output.

Does it mean that I can only run perl in the DOS shell window?

Thanks,

Rafal


------------------------------

Date: Tue, 24 Jun 1997 22:53:03 GMT
From: mwt@cyberg8t.com (Mark Thompson)
Subject: Validating E-Mail addresses and URL's
Message-Id: <33b04ef4.9187588@news.alt.net>

Hi,

I'm writing a program and need to validate e-mail addresses and URLs
to make sure they're correct.

It seems that the patterns of these must follow:

	e-mail:
		<VALID_MAILADDRESS> '@' <VALID_DOMAIN>

	URL:
		['HTTP://'] <VALID_URLDOMAIN> [ '/' <VALID_PATH>]

but I was wondering if anyone has tackled this problem before and has
a piece of code that will solve the problem.  

Thanks,

Mark Thompson








------------------------------

Date: 24 Jun 1997 23:59:54 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Validating E-Mail addresses and URL's
Message-Id: <5opn1q$9i9@fridge-nf0.shore.net>

Mark Thompson (mwt@cyberg8t.com) wrote:

: I'm writing a program and need to validate e-mail addresses and URLs
: to make sure they're correct.

*sigh*

This thread just raged on for the last two weeks after a week's break
and a month's raging on before that.  I'm not trying to yell at you,
but it would be *extremely* courteous of you to check
http://www.dejanews.com or the Perl FAQ (http://www.perl.com/FAQ/) 
before posting.  In other words, email address verification questions
come up *so* frequently it's apparent that the people who keep asking 
these questions aren't doing their research before posting.

In terms of the URL verification, I believe that you'll want to use
the LWP package, available at a CPAN near you:

http://www.perl.com/CPAN/modules/by-module/LWP/

--
Nathan V. Patwardhan
nvp@shore.net



------------------------------

Date: 23 Jun 1997 06:39:22 GMT
From: RonMcF@WaveTech.net (Ron McFarland)
Subject: Re: What does "UNIX" stand for..
Message-Id: <5ol5mq$873$1@tsunami.wavetech.net>

In article <33A562FC.3126@cs.odu.edu>, eddie@cs.odu.edu says...
>
>av wrote:
>> 
>> Bill (Gates) Erwin wrote:
>> 
>> > UNIX started out as "Castrated MULTICS" and was shortened from 
there.
>> > Check out the "UNIX Haters Handbook" for further details.
>> >
>> > Bill
>> 
>> I have 4 Intranet servers running. 3 are Linux and one is NT. I keep 
the
>> NT alive just for demo, it runs on the better machine and still has 
the
>> worse performance, and crashes at least twice a week... Really 
Microsoft
>> style.. :-b
>> 
>> I don't know what the "UNIX Haters Handbook" is, but sounds like
>> bullshit...
>
>If operating systems were programming languages UNIX would be C 
>and Win95 would be BASIC with line numbers. :)

Naw.  Win95 would be like C++.   ;)



------------------------------

Date: Tue, 24 Jun 1997 23:19:31 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: what is my, lc and etc and where to learn it?
Message-Id: <ECAzGJ.F1F@nonexistent.com>

Tom Phoenix (rootbeer@teleport.com) wrote on 1393 September 1993 in
<URL: news:Pine.GSO.3.96.970623185332.15285G-100000@kelly.teleport.com>:
++ On Mon, 23 Jun 1997, mike mah wrote:
++ 
++ > Although I finished reading Learning Perl, I never encounter my, lc and
++ > etc. Why is that so? 
++ 
++ Because the Llama is a beginning-level book, which isn't trying to cover
++ every aspect of the language. (Although I think those two items make it
++ into the new edition, which may be visible this fall.)


Hmm, I'd say that my() needs to be on the second page of a beginners
book of Perl. Or is someone teaching Perl to beginners the hard way,
without using 'strict'?


Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=$]*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


------------------------------

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 657
*************************************

home help back first fref pref prev next nref lref last post