[24022] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6219 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 5 00:10:30 2004

Date: Thu, 4 Mar 2004 21:10:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 4 Mar 2004     Volume: 10 Number: 6219

Today's topics:
        Running Perl Programs as .CGI <sillo@anchrin.net>
    Re: Running Perl Programs as .CGI <gnari@simnet.is>
    Re: Running Perl Programs as .CGI <ceo@nospan.on.net>
    Re: Slow Sorting <gnari@simnet.is>
    Re: Slow Sorting $_@_.%_
    Re: Slow Sorting (Jay Tilton)
    Re: Slow Sorting $_@_.%_
    Re: What with this open file descriptor/"Read on closed <matthew.garrish@sympatico.ca>
    Re: Win32::GUI for College Course? <bart.lateur@pandora.be>
    Re: Win32::GUI for College Course? $_@_.%_
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 04 Mar 2004 19:11:23 -0500
From: Steven Pladl <sillo@anchrin.net>
Subject: Running Perl Programs as .CGI
Message-Id: <8lgf409imfl31iilev0es3jsfrhcj3bs3d@4ax.com>

I've spent the last two days searching through FAQs and newsgroups for
an answer to this question, but I haven't been able to solve it yet.
I'm really in a bind and need to solve this as quickly as possible.

I just moved to a new server. The old server allowed me to run perl
scripts as .cgi and .pl. The new server will not. If I try to run a
perl script with the extension .cgi from the web, I get 'Internal
Server Error'. My log file states: 'Premature end of script headers:
file.cgi'. The permissions are set to 755.

If I rename the file to .pl, it works fine. However, I've got a large
number of .cgi files and every html file on my server points to at
least one of them. Renaming them all and changing each page would be a
nightmare.

I've tried changing the httpd.conf file to include 'AddHandler
cgi-script .cgi', then restarting Apache, but this doesn't work.

The info I've found usually suggests associating cgi files with Perl,
but I haven't found any procedures for doing so. Most suggest
contacting the host to make the changes, however my host does not
manage my server. Any changes, I must make myself. How would I do
this?

Thanks.


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

Date: Fri, 5 Mar 2004 00:37:09 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Running Perl Programs as .CGI
Message-Id: <c28i1m$fin$1@news.simnet.is>

"Steven Pladl" <sillo@anchrin.net> wrote in message
news:8lgf409imfl31iilev0es3jsfrhcj3bs3d@4ax.com...

[snip http server runs .pl but not .cgi]

a few suggestions (in random order):

see if you find the config for .pl and duplicate it for .cgi
(assuming all your .cgi files are actually perl scripts)

if you have mod_rewrite installed, it should be a breeze
to make a rule that maps .cgi to .pl, and then you can just
rename all your .cgi to .pl

if you have mod_perl installed, the reason that the .pl
work may be that mod_perl handles them, but the cgi
handler is disabled. check that Options +ExecCGI is
set for your web directories. alternately set AllowOverride All
or AllowOverride ExecCGI and set Options +ExecCGI in the
 .htaccess  files of your directories

make sure that the shebang line of your .cgis point to a existing
perl.


what system/perl/apache is the server ?

gnari







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

Date: Fri, 05 Mar 2004 04:04:22 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: Running Perl Programs as .CGI
Message-Id: <a%S1c.55754$jS3.5152@newssvr33.news.prodigy.com>

gnari wrote:
> "Steven Pladl" <sillo@anchrin.net> wrote in message
> news:8lgf409imfl31iilev0es3jsfrhcj3bs3d@4ax.com...
> 
> [snip http server runs .pl but not .cgi]
> 
> a few suggestions (in random order):
> 
> see if you find the config for .pl and duplicate it for .cgi
> (assuming all your .cgi files are actually perl scripts)
> 
> if you have mod_rewrite installed, it should be a breeze
> to make a rule that maps .cgi to .pl, and then you can just
> rename all your .cgi to .pl
> 
> if you have mod_perl installed, the reason that the .pl
> work may be that mod_perl handles them, but the cgi
> handler is disabled. check that Options +ExecCGI is
> set for your web directories. alternately set AllowOverride All
> or AllowOverride ExecCGI and set Options +ExecCGI in the
> .htaccess  files of your directories
> 
> make sure that the shebang line of your .cgis point to a existing
> perl.
> 
> 
> what system/perl/apache is the server ?

Sounds like Apache on Windows to me since he's talking about 
"associatiing" .cgi files to Perl.  I'm not thoroughly familiar with 
Apache on Windows (only Unix), but I wouldn't think this is necessary on 
Apache for Windows.

We're getting a SLATE of CGI issues lately.  People still associate Perl 
with CGI and Web...  8-(  How wrong they are Kemo-Sambie!  8-)

Chris
-----
Chris Olive
chris -at- --spammer-speed-bump-- technologEase -dot- com
http://www.technologEase.com
(pronounced "technologies")


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

Date: Thu, 4 Mar 2004 22:57:38 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Slow Sorting
Message-Id: <c28c71$es0$1@news.simnet.is>


<$_@_.%_> wrote in message
news:YFN1c.27102$6c5.15055@nwrdny01.gnilink.net...

> Changing this:
> #foreach my $k (sort {$file{$b}[$col] cmp $file{$a}[$col]}
> #               keys %file)
> #{
>
> To this:
> my @y = sort {$file{$b}[$col] cmp $file{$a}[$col]} keys %file;
>         foreach my $k (@y) {
>
> Has really improved the speed of thw whole process.
> I suppose the extra time the sort was adding each time through
> the 'foreach' loop.. was enough to trigger $mw->update to frequently.

does not realy make much sense, unless the hash has really a lot of
keys. did you not say that it was in the order of 500 ?

gnari





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

Date: Fri, 05 Mar 2004 02:12:40 GMT
From: $_@_.%_
Subject: Re: Slow Sorting
Message-Id: <smR1c.27221$6c5.6901@nwrdny01.gnilink.net>


>
>
><$_@_.%_> wrote in message
>news:YFN1c.27102$6c5.15055@nwrdny01.gnilink.net...
>
>> Changing this:
>> #foreach my $k (sort {$file{$b}[$col] cmp $file{$a}[$col]}
>> #               keys %file)
>> #{
>>
>> To this:
>> my @y = sort {$file{$b}[$col] cmp $file{$a}[$col]} keys %file;
>>         foreach my $k (@y) {
>>
>> Has really improved the speed of thw whole process.
>> I suppose the extra time the sort was adding each time through
>> the 'foreach' loop.. was enough to trigger $mw->update to frequently.
>
>does not realy make much sense, unless the hash has really a lot of
>keys. did you not say that it was in the order of 500 ?
>
>gnari
Nod.. between 500 and 10,000 could be alot.. lets say newsgroup headers.
It's freeform input, the data is typically around 20 chars, and usually
starts with a letter, contains punctuation, and numbers.
After splitting the sort out of the foreach loop it seems faster.
This is likely because there are less 'mainwindow updates' being done;
due to the fact that the sort time is eliminated each time through the loop.
I'ts still very slow, im sure that its a limitation of 'Tk' I'd really ideally
like to 'tie' the widget to the data structure, but this is not possible.




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

Date: Fri, 05 Mar 2004 03:08:19 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Slow Sorting
Message-Id: <4047edcd.28694538@news.erols.com>

$_@_.%_ wrote:

[aside: Who said the rest?  Are you cutting the attributions out yourself,
or are you simply using an incompetent news client?]

: ><$_@_.%_> wrote in message
: >news:YFN1c.27102$6c5.15055@nwrdny01.gnilink.net...
: >
: >> Changing this:
: >> #foreach my $k (sort {$file{$b}[$col] cmp $file{$a}[$col]}
: >> #               keys %file)
: >> #{
: >>
: >> To this:
: >> my @y = sort {$file{$b}[$col] cmp $file{$a}[$col]} keys %file;
: >>         foreach my $k (@y) {
: >>
: >> Has really improved the speed of thw whole process.
: >> I suppose the extra time the sort was adding each time through
: >> the 'foreach' loop.. was enough to trigger $mw->update to frequently.
: >
: >does not realy make much sense, unless the hash has really a lot of
: >keys. did you not say that it was in the order of 500 ?
: >
: Nod.. between 500 and 10,000 could be alot.. lets say newsgroup headers.
: It's freeform input, the data is typically around 20 chars, and usually
: starts with a letter, contains punctuation, and numbers.

: After splitting the sort out of the foreach loop it seems faster.
: This is likely because there are less 'mainwindow updates' being done;
: due to the fact that the sort time is eliminated each time through the loop.

That's a bizarre conclusion.  The sort has to complete before the foreach
can have a list to iterate across.  There is no resorting between
iterations.



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

Date: Fri, 05 Mar 2004 03:47:33 GMT
From: $_@_.%_
Subject: Re: Slow Sorting
Message-Id: <pLS1c.27273$6c5.25686@nwrdny01.gnilink.net>


>
>$_@_.%_ wrote:
>
>[aside: Who said the rest?  Are you cutting the attributions out yourself,
>or are you simply using an incompetent news client?]
>
>: ><$_@_.%_> wrote in message
>: >news:YFN1c.27102$6c5.15055@nwrdny01.gnilink.net...
>: >
>: >> Changing this:
>: >> #foreach my $k (sort {$file{$b}[$col] cmp $file{$a}[$col]}
>: >> #               keys %file)
>: >> #{
>: >>
>: >> To this:
>: >> my @y = sort {$file{$b}[$col] cmp $file{$a}[$col]} keys %file;
>: >>         foreach my $k (@y) {
>: >>
>: >> Has really improved the speed of thw whole process.
>: >> I suppose the extra time the sort was adding each time through
>: >> the 'foreach' loop.. was enough to trigger $mw->update to frequently.
>: >
>: >does not realy make much sense, unless the hash has really a lot of
>: >keys. did you not say that it was in the order of 500 ?
>: >
>: Nod.. between 500 and 10,000 could be alot.. lets say newsgroup headers.
>: It's freeform input, the data is typically around 20 chars, and usually
>: starts with a letter, contains punctuation, and numbers.
>
>: After splitting the sort out of the foreach loop it seems faster.
>: This is likely because there are less 'mainwindow updates' being done;
>: due to the fact that the sort time is eliminated each time through the loop.
>
>That's a bizarre conclusion.  The sort has to complete before the foreach
>can have a list to iterate across.  There is no resorting between
>iterations.
shrug... stfu.. your words are totally useless.




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

Date: Thu, 4 Mar 2004 18:55:21 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: What with this open file descriptor/"Read on closed filehandle " stuff?
Message-Id: <IlP1c.8282$jw2.536723@news20.bellglobal.com>


"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote in message
news:c2795a$t3o$1@nets3.rz.RWTH-Aachen.DE...
> Also sprach Matt Garrish:
>
> > "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote in message
> > news:c273gt$4o2$1@nets3.rz.RWTH-Aachen.DE...
> >> Also sprach Rex Gustavus Adolphus:
> >>
> >> > Ben Morrow <usenet@morrow.me.uk> wrote in message
>
> >> >> Don't call subs with & unless you need to (here you don't).
> >> >
> >> > Isn't this another case of TMTOWTDI?
> >>

>
> Of the two side-effects that exist (passing @_ and circumventing the
> prototype), only the latter could ever come into the game as the
> parameters were passed explicitely. What remains are prototypes that
> weren't used in this case.
>
> When speaking about prototypes, we have to acknowledge that they
> themselves are a rather questionable concept. They were originally
> introduced in order to create functions behaving similar to some
> builtins (such as push() or map()). I don't see why the ampersand should
> be condemned just because they affect something that is used in maybe 1%
> of all function definitions in existing Perl code.
>

I don't disagree with you in principle, but you're still ackowledging that
there are occasions where things may not happen as one expects when using an
ampersand. The poster believed that it was just a style issue and Ben
pointed out that this wasn't true, with the sound advice that one shouldn't
use the & unless one needs to. You then countered to the effect that this
was not true. Consequently, you leave the impression that it is just a style
issue. It may only be < 1% of code that will ever be effected, but why not
start someone off on a safer footing (i.e., have them discover the use of
the ampersand when they need to pass the same @_ on, not by accident).

I get the feeling that you're looking at the situation from the perspective
of an experienced Perl programmer, in which case you don't need/want to be
lectured on ampersands and their effects and just want to be left alone to
use them (which is certainly your right). In the interests of promoting good
programming techniques, however, I can't agree that the same hands-off
approach should be taken with someone new to the language.

>
> Finally the statement
>
>     Don't call subs with & unless you need to.
>
> is a violation against anything that Perl stands for.

You're thinking of PERL. Perl stands for nothing... : )

Matt




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

Date: Fri, 05 Mar 2004 01:36:59 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: Win32::GUI for College Course?
Message-Id: <oamf40180bk129bsdcmakrmi1g0vnqchfs@4ax.com>

Mike wrote:

>1. With a good Perl background, am I going to be able to teach myself
>enough about this module inside of 2 weeks for 8 weeks of class?

At least have a look at The GUI Loft, 

	<http://www.bahnhof.se/~johanl/perl/Loft/>

That'll quickly give you a good idea of what you can do with Win32::GUI
(it's RAD  like VB but in Perl) and it's IMHO more fun.

-- 
	Bart.


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

Date: Fri, 05 Mar 2004 02:15:44 GMT
From: $_@_.%_
Subject: Re: Win32::GUI for College Course?
Message-Id: <kpR1c.37198$TF2.11903@nwrdny02.gnilink.net>


>
>Mike wrote:
>
>>1. With a good Perl background, am I going to be able to teach myself
>>enough about this module inside of 2 weeks for 8 weeks of class?
>
>At least have a look at The GUI Loft, 
>
>	<http://www.bahnhof.se/~johanl/perl/Loft/>
>
>That'll quickly give you a good idea of what you can do with Win32::GUI
>(it's RAD  like VB but in Perl) and it's IMHO more fun.
>
>-- 
>	Bart.
Does it 'do' threads?

curious.




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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc.  For subscription or unsubscription requests, send
#the single line:
#
#	subscribe perl-users
#or:
#	unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.

#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 6219
***************************************


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