[22541] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4762 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 25 18:10:45 2003

Date: Tue, 25 Mar 2003 15:10:13 -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           Tue, 25 Mar 2003     Volume: 10 Number: 4762

Today's topics:
        more than one apache script directory ? <ericosman@rcn.com>
    Re: more than one apache script directory ? <noreply@gunnar.cc>
        Newbie:  how to use fork and daemonize in CGI script (Kathryn)
        peride and xp <nought@nought.com>
    Re: Perl PHP and MySQL - Gather Images <patrick@eganconsulting.com>
        Perl to parse C++ code?? <michael.p.broida@boeing.com>
    Re: Perl to parse C++ code?? (Kevin Cline)
    Re: Search and replace spaces <cbk047@email.mot.com>
    Re: Search and replace spaces <tore@aursand.no>
    Re: Simple, but I can't figure it out. <tore@aursand.no>
    Re: Split loop - Reh Hat 7.3 Perl perl, v5.8.0 built fo <tore@aursand.no>
        storing an ODBC date properly <ian@kupola.com>
        win32 how to find process id (Anand Ramamurthy)
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 25 Mar 2003 17:11:24 -0500
From: Eric Osman <ericosman@rcn.com>
Subject: more than one apache script directory ?
Message-Id: <3E80D40C.4020901@rcn.com>


Hi,

In order to test my html and Perl scripts on my local apache server
before ftp'ing them to the rcn server, I'm attempting to
change apache's roots to my own directories.

note ***  I'm on xp .

But I'm getting an awful error when my html attempts to
call the script.

First, I'm starting with this html which DOES come up:
http://localhost/wind/nicerFormat.html

but when I click the SUBMIT button, which is supposed to access
this :
<form name=digest method=post action=reFormat.pl>


I get this error:
-----------------------

     Forbidden

     You don't have permission to access /wind/reFormat.pl on this
     server.
     Apache/2.0.44 (Win32) mod_perl/1.99_08 Perl/v5.8.0 Server at
     localhost Port 80


I'll show you my config file changes, and then the pertinent html and
error message:

First, here are various sections of the config file, showing BOTH
the commented out original lines and my new lines :


Here's the changed document root (I assume it's not possible to have
two of them ???)
-----------------------

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "C:/indigoperl/apache/htdocs"
DocumentRoot "C:/Documents and Settings/Eric Osman/Desktop/eric/web"


and the associated directory invokation:
-----------------------

#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "C:/indigoperl/apache/htdocs">
<Directory "C:/Documents and Settings/Eric Osman/Desktop/eric/web">



here's the change for the script root :
-----------------------

#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the realname directory are treated as applications and
# run by the server when requested rather than as documents sent to the 
client.
# The same rules about trailing "/" apply to ScriptAlias directives as to
# Alias.
#
#ScriptAlias /cgi-bin/ "C:/indigoperl/apache/cgi-bin/"
ScriptAlias /cgi-bin/ "C:/Documents and Settings/Eric 
Osman/Desktop/eric/web/wind"


and finally, the associate directory invokation:
-----------------------

#
# "C:/indigoperl/apache/cgi-bin" should be changed to whatever your 
ScriptAliased
# CGI directory exists, if you have that configured.
#
#<Directory "C:/indigoperl/apache/cgi-bin">
#    AllowOverride None
#    Options None
#    Order allow,deny
#    Allow from all
#</Directory>

<Directory "C:/Documents and Settings/Eric Osman/Desktop/eric/web/wind">
     AllowOverride None
     Options None
     Order allow,deny
     Allow from all
</Directory>


Am I attempting this correctly ?

Thanks.  /Eric



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

Date: Tue, 25 Mar 2003 23:51:35 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: more than one apache script directory ?
Message-Id: <b5qmj3$2c1hcm$1@ID-184292.news.dfncis.de>

Eric Osman wrote:
> # The same rules about trailing "/" apply to ScriptAlias directives
> # as to Alias.
> #
> #ScriptAlias /cgi-bin/ "C:/indigoperl/apache/cgi-bin/"
> ScriptAlias /cgi-bin/ "C:/Documents and Settings/Eric
> Osman/Desktop/eric/web/wind"
----------------------------^^

Where is the trailing slash?

What Perl question do you have? ;-)

/ Gunnar

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: 25 Mar 2003 13:06:44 -0800
From: kathryn@printingforless.com (Kathryn)
Subject: Newbie:  how to use fork and daemonize in CGI script
Message-Id: <182c49fd.0303251306.22756a39@posting.google.com>

I have a CGI script that retrieves over a hundred parameters from a
form.  Four of those parameters are from file-type input fields. In
this script, the parameters are retrieved to create a text file, to
send email receipts and notifications, to upload up to four files, and
then to create an html page.  The problem we are having is if a
customer loses his connection during file upload, the entire script
fails.  So, no email, no text file, and no html page is created.

How do I set it up so that the upload part of the script is entirely
separate from the rest of the script?  I tried to make the upload a
child process within a fork, but I haven't figured out how to make it
so that the parent containing the emails, text file and html page
completes whether or not the child fails.

An example showing the correct layout of commands would be greatly
appreciated!


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

Date: Tue, 25 Mar 2003 22:01:26 -0000
From: "andrew sprott" <nought@nought.com>
Subject: peride and xp
Message-Id: <3e80c3c1_1@news1.vip.uk.com>

hi ppl

on this machine i was developin my perl/cgi scripts usin indigo perl and
perlide. downside was indigo perl would eventually hog all resources and i
would have to reboot. upside is perlide was rock solid.

gnow i'm runnin xp and upside is, indigo works a treat, downside is perlide
won't compile my scripts. this aint that bad cos my scripts compiled most of
the time, but the debugger would quickly display the output of the script,
and i gneed the single step execution.

whenever i try to compile a script i get...

<snip>

No DB::DB routine defined at G:/perl/indigo/perl/lib/Cwd.pm line 151.
BEGIN failed--compilation aborted at G:/perl/indigo/perl/lib/Cwd.pm line
151.
Compilation failed in require at ..\..\..\..\ide/perl5db.pl line 39.
BEGIN failed--compilation aborted at ..\..\..\..\ide/perl5db.pl line 39.
Compilation failed in require.
BEGIN failed--compilation aborted.

</snip>

also a perl script called cwd.pl is open wiv execution point at the line...

<snip>

use Carp;

</snip>

please can anybody tell me what to do. are there any workarounds? i've tried
contactin the author, and it seems i have the latest release.

or failin that, are there any other perl ide packages available. i'll pay
for one if it's reasonably priced.

tia

andrew sprott




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

Date: Tue, 25 Mar 2003 14:52:51 -0500
From: "news.sympatico.ca" <patrick@eganconsulting.com>
Subject: Re: Perl PHP and MySQL - Gather Images
Message-Id: <Nu2ga.5056$D24.384126@news20.bellglobal.com>

Thanks Tad, good advice.  Less is best. 8^)




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

Date: Tue, 25 Mar 2003 18:27:04 GMT
From: "Michael P. Broida" <michael.p.broida@boeing.com>
Subject: Perl to parse C++ code??
Message-Id: <3E809F78.4DC4A462@boeing.com>

Hi!
	I'm trying to setup a Perl tool that will parse some of our C++ code
	files (mostly .h files) and make a list of all the symbols (variables,
	enum names, #defines, etc) that it finds.  This list will be used by
	another program or a later step of the tool.

	I had been leaning toward having the Perl tool create a single C++ file
	that would include all of the .h files, then (when compiled) print out
	all of the necessary symbols.  However, the procedure required on the
	user's part was becoming too cumbersome.  The user would have to run
	ToolOne, compile/link the output, then run ToolTwo to USE the end data.

	So I'm back to having my Perl tool parse the C++ code directly.

	I'm posting here in hopes that SOMEONE, SOMEWHERE, SOMEWHEN has created
	such a beastie that I could scavenge relevant chunks from for this purpose.
	I do not need to worry about EXECUTABLE code, only data declarations
	(though I might have to add #defines later).  I'm just dreading having to
	deal with all the counting of {}, etc, involved with handling the scoping
	of symbols; yes, scope handling is needed here.

	Anyone know of a Perl "C++-parser" crittur I can start from?

		Thanks!
			Mike


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

Date: 25 Mar 2003 15:00:46 -0800
From: kcline17@hotmail.com (Kevin Cline)
Subject: Re: Perl to parse C++ code??
Message-Id: <ba162549.0303251500.2c045210@posting.google.com>

"Michael P. Broida" <michael.p.broida@boeing.com> wrote in message news:<3E809F78.4DC4A462@boeing.com>...
> Hi!
> 	I'm trying to setup a Perl tool that will parse some of our C++ code
> 	files (mostly .h files) and make a list of all the symbols (variables,
> 	enum names, #defines, etc) that it finds.  This list will be used by
> 	another program or a later step of the tool.

This is a difficult task.  C++ is a complicated language, made
even more complicated by the preprocessor.

> 
> 	I had been leaning toward having the Perl tool create a single C++ file
> 	that would include all of the .h files, then (when compiled) print out
> 	all of the necessary symbols.  However, the procedure required on the
> 	user's part was becoming too cumbersome.  The user would have to run
> 	ToolOne, compile/link the output, then run ToolTwo to USE the end data.

If you're stuck here trying to automate these three steps, then I expect
that parsing C++ code will be beyond your capabilities.
 
> 	So I'm back to having my Perl tool parse the C++ code directly.
> 
> 	I'm posting here in hopes that SOMEONE, SOMEWHERE, SOMEWHEN has created
> 	such a beastie that I could scavenge relevant chunks from for this purpose.
> 	I do not need to worry about EXECUTABLE code, only data declarations
> 	(though I might have to add #defines later).

Have you looked at the free program 'etags' ?  It probably does a better
job than you will be able to, and it would be a simple matter to write
a Perl script to massage it's output into a different form.


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

Date: Tue, 25 Mar 2003 09:52:19 -0600
From: Bryan Krone <cbk047@email.mot.com>
Subject: Re: Search and replace spaces
Message-Id: <3E807B33.41277A85@email.mot.com>

Ning li wrote:
> 
> Hi,
> 
>    I am new to Perl and I have used awk and sed before. I would like to know
> how I can use Perl to do the equivilent of the sed command to remove the
> empty spaces at the end of the line: sed 's/  *$//g' filename?
> 
>    Thanks in advance.
> 
>    Nick


$str1 = "String with spaces at the end          ";

print "before: $str1 length: " . length $str1;
print "\n";

$str1 =~ s/  *$//g;

print "after: $str1 length: " . length $str1;
print "\n";


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

Date: Tue, 25 Mar 2003 23:48:27 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Search and replace spaces
Message-Id: <pan.2003.03.25.21.12.06.517533@aursand.no>

On Tue, 25 Mar 2003 15:11:03 +0000, Ning li wrote:
> I am new to Perl and I have used awk and sed before. I would like to
> know how I can use Perl to do the equivilent of the sed command to
> remove the empty spaces at the end of the line: sed 's/  *$//g'
> filename?

This _must_ be something for SAQ (or whatever it's called); you have just
answered your question yourself. :)

A little more perlish way to do it would be;

  $var =~ s,\s+$,,;


-- 
Tore Aursand


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

Date: Tue, 25 Mar 2003 21:46:53 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Simple, but I can't figure it out.
Message-Id: <pan.2003.03.25.13.03.28.575517@aursand.no>

On Tue, 25 Mar 2003 08:43:46 +0000, Tassilo v. Parseval wrote:
>> Use splice() instead;
>> 
>>   open( TMP, ">news.txt" ) || die "Couldn't open file: $!\n";
>>   print TMP splice( @lines, 0, 20 );
>>   close( TMP );

> The above will remove elements 0 to 20 from the array and is thus
> destructive.

You're right.  I assumed that he just wanted the 20 lines mentioned and be
done with it (ie. '@lines').

> Why not just a list-slice?
> 
>     open TMP, ">news.txt" or die $!;
>     print TMP $_, "\n" for @lines[0 .. 20];
>     close TMP;

Yup, except that you need @lines[0..19] if you want 20 lines, not 21.
Uhm.  The OP _was_ talking about 20 lines, right? :)


-- 
Tore Aursand


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

Date: Tue, 25 Mar 2003 23:48:27 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Split loop - Reh Hat 7.3 Perl perl, v5.8.0 built for	i386-linux-thread-multi
Message-Id: <pan.2003.03.25.21.18.18.657961@aursand.no>

On Tue, 25 Mar 2003 15:41:39 +0000, Charlie Brenneman wrote:
> Split loop at userchk.pl line 19.

Doesn't say that here;

  This is perl, v5.8.0 built for i386-linux-thread-multi
  Red Hat 8.0


-- 
Tore Aursand


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

Date: Tue, 25 Mar 2003 19:56:34 +0100
From: Ian Portman <ian@kupola.com>
Subject: storing an ODBC date properly
Message-Id: <3E80A662.DC83EF2D@kupola.com>

Hello all

I have been made to use ASP and ADO for a simple database. 

I have an ODBC date , format YY-MM-DD which I get from an ADO thus:
$recordset->Fields("LastUsed")->{Value}.

If I use this  .ASP notation <% =
$recordset->Fields("LastUsed")->{Value}%>  the date appears fine.

But I want to store this date in a Perl variable and use it later. 

When I do this ( $mydate=$recordset->Fields("LastUsed")->{Value} ) then
check out $mydate, I get

Win32::OLE::Variant=SCALAR(0xd045c20).

Any clues as to how I might deconstruct this?

Thanks

Ian


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

Date: 25 Mar 2003 09:14:37 -0800
From: anand_ramamurthy@yahoo.com (Anand Ramamurthy)
Subject: win32 how to find process id
Message-Id: <761041e6.0303250914.43fee13e@posting.google.com>

How do i find the process id of a Win32 process
that has already been started (by not using
Win32::Process)?

Also, how can i monitor its status (alive, sleep
etc.)?

Thank you,

-anand


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

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


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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


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


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