[29376] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 620 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 6 14:20:08 2007

Date: Fri, 6 Jul 2007 11:19:59 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 6 Jul 2007     Volume: 11 Number: 620

Today's topics:
        Error handling <shmh@bigpond.net.au>
    Re: Error handling <jurgenex@hotmail.com>
    Re: Error handling <ts@dionic.net>
    Re: Error handling <jurgenex@hotmail.com>
    Re: Error handling <ts@dionic.net>
    Re: Error handling <tadmc@seesig.invalid>
    Re: Error handling <shmh@bigpond.net.au>
    Re: Error handling <shmh@bigpond.net.au>
    Re: FAQ 1.15 Where can I get a list of Larry Wall witti  krakle@visto.com
    Re: FAQ 1.15 Where can I get a list of Larry Wall witti <spamtrap@dot-app.org>
    Re: FAQ 4.6 Why doesn't & work the way I want it to? (Alan Curry)
    Re: FAQ 4.6 Why doesn't & work the way I want it to? <bik.mido@tiscalinet.it>
        Fork Example <shmh@bigpond.net.au>
    Re: Fork Example <bik.mido@tiscalinet.it>
    Re: Help finding CGI files on Unix server <joe@inwap.com>
    Re: Help finding CGI files on Unix server <jurgenex@hotmail.com>
    Re: Help finding CGI files on Unix server <bassintro@gmail.com>
        How to generate parser from *.l and *.y files? <socyl@987jk.com.invalid>
    Re: How to generate parser from *.l and *.y files? <abigail@abigail.be>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Wed, 04 Jul 2007 10:21:00 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Error handling
Message-Id: <gwKii.3191$4A1.727@news-server.bigpond.net.au>

Hi guys, bit of a newbie here.

Im trying to learn error handling in perl.

Here are a couple of scenarios.

Im trying to write messages to the terminal/screen and output these over 
operating system returned error messaages.

============================================================================

use Win32;

print `ipconig` || die "no good";



----------------------------------------- output is:

C:\Test>alright.pl

'ipconig' is not recognized as an internal or external command,

operable program or batch file.

no good at C:\Test\alright.pl line 4.



Why isnt it the following?

no good

============================================================================

C:\_Test>Connect.pl

hi thereSystem error 1326 has occurred.

Logon failure: unknown user name or bad password.



!Error Connecting!

Please check the workstation name and/or password!

C:\_Test>Connect.pl

hi thereSystem error 1326 has occurred.

Logon failure: unknown user name or bad password.



!Error Connecting!

Please check the workstation name and/or password!





Instead of  the operating system reprorting these messages, I want to hide 
these and generate my own.



Any help appreciated.




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

Date: Wed, 04 Jul 2007 11:19:00 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Error handling
Message-Id: <EmLii.11846$pa5.1674@trndny05>

Simon wrote:
> Im trying to write messages to the terminal/screen and output these
> over operating system returned error messaages.
>
> print `ipconig` || die "no good";
> ----------------------------------------- output is:
> 'ipconig' is not recognized as an internal or external command,
> operable program or batch file.
> no good at C:\Test\alright.pl line 4.
>
> Why isnt it the following?
> no good

Most likely because the OS/shell/... is writing that error message to STDERR 
which is not captured by backticks.

> C:\_Test>Connect.pl
> hi thereSystem error 1326 has occurred.
> Logon failure: unknown user name or bad password.
> !Error Connecting!
[...]
> Instead of  the operating system reprorting these messages, I want to
> hide these and generate my own.

Then you need to capture STDERR in addition to STDOUT. For details please 
see the FAQ "perldoc -q STDERR":
    "How can I capture STDERR from an external command?"

jue 




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

Date: Wed, 04 Jul 2007 12:28:23 +0100
From: Tim Southerwood <ts@dionic.net>
Subject: Re: Error handling
Message-Id: <468b8457$0$641$5a6aecb4@news.aaisp.net.uk>

Simon wrote:

> Hi guys, bit of a newbie here.
> 
> Im trying to learn error handling in perl.
> 
> Here are a couple of scenarios.
> 
> Im trying to write messages to the terminal/screen and output these over
> operating system returned error messaages.
> 
>
============================================================================
> 
> use Win32;
> 
> print `ipconig` || die "no good";
> 
> 
> 
> ----------------------------------------- output is:
> 
> C:\Test>alright.pl
> 
> 'ipconig' is not recognized as an internal or external command,

You have a typo:

ipconfig
 
<snip>
> 
> C:\_Test>Connect.pl
> 
> hi thereSystem error 1326 has occurred.
> 
> Logon failure: unknown user name or bad password.
> 
<snip>
> 
> 
> Instead of  the operating system reprorting these messages, I want to hide
> these and generate my own.
> 

That's hard without knowing the contents of Connect.pl

Would to care to post it?

Cheers

Tim


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

Date: Wed, 04 Jul 2007 11:33:03 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Error handling
Message-Id: <PzLii.10472$bh5.8659@trndny01>

Tim Southerwood wrote:
> Simon wrote:
>> print `ipconig` || die "no good";
> You have a typo:
>
> ipconfig

Which in the context of his question is intentional.
If he hadn't a typo then there wouldn't be any error message to capture :-)

>> C:\_Test>Connect.pl
>> hi thereSystem error 1326 has occurred.
>>
>> Instead of  the operating system reprorting these messages, I want
>> to hide these and generate my own.
>
> That's hard without knowing the contents of Connect.pl

Actually, all he has to do is to capture STDERR, no matter what Connect.pl 
does.

jue 




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

Date: Wed, 04 Jul 2007 13:01:18 +0100
From: Tim Southerwood <ts@dionic.net>
Subject: Re: Error handling
Message-Id: <468b8c0e$0$647$5a6aecb4@news.aaisp.net.uk>

Jürgen Exner wrote:

> Tim Southerwood wrote:
>> Simon wrote:
>>> print `ipconig` || die "no good";
>> You have a typo:
>>
>> ipconfig
> 
> Which in the context of his question is intentional.
> If he hadn't a typo then there wouldn't be any error message to capture
> :-)

Yes of course - I mis-understood his message.

>>> C:\_Test>Connect.pl
>>> hi thereSystem error 1326 has occurred.
>>>
>>> Instead of  the operating system reprorting these messages, I want
>>> to hide these and generate my own.
>>
>> That's hard without knowing the contents of Connect.pl
> 
> Actually, all he has to do is to capture STDERR, no matter what Connect.pl
> does.
> 
> jue



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

Date: Wed, 04 Jul 2007 12:42:11 GMT
From: Tad McClellan <tadmc@seesig.invalid>
Subject: Re: Error handling
Message-Id: <slrnf8n53m.rf7.tadmc@tadmc30.sbcglobal.net>

Simon <shmh@bigpond.net.au> wrote:
> Hi guys, bit of a newbie here.
>
> Im trying to learn error handling in perl.
>
> Here are a couple of scenarios.
>
> Im trying to write messages to the terminal/screen and output these over 
> operating system returned error messaages.
>
>============================================================================
>
> use Win32;
>
> print `ipconig` || die "no good";
>
>
>
> ----------------------------------------- output is:
>
> C:\Test>alright.pl
>
> 'ipconig' is not recognized as an internal or external command,
>
> operable program or batch file.
>
> no good at C:\Test\alright.pl line 4.


Your primary problem here is abusing backticks.

A secondary problem is precedence.

A tertiary problem (after fixing the precedence) is that print()
will succeed even when given an empty list to print.

They all disappear if you use the right tool for the job.

Backticks are appropriate if you want to capture the STDOUT of
on external program.

system() is appropriate if you simply want to run an external program
and let its STDOUT go where STDOUT normally goes:

   system 'ipconig' and die "no good";
or
   !system 'ipconig' or die "no good";


> Instead of  the operating system reprorting these messages, I want to hide 
> these and generate my own.


Error message are normally output on STDERR, so

   perldoc -q STDERR

       How can I capture STDERR from an external command?


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Wed, 04 Jul 2007 13:15:19 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Error handling
Message-Id: <H3Nii.3258$4A1.2097@news-server.bigpond.net.au>

Hi Tim, Jurgen!

You guys are great.

Tim I deliberately mispelt the ipconfig just to get the operating system's 
error message.


"Tim Southerwood" <ts@dionic.net> wrote in message 
news:468b8c0e$0$647$5a6aecb4@news.aaisp.net.uk...
> Jürgen Exner wrote:
>
>> Tim Southerwood wrote:
>>> Simon wrote:
>>>> print `ipconig` || die "no good";
>>> You have a typo:
>>>
>>> ipconfig
>>
>> Which in the context of his question is intentional.
>> If he hadn't a typo then there wouldn't be any error message to capture
>> :-)
>
> Yes of course - I mis-understood his message.
>
>>>> C:\_Test>Connect.pl
>>>> hi thereSystem error 1326 has occurred.
>>>>
>>>> Instead of  the operating system reprorting these messages, I want
>>>> to hide these and generate my own.
>>>
>>> That's hard without knowing the contents of Connect.pl
>>
>> Actually, all he has to do is to capture STDERR, no matter what 
>> Connect.pl
>> does.
>>
>> jue
> 




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

Date: Wed, 04 Jul 2007 13:20:12 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Re: Error handling
Message-Id: <g8Nii.3263$4A1.2183@news-server.bigpond.net.au>

Guys I really appreciate all your input thank you so much to all of you 
experts :>)

"Tad McClellan" <tadmc@seesig.invalid> wrote in message 
news:slrnf8n53m.rf7.tadmc@tadmc30.sbcglobal.net...
> Simon <shmh@bigpond.net.au> wrote:
>> Hi guys, bit of a newbie here.
>>
>> Im trying to learn error handling in perl.
>>
>> Here are a couple of scenarios.
>>
>> Im trying to write messages to the terminal/screen and output these over
>> operating system returned error messaages.
>>
>>============================================================================
>>
>> use Win32;
>>
>> print `ipconig` || die "no good";
>>
>>
>>
>> ----------------------------------------- output is:
>>
>> C:\Test>alright.pl
>>
>> 'ipconig' is not recognized as an internal or external command,
>>
>> operable program or batch file.
>>
>> no good at C:\Test\alright.pl line 4.
>
>
> Your primary problem here is abusing backticks.
>
> A secondary problem is precedence.
>
> A tertiary problem (after fixing the precedence) is that print()
> will succeed even when given an empty list to print.
>
> They all disappear if you use the right tool for the job.
>
> Backticks are appropriate if you want to capture the STDOUT of
> on external program.
>
> system() is appropriate if you simply want to run an external program
> and let its STDOUT go where STDOUT normally goes:
>
>   system 'ipconig' and die "no good";
> or
>   !system 'ipconig' or die "no good";
>
>
>> Instead of  the operating system reprorting these messages, I want to 
>> hide
>> these and generate my own.
>
>
> Error message are normally output on STDERR, so
>
>   perldoc -q STDERR
>
>       How can I capture STDERR from an external command?
>
>
> -- 
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/" 




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

Date: Wed, 04 Jul 2007 15:13:38 -0700
From:  krakle@visto.com
Subject: Re: FAQ 1.15 Where can I get a list of Larry Wall witticisms?
Message-Id: <1183587218.237630.42690@m36g2000hse.googlegroups.com>

On Jun 23, 1:43 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On Sat, 23 Jun 2007 09:06:21 -0700, kra...@visto.com wrote:
> >> 1.15: Where can I get a list of Larry Wall witticisms?
>
> >I find it hard to believe that this is a Frequently Asked Question.
>
> Many FAQ entries are not really FAQ, but what's wrong with having them
> anyway?
>

The fact that a Frequently Asked Question isn't a frequently asked
question....... that's all :)



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

Date: Wed, 04 Jul 2007 19:05:51 -0400
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: FAQ 1.15 Where can I get a list of Larry Wall witticisms?
Message-Id: <m2lkdvahww.fsf@dot-app.org>

krakle@visto.com writes:

> On Jun 23, 1:43 pm, Michele Dondi <bik.m...@tiscalinet.it> wrote:
>> On Sat, 23 Jun 2007 09:06:21 -0700, kra...@visto.com wrote:
>> >> 1.15: Where can I get a list of Larry Wall witticisms?
>>
>> >I find it hard to believe that this is a Frequently Asked Question.
>>
>> Many FAQ entries are not really FAQ, but what's wrong with having them
>> anyway?
>>
>
> The fact that a Frequently Asked Question isn't a frequently asked
> question....... that's all :)

The fact that this question doesn't appear here in the group very often
could simply be a sign of the FAQ working as intended, anticipating the
questions people often ask here, and providing the answers in advance so
that they don't have to ask to begin with.

sherm--

-- 
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


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

Date: Thu, 5 Jul 2007 19:28:40 +0000 (UTC)
From: pacman@TheWorld.com (Alan Curry)
Subject: Re: FAQ 4.6 Why doesn't & work the way I want it to?
Message-Id: <f6jgp8$v4m$1@pcls6.std.com>

In article <7srvl4-mhp.ln1@blue.stonehenge.com>,
PerlFAQ Server  <brian@stonehenge.com> wrote:
>    Most problems with "&" and "|" arise because the programmer thinks they
>    have a number but really it's a string. The rest arise because the
>    programmer says:
>
>            if ("\020\020" & "\101\101") {
>                    # ...
>                    }
>
>    but a string consisting of two null bytes (the result of ""\020\020" &
>    "\101\101"") is not a false value in Perl. You need:
>
>            if ( ("\020\020" & "\101\101") !~ /[^\000]/) {
>                    # ...
>                    }

It looks to me like the second example doesn't implement the intent of the
first. The first one presumably intends to execute the if-body if the string
result is not all zeros, but the second one does the opposite.

-- 
Alan Curry
pacman@world.std.com


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

Date: Fri, 06 Jul 2007 10:58:12 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: FAQ 4.6 Why doesn't & work the way I want it to?
Message-Id: <up0s83ti57lc0hshf9ut5a40cqdmat7pv0@4ax.com>

On Thu, 5 Jul 2007 19:28:40 +0000 (UTC), pacman@TheWorld.com (Alan
Curry) wrote:

>>            if ( ("\020\020" & "\101\101") !~ /[^\000]/) {
>>                    # ...
>>                    }
>
>It looks to me like the second example doesn't implement the intent of the
>first. The first one presumably intends to execute the if-body if the string
>result is not all zeros, but the second one does the opposite.

Well, the presence of a double negation, in the form of !~ and of ^ in
the charachter class is certainly awkward anyway. I would chose just
one, and perhaps change the if to an unless. Or none. But if one
really wants to do what I gather is intended here, then the regex must
be something like /^[\000]*\z/.


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Thu, 05 Jul 2007 04:21:51 GMT
From: "Simon" <shmh@bigpond.net.au>
Subject: Fork Example
Message-Id: <zl_ii.3452$4A1.2789@news-server.bigpond.net.au>

Hi guys!

I have the following fork script:

================================

my $child_pid = fork;
if ($child_pid) {
predator($child_pid);
print "$child_pid";
}
elsif (defined($child_pid)) {
back();
exit;
}
else
{
warn "fork failed: $!\n";
}




sub predator {
print `ping -n 30 predator`;
}


sub back {
print `ping -n 30 backup`;
}

===================================

Output is as follows..

C:\TEMP>hi.pl

Pinging predator [192.168.2.4] with 32 bytes of data:

Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
Reply from 192.168.2.4: bytes=32 time<10ms TTL=128
-122
Pinging backup [192.168.2.2] with 32 bytes of data:

Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128
Reply from 192.168.2.2: bytes=32 time<10ms TTL=128

C:\TEMP>

================================================

What Id like to know is:

1) There is no output on the screen until each process is complete, so I get 
a quick flash of the above as output.
Is there any way to kick off the child and parent simultaneously in a new 
command window, and see each line eg.each ping reply line by line?

2) Im trying to understand how I can utilize the benefits of fork. Can you 
kick off more than 2 processes eg.child and parent, so that you could do 
this, for say, 20 systems?
Eg. so you would have 20 instances of this script each pinging a different 
system, each in its own command window?

Any help appreciated. 




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

Date: Thu, 05 Jul 2007 09:26:24 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Fork Example
Message-Id: <p47p83dj7v8i23oi2tpt0dkupp1dgbf1ts@4ax.com>

On Thu, 05 Jul 2007 04:21:51 GMT, "Simon" <shmh@bigpond.net.au> wrote:

>Is there any way to kick off the child and parent simultaneously in a new 
>command window, and see each line eg.each ping reply line by line?

Fork a command window (terminal emulator, I suppose) and execute the
ping in it.

>2) Im trying to understand how I can utilize the benefits of fork. Can you 
>kick off more than 2 processes eg.child and parent, so that you could do 
>this, for say, 20 systems?

Yes, just as many as you want. (Up to ulimit or complete hog of your
system.) Did you try?

>Eg. so you would have 20 instances of this script each pinging a different 
>system, each in its own command window?

I would call this a nightmare, but if you like it...


Michele
-- 
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
 .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,


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

Date: Fri, 06 Jul 2007 02:59:24 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <iJqdnV_PKIUejxPbnZ2dnUVZ_ryknZ2d@comcast.com>

Jürgen Exner wrote:
> bassintro wrote:
>> On Jul 2, 2:20 pm, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>>> bassintro wrote:
>>>> I need a way to find all the cgi files on my server and simply list
>>>> their name and dir.
>> What I mean is I am trying to find executable files that are run on
>> the server side of a www connection.
> 
> Well, strictly speaking that could be any file on the file system where the 
> 'execute' bit is set.

Not true.  The web server severely limits which files it provides access
to.  For Apache, files that are not under DocumentRoot or ScriptAlias
cannot be accessed.

> I don't think your approach is feasible because literaly any executable on 
> the web server could be involved in generating an HTTP response.

Anyone who configures a web server so that it allows access to EVERY SINGLE
FILE ON THE SERVER should be shot on site.  (On sight?  No, on site!)

	-Joe


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

Date: Fri, 06 Jul 2007 14:12:42 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <u5sji.3$lY4.2@trndny07>

Joe Smith wrote:
> Jürgen Exner wrote:
>> bassintro wrote:
>>> On Jul 2, 2:20 pm, "Jürgen Exner" <jurge...@hotmail.com> wrote:
>>>> bassintro wrote:
>>>>> I need a way to find all the cgi files on my server and simply
>>>>> list their name and dir.
>>> What I mean is I am trying to find executable files that are run on
>>> the server side of a www connection.
>>
>> Well, strictly speaking that could be any file on the file system
>> where the 'execute' bit is set.
>
> Not true.  The web server severely limits which files it provides
> access to.  For Apache, files that are not under DocumentRoot or
> ScriptAlias cannot be accessed.
>
>> I don't think your approach is feasible because literaly any
>> executable on the web server could be involved in generating an HTTP
>> response.
>
> Anyone who configures a web server so that it allows access to EVERY
> SINGLE FILE ON THE SERVER should be shot on site.  (On sight?  No, on
> site!)

True. Let me rephrase:
"that could be any file that is accessible via the web server system and 
where the 'execute' bit is set".

Maybe that is actually even a useful search criteria.

jue 




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

Date: Fri, 06 Jul 2007 15:16:36 -0000
From:  bassintro <bassintro@gmail.com>
Subject: Re: Help finding CGI files on Unix server
Message-Id: <1183734996.403691.147450@r34g2000hsd.googlegroups.com>

On Jul 3, 5:07 am, Joe Smith <j...@inwap.com> wrote:
> bassintro wrote:
> > What I mean is I am trying to find executable files that are run on
> > the server side of a www connection.
>
> CGI files are whatever the web server's configuration says is a CGI.
>
> On one web server I used, only the ScriptAlias defined the directories
> where CGI programs lived, and any file in that directory was considered
> to be a CGI program whether it was executable or not.
>
>      ls `awk '/^ScriptAlias/{print $3}' /etc/httpd/conf/httpd.conf`
>
> Another web server accepted any file with a .cgi extension as a
> CGI program.  It did not matter whether the contents of the file was
> Perl, Bourne shell, or compiled binary.
>
>      find /var/www/html /home/*/public_html -name '*.cgi' -print
>
> Looking inside of HTML files is a pretty poor method for locating these.
>
>         -Joe

Would a server be exploitable if the ScriptAlias variable was defined
but the dir did not exist?

On one server I want to run cgi scripts and the other one I don't at
all. Server A has the script alias variable defined in httpd.conf but
the dir doesn't exist. Server B has the script alias variable defined
and the dir does exist with strict permissions.
Does it really matter or should I just comment the Alias out?



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

Date: Thu, 5 Jul 2007 10:44:34 +0000 (UTC)
From: kj <socyl@987jk.com.invalid>
Subject: How to generate parser from *.l and *.y files?
Message-Id: <f6ii2i$6rg$1@reader2.panix.com>



I have input files for lex and yacc (tok.l and gram.y).  I
could use lex and yacc to generate a parser from these files, but
the generated code would be C.  Is there a way to directly generate
Perl code from these files?

(I'm aware of Parse::RecDescent, but the grammar in gram.y is
voluminous (the file is almost 1MB in size), and it would take me
forever to translate it to one that Parse::RecDescent can understand...
unless, of course, there is an automated means to perform such
translation.)

TIA!

kj

-- 
NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.


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

Date: 05 Jul 2007 14:03:45 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: How to generate parser from *.l and *.y files?
Message-Id: <slrnf8pui1.1a4.abigail@alexandra.abigail.be>

                                      _
kj (socyl@987jk.com.invalid) wrote on VLVI September MCMXCIII in
<URL:news:f6ii2i$6rg$1@reader2.panix.com>:
??  
??  
??  I have input files for lex and yacc (tok.l and gram.y).  I
??  could use lex and yacc to generate a parser from these files, but
??  the generated code would be C.  Is there a way to directly generate
??  Perl code from these files?

Not that I know of, but you might be able to use XS or Inline::C to 
call the resulting C from your Perl.



Abigail
-- 
# Count the number of lines; code doesn't match \w. Linux specific.
()=<>;$!=$=;($:,$,,$;,$")=$!=~/.(.)..(.)(.)..(.)/;
$;++;$*++;$;++;$*++;$;++;`$:$,$;$" $. >&$*`; 


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

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 V11 Issue 620
**************************************


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