[28282] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 9646 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 25 11:05:35 2006

Date: Fri, 25 Aug 2006 08:05:05 -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, 25 Aug 2006     Volume: 10 Number: 9646

Today's topics:
        DBI Performance Issues <chris@thezengarden.net>
        Improved with a hatchet? <bill@ts1000.us>
    Re: Improved with a hatchet? <glennj@ncf.ca>
    Re: Improved with a hatchet? <glennj@ncf.ca>
    Re: Indirectly called  code <bol@adv.magwien.gv.at>
    Re: Indirectly called  code <uri@stemsystems.com>
        Match regular expression from LEFT to right <fritz-bayer@web.de>
    Re: Match regular expression from LEFT to right anno4000@radom.zrz.tu-berlin.de
    Re: Match regular expression from LEFT to right <mritty@gmail.com>
        page reload question pleaseexplaintome@yahoo.com
    Re: page reload question <glex_no-spam@qwest-spam-no.invalid>
    Re: Prevent multiple instances of a script to launch <syscjm@gwu.edu>
    Re: Question about UNIVERSAL <bol@adv.magwien.gv.at>
    Re: regular expression variables under debugger <wlcna@nospam.com>
    Re: regular expression variables under debugger <mritty@gmail.com>
    Re: regular expression variables under debugger <news@lawshouse.org>
        Siimple solution to "Access denied" problem with WinXP- <Bpant@mathworks.com>
    Re: Siimple solution to "Access denied" problem with Wi <glennj@ncf.ca>
    Re: Win32::GUI and Scrolling Text <zentara@highstream.net>
    Re: Win32::GUI and Scrolling Text <henry_mcguinnessDELETE@THISyahoo.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 25 Aug 2006 10:33:38 -0400
From: "Chris H." <chris@thezengarden.net>
Subject: DBI Performance Issues
Message-Id: <pan.2006.08.25.14.33.37.279240@thezengarden.net>

im currently working on an issue for work, in which processing of a pipe
delimited text file consisting of 356,400 lines of data with 19 fields in
each row.

the issue that i am having is not the performance of reading and splitting
this data, but in writing to the database. using dbi/dbd::mysql, using
'localhost' as the server the script connects to i get the following
results:

> time ./ushbh-dev.pl hbh.txt
Reading input file - 08/25/06 10:19:09
Updating us_hourly table - 08/25/06 10:19:09
1000 records processed.

real    0m1.096s
user    0m0.424s
sys     0m0.008s

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

using 'servername.tld' from a remote machine, i get the following
performance:


> time ./ushbh-dev.pl hbh.txt
Reading input file - 08/25/06 10:17:49
Updating us_hourly table - 08/25/06 10:17:49
1000 records processed.

real    1m11.606s
user    0m0.250s
sys     0m0.034s

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

the issue seems to be with remote connections either through the dbi
module, or the dbd::mysql driver. this also appears with the sybase dbi
driver going from a unix machine to a mssql machine.

are there any remote connection variables or performance enchancing calls
that im missing?

the sql query thats being run is:

update table foo set var1 = 'foo', var2 = 'foo2' where var3 = 'bar' and
var4 = 'bar2';

the table is indexed based on var3 and var4, which did show a huge
increase in performance once it was indexed properly.

this is data that needs to be updated every 15 minutes, so dropping the
data and re-inserting is not an option.

thanks for any help or insight you can provide on this issue.

-- 
Chris H.
http://www.nasland.nu



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

Date: 25 Aug 2006 07:29:25 -0700
From: "Bill H" <bill@ts1000.us>
Subject: Improved with a hatchet?
Message-Id: <1156516165.254698.25500@74g2000cwt.googlegroups.com>

I am using the following snippet of code to rotate a list starting at a
random postion and it seems to run real slow (it works the way I want
it to), can someone tell me how it can be improved?

sub RotateList
{
    my $results = "";
    my $srq = rand(@rotquest);
    my $i = 0;
    my $j = 0;
    for($i = 0;$i < @rotquest;$i++)
    {
        $j = $srq;
        $srq++;
        if ($srq >= @rotquest){$srq = 0;}
        $results .= $rotquest[$j];
    }
    return ($results);
}


And here is how I enter the routine:

            @rotquest = (
            qq~    <INPUT TYPE=CHECKBOX NAME="EMPLOYED1" VALUE="An
automobile manufacturer or dealer ">An automobile manufacturer or
dealer<BR>~,
            qq~    <INPUT TYPE=CHECKBOX NAME="EMPLOYED2" VALUE="A
market research company">A market research company<BR>~,
            qq~    <INPUT TYPE=CHECKBOX NAME="EMPLOYED3" VALUE="A
newspaper or TV station">A newspaper or TV station<BR>~,
            qq~    <INPUT TYPE=CHECKBOX NAME="EMPLOYED4" VALUE="An
advertising agency">An advertising agency<BR>~);
            $q4 = &RotateList();
            $q4 .= qq~    <INPUT TYPE=CHECKBOX NAME="EMPLOYED5"
VALUE="None of the above">None of the above\n~;

I am not concerned that it isn't returning a list since I just then
dump the results out to a web page.

Bill H www.ts1000.us



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

Date: 25 Aug 2006 14:47:00 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Improved with a hatchet?
Message-Id: <slrneeu3b4.kj9.glennj@smeagol.ncf.ca>

At 2006-08-25 10:29AM, "Bill H" wrote:
>  I am using the following snippet of code to rotate a list starting at a
>  random postion and it seems to run real slow (it works the way I want
>  it to), can someone tell me how it can be improved?
>  
>  sub RotateList
>  {
>      my $results = "";
>      my $srq = rand(@rotquest);
>      my $i = 0;
>      my $j = 0;
>      for($i = 0;$i < @rotquest;$i++)
>      {
>          $j = $srq;
>          $srq++;
>          if ($srq >= @rotquest){$srq = 0;}
>          $results .= $rotquest[$j];
>      }
>      return ($results);
>  }

No need to iterate over the list.  Just use the random index to split
the list in two, and join the pieces in reverse order:

    sub RotateList
    {
        my @list = @_;
        my $index = int rand $#list;
        return @list[$index+1 .. $#list], @list[0 .. $index];
    }

    my @rotquest = (...);
    my @rotated = RotateList(@rotquest);


-- 
Glenn Jackman
Ulterior Designer


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

Date: 25 Aug 2006 14:54:38 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Improved with a hatchet?
Message-Id: <slrneeu3pe.kj9.glennj@smeagol.ncf.ca>

At 2006-08-25 10:47AM, "Glenn Jackman" wrote:
>  No need to iterate over the list.  Just use the random index to split
>  the list in two, and join the pieces in reverse order:
>  
>      sub RotateList
>      {
>          my @list = @_;
>          my $index = int rand $#list;
>          return @list[$index+1 .. $#list], @list[0 .. $index];

or
           return splice(@list, $index+1), @list
>      }
>  
>      my @rotquest = (...);
>      my @rotated = RotateList(@rotquest);

-- 
Glenn Jackman
Ulterior Designer


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

Date: Fri, 25 Aug 2006 15:49:03 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: Indirectly called  code
Message-Id: <1156513744.920906@proxy.dienste.wien.at>

Uri Guttman:

> >> o) Import facility (@INC)
>
> i wouldn't call @INC the import facility. importing is a symbol table
> thing in perl. @INC is for finding source files to load.

But you can place code in @INC, and it becomes executed when
Perl looks for module files. And yes, it's called "import facility".
Have a look at "perldoc -f require" and see the sentence starting with:

"You can also insert hooks into the import facility, by putting
  directly Perl code into the @INC array.  There are three forms
  of hooks: subroutine references, array references and blessed
  objects."

> i am scared to ask the OP why he is looking for this? i will guess he
> wants to make sure all such code is secure or something like that.

I want to look for "hooks" into the Perl interpreter iteself - or, to be
more precise, code which affects its behaviour (mainly during the
compilation phase), just _before_ the actual script starts to run.

Greetings, Ferry

-- 
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: bol@adv.magwien.gv.at




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

Date: Fri, 25 Aug 2006 10:58:16 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Indirectly called  code
Message-Id: <x7k64w981j.fsf@mail.sysarch.com>

>>>>> "FB" == Ferry Bolhar <bol@adv.magwien.gv.at> writes:

  >> i am scared to ask the OP why he is looking for this? i will guess he
  >> wants to make sure all such code is secure or something like that.

  FB> I want to look for "hooks" into the Perl interpreter iteself - or, to be
  FB> more precise, code which affects its behaviour (mainly during the
  FB> compilation phase), just _before_ the actual script starts to run.

but you have never said why you want this information. as i also said,
with eval there is no concrete line between compile time and runtime in
perl. this means you can't possibly track all such hooks without
actually running the program. it feels almost like the halting problem.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 25 Aug 2006 06:49:33 -0700
From: "fritz-bayer@web.de" <fritz-bayer@web.de>
Subject: Match regular expression from LEFT to right
Message-Id: <1156513773.311484.105510@m73g2000cwd.googlegroups.com>

Hi,

lets say I have the following string:

<tr> dfsdfre <tr>fsdsfd35gd <tr>khf758 <tr>afdga654jhuotj <input
type="text"> 67kfbs356</tr>sh tu65 </tr> hbrubs</tr>

and I would like to capture the text before the <input...> until the
first <tr> and the text after until the first <tr> so that I get

<tr>afdga654jhuotj <input type="text> 67kfbs356</tr>

How would I do this?

=~ m!<tr>.*?<input type="text">.*?<tr>!

will only work capturing the first <tr> after the <input..>. The
problem is that I have to find a expression, which starts looking from
the right to the left of <input...>.

Fritz



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

Date: 25 Aug 2006 14:22:54 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: Match regular expression from LEFT to right
Message-Id: <4l8fduFpe34U1@news.dfncis.de>

fritz-bayer@web.de <fritz-bayer@web.de> wrote in comp.lang.perl.misc:
> Hi,
> 
> lets say I have the following string:
> 
> <tr> dfsdfre <tr>fsdsfd35gd <tr>khf758 <tr>afdga654jhuotj <input
> type="text"> 67kfbs356</tr>sh tu65 </tr> hbrubs</tr>
> 
> and I would like to capture the text before the <input...> until the
> first <tr> and the text after until the first <tr> so that I get
> 
> <tr>afdga654jhuotj <input type="text> 67kfbs356</tr>
> 
> How would I do this?
> 
> =~ m!<tr>.*?<input type="text">.*?<tr>!
> 
> will only work capturing the first <tr> after the <input..>. The
> problem is that I have to find a expression, which starts looking from
> the right to the left of <input...>.

Your explanation is confused about whether the closing part should
be <tr> or </tr>.  Please clear that up.

Anno


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

Date: 25 Aug 2006 07:23:08 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: Match regular expression from LEFT to right
Message-Id: <1156515787.955385.147780@m79g2000cwm.googlegroups.com>

fritz-bayer@web.de wrote:
> lets say I have the following string:
>
> <tr> dfsdfre <tr>fsdsfd35gd <tr>khf758 <tr>afdga654jhuotj <input
> type="text"> 67kfbs356</tr>sh tu65 </tr> hbrubs</tr>

I can't imagine why you'd have such a thing, as it's massively
incorrectly formatted HTML, but okay.

> and I would like to capture the text before the <input...> until the
> first <tr> and the text after until the first <tr> so that I get
>
> <tr>afdga654jhuotj <input type="text> 67kfbs356</tr>
>
> How would I do this?
>
> =~ m!<tr>.*?<input type="text">.*?<tr>!

I assume you meant to include a / in the last <tr> there, right?

> will only work capturing the first <tr> after the <input..>. The
> problem is that I have to find a expression, which starts looking from
> the right to the left of <input...>.

One idea might be to use a negative look-ahead assertion.  Basically
say "match a <tr> that's not followed by anything that includes <tr>".


$ perl -le'
$_ = q{<tr> dfsdfre <tr>fsdsfd35gd <tr>khf758 <tr>afdga654jhuotj <input
type="text"> 67kfbs356</tr>sh tu65 </tr> hbrubs</tr>};
m#(<tr>(?!.*<tr>.*).*<input type="text">.*?</tr>)#;
print $1;
'
<tr>afdga654jhuotj <input type="text"> 67kfbs356</tr>


I assume there are other ways as well.

Paul Lalli



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

Date: 25 Aug 2006 07:33:50 -0700
From: pleaseexplaintome@yahoo.com
Subject: page reload question
Message-Id: <1156516430.894244.200260@h48g2000cwc.googlegroups.com>

Hi, I have a perl/cgi script that includes dynamically created
checkboxes and file names.  When a given checkbox is checked I move the
related file.  how do I redisplay the page without the checkbox and
file name.  In other words, I want to reload the page just as if the
user has entered for the 1st time.

i've tried variations of:

<form action="/cgi-bin/page.cgi" method="post" onsubmit="doRefresh()">

function doRefresh(){
   location.replace("/cgi-bin/page.cgi");
   //location.reload("/cgi-bin/page.cgi");
   //location.reload("");
}                             

Thanks for any help



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

Date: Fri, 25 Aug 2006 10:07:27 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: page reload question
Message-Id: <44ef1104$0$34072$815e3792@news.qwest.net>

pleaseexplaintome@yahoo.com wrote:
> Hi, I have a perl/cgi script that includes dynamically created
> checkboxes and file names.  When a given checkbox is checked I move the
> related file.  how do I redisplay the page without the checkbox and
> file name.  In other words, I want to reload the page just as if the
> user has entered for the 1st time.
> 
> i've tried variations of:
> 
> <form action="/cgi-bin/page.cgi" method="post" onsubmit="doRefresh()">
> 
> function doRefresh(){
>    location.replace("/cgi-bin/page.cgi");
>    //location.reload("/cgi-bin/page.cgi");
>    //location.reload("");
> }                             
> 
> Thanks for any help

Wow, that looks so much like JavaScript, instead of perl, it's amazing.

My crystal ball says... if you're using the CGI module, look in the 
documentation for 'override'.


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

Date: Fri, 25 Aug 2006 10:35:10 -0400
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: Prevent multiple instances of a script to launch
Message-Id: <12eu2l1k3madq3f@corp.supernews.com>

Philipp wrote:
> Hello
> I have written a Perl script (win32) and use it to drag&drop files on it 
> for execution.
> Now if I drop multiple files at once, they are processed one after the 
> other. But if I drop one file at a time, each starts a new perl 
> interpreter and new script.
> 
> Is there an easy way to prevent these new copies to start and instead 
> queue the corresponding files in an already running script? (so they get 
> executed sequentially and not in parallel)
> 
> Thanks for your answers
> Phil

Rewrite the script so that it checks to see if it's already running.
If it isn't, run your current main script.  If it is, add it to
your current queue of files to process and exit.  A good mechanism
might be a temp file with a list of the files to process.  Checking
on its existence will show if the script is already running,
and subsequent runs can stuff the new files to be processed into
the temp file.  Make sure that the script always locks the file
when using it and releases the lock when done, and watch for
race conditions!


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

Date: Fri, 25 Aug 2006 16:06:33 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: Question about UNIVERSAL
Message-Id: <1156514794.328050@proxy.dienste.wien.at>

Ben Morrow:

>> Is this what "Regexp::DESTROY" is for?
>
> WTF??? *NO*.
>
> Regexp::DESTROY does nothing. It's defined in perl/universal.c .

If it does nothing, why does it exist?

> What on earth made you think it had *anything* to do with cycles in the
> @ISA hierarchy?

Well, it was just a guess - some longe time ago, I heard about an error
with a special kind of objects which did not get destroyed correctly,
resulting in memory leaks - and that's what Regexp::DESTROY was
created for. And since @ISA has to do with objects and you wrote
about an error in @ISA handling without further details, I guessed it
could be this one...

> perldocs/Camel/here/perl source. And, most importantly, applying some
> common sense to all of the above.

Well, the last topic isn't alway simple...

> I don't wish to be mean, but I really think you would be better off
> learning rather more about programming in general, including how to find
> the answers to questions such as these yourself, before you tackle the
> deeper aspects of how perl is implemented.

I'll follow your suggestion. OTOH, I think, newsgroups like this one are
the right place to ask questions about each aspect of Perl. Sorry. It's
not my intention to borrow anyone here.

Thanks for your help, and kind greetings,

Ferry

-- 
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: bol@adv.magwien.gv.at




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

Date: Fri, 25 Aug 2006 13:59:51 GMT
From: "wlcna" <wlcna@nospam.com>
Subject: Re: regular expression variables under debugger
Message-Id: <rnDHg.10947$%j7.9175@newssvr29.news.prodigy.net>

"Tad McClellan" <tadmc@augustmail.com> wrote in message 
news:slrneesp5j.mcs.tadmc@magna.augustmail.com...
>
> Then the problem is probably in the part that made you use
> the "essentially" qualifier...   :-)

:)  Of course, but not really in this case.  The offending code is 
essentially IDENTICAL to what I posted.  But the "inessential" that is 
the key is *I think* WHERE THE INPUT IS COMING FROM, see my other post. 
If I type the identical input string, things work fine.  But if this 
input string comes from the XML library, the problem occurs.  So, it's 
not a matter of a difference in the code, but a difference in the 
environment in which the code is being executed.

>
> I have a guess that might explain what you see.
>
> You have now _twice_ posted code that uses a dollar-digit variable
> without first ensuring that the intended pattern match _succeeded_.
>

A good point about this manner of coding, one should always check that 
the regex succeeded before pulling stuff out of it, THOUGH IN THIS CASE 
SHOULD NOT MATTER b/c the input should match the regex.  It *does* match 
the regex, for certain, e.g. when the debugger is not running, it 
matches fine.

Is there a variable that tells whether the last regex succeeded?  In 
terms of writing the code, I'd say using your suggestion would involve 
adding a "die" statement if the regex does not succeed, and I see two 
ways:

die "Expected format violated!" if not $str =~ /REGEX/;

OR

$str =~ /REGEX/;
die "Expected format violated!" if not 
$SOMEBUILTINVARIABLETHATTELLSREGEXSUCCESSSTATUS.

I think I prefer the latter since I don't like putting something 
important
at the end of a line.  Is there such a variable?

And also, it's an interesting idea to check if the regex thinks it's 
failing, because it shouldn't be.  Like I say I've manually checked the 
input and the regex and it also works when not in the debugger.  If it 
thinks it's failing, that would be interesting as well, so I'm going to 
change the code right now to see what it thinks...and......THE REGEX 
THINKS IT'S FAILING IN THE DEBUGGER!  (And again, same command works 
fine when not run in debugger.)

Interesting eh?

How about this for goofy:

I just ran this under the debugger and suspected that the second time 
might vary from the first time and I was correct, check out this 
weirdness:

  DB<2> print "hello" if not $str =~ /([0-9]*)\.html/; print $1;
hello
  DB<3> print "hello" if not $str =~ /([0-9]*)\.html/; print $1;
2222

Those are two identical lines of code evaluated in the debugger with the 
same input and the second time gives a different result from the first 
time.  Note the "hello" indicates the problem, the 2222 is the string 
that is expecting that SHOULD BE coming back in the $1 and that does 
when not in the debugger.

> If the match you intended to set $1 fails, then the value you see
> for $1 is some old stale value from a previous match that _did_
> succeed (or undef if no successful matches).
>

Yes thanks for pointing out this coding convention, and this is why it's 
undef, the regex is failing - though WHY is the question as it shouldn't 
be, and it doesn't when not in the debugger.  See also my utf8 item in 
another message.  I think I'm getting close to the answer, it looks to 
me like the input coming from the XML libraries is a string that has 
some UTF8 thing associated with it, at least that seems to be the 
relevant difference in the actual code versus the posted code. 




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

Date: 25 Aug 2006 07:15:05 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: regular expression variables under debugger
Message-Id: <1156515305.615509.68210@b28g2000cwb.googlegroups.com>

wlcna wrote:
> I just ran this under the debugger and suspected that the second time
> might vary from the first time and I was correct, check out this
> weirdness:
>
>   DB<2> print "hello" if not $str =~ /([0-9]*)\.html/; print $1;
> hello
>   DB<3> print "hello" if not $str =~ /([0-9]*)\.html/; print $1;
> 2222
>
> Those are two identical lines of code evaluated in the debugger with the
> same input and the second time gives a different result from the first
> time.  Note the "hello" indicates the problem, the 2222 is the string
> that is expecting that SHOULD BE coming back in the $1 and that does
> when not in the debugger.

Once again, I cannot duplicate your problem:
$ perl -d

Loading DB routines from perl5db.pl version 1.25
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

$str = "foo2222.html";
main::(-:1):    $str = "foo2222.html";
  DB<1> print "hello" if not $str =~ /([0-9]*)\.html/; print $1

hello
  DB<2> print "hello" if not $str =~ /([0-9]*)\.html/; print $1

hello


This is about the third time you've posted results without complete
code?  WHY?  Why are you making it so difficult to verify what you're
seeing?  Why can't you post a *complete* program, including data, that
illustrates the supposed bugs?

Paul Lalli



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

Date: Fri, 25 Aug 2006 15:50:05 +0100
From: Henry Law <news@lawshouse.org>
Subject: Re: regular expression variables under debugger
Message-Id: <1156517403.19827.0@damia.uk.clara.net>

wlcna wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message 
> news:slrneesp5j.mcs.tadmc@magna.augustmail.com...
>> Then the problem is probably in the part that made you use
>> the "essentially" qualifier...   :-)
> 
> :)  Of course, but not really in this case.  The offending code is 
> essentially IDENTICAL to what I posted.  But the "inessential" that is 
> the key is *I think* WHERE THE INPUT IS COMING FROM, see my other post. 

Oh for heaven's sake, man: post some runnable code that, when _that_ 
_exact_ _code_ is run, shows your problem in your environment.  If 
someone else runs it and gets the problem then they can help debug it; 
if they don't then you have an environment or a procedural problem and 
we'll help debug it.

-- 

Henry Law       <><     Manchester, England


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

Date: Fri, 25 Aug 2006 10:20:18 -0400
From: "Binod Pant" <Bpant@mathworks.com>
Subject: Siimple solution to "Access denied" problem with WinXP-apache-perl-cgi
Message-Id: <ecn0v2$1qn$2@fred.mathworks.com>

I haave setup a webserver using the Netserver application. It is a bundle of 
Apache, MySQL, PHP,Perl all in one.

I tried to run a CGI script such as this :

#!D:\Applications\NetServer\bin\stable\perl\
print "Content-type: text/html\n\n";
print "<h2>Hello, World!</h2>\n";
print "<table border=1><tr><td>Hello, World!</td></tr></table></h2>\n";

I kept getting "Access denied Could not spawn child process" error in Apache 
log.
I solved this by simply changing the path to perl and replacing it with the 
full path to the perl executable
i.e.,
#!D:\Applications\NetServer\bin\stable\perl\bin\perl.exe

That was it! hope this will help someone who has a similar problem 




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

Date: 25 Aug 2006 14:47:50 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: Siimple solution to "Access denied" problem with WinXP-apache-perl-cgi
Message-Id: <slrneeu3cm.kj9.glennj@smeagol.ncf.ca>

At 2006-08-25 10:20AM, "Binod Pant" wrote:
>  I haave setup a webserver using the Netserver application. It is a bundle of 
>  Apache, MySQL, PHP,Perl all in one.
>  
>  I tried to run a CGI script such as this :
>  
>  #!D:\Applications\NetServer\bin\stable\perl\
[...]
>  
>  I kept getting "Access denied Could not spawn child process" error in Apache 
>  log.
>  I solved this by simply changing the path to perl and replacing it with the 
>  full path to the perl executable
>  i.e.,
>  #!D:\Applications\NetServer\bin\stable\perl\bin\perl.exe
>  
>  That was it! hope this will help someone who has a similar problem 

I wonder if:
    #! perl
would have sufficed.

-- 
Glenn Jackman
Ulterior Designer


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

Date: Fri, 25 Aug 2006 14:22:33 GMT
From: zentara <zentara@highstream.net>
Subject: Re: Win32::GUI and Scrolling Text
Message-Id: <f71ue2pulfr6d3ukfr539053q2i5l33gq7@4ax.com>

On 24 Aug 2006 12:45:51 -0700, "jackbarnett@gmail.com"
<jackbarnett@gmail.com> wrote:

>
>thanks.  Yea I have the part that tails the file working (works in
>console window) and updates on new line... I have a GUI with a text
>box... but I can't get the text box to scroll... (I don't know how to
>update the box).
>
>any ideas?

Usually you need to tell the text widget to "see" or "yview" the 'end'.
You may also need to update the widget manually , it depends,
and I don't use win32 so I can't say for sure.

If you absolutely insist on using the win32gui modules, you might ask
this on http://perlmonks.org. There are a few monks there familiar with
win32gui.

If you are willing to switch to Tk, here is a simple set of scripts to
test. (Tested on linux)

########   the actual file tail display of z.txt  #####################
#!/usr/bin/perl
use strict;
use Tk;
use IO::Handle;

my $H=IO::Handle->new;
open($H,"tail -f -n 50 z.txt |") or die $!;
                   
my $main = MainWindow->new;
                   
my $t = $main-> Scrolled('Text',
              -wrap=>'none')->pack(-expand=>1);
                   
$main->fileevent(\*$H,'readable',[\&fill,$t]);
                   
MainLoop;
                   
sub fill {
  my ($w) = @_;
  my $text;
  my $text =<$H>;
  $w->insert('end',$text);
  $w->yview('end');
     #$w->see('end');  #same thing
     #$w->update;  #may be needed

}
__END__
#################################################


#######  A script to pump z.txt for testing ################

#!/usr/bin/perl
use warnings;
use strict;

$| = 1;

open (ZH, "> z.txt") or die "$_\n";

# autoflush ZH 
my $ofh = select(ZH);
$|   = 1;
select($ofh);

while(1){
 print ZH time."\n";
 print '#'; #action indicator 
 select(undef,undef,undef,.1);
}
__END__




-- 
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html


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

Date: Fri, 25 Aug 2006 15:41:25 +0100
From: "hbm" <henry_mcguinnessDELETE@THISyahoo.co.uk>
Subject: Re: Win32::GUI and Scrolling Text
Message-Id: <ecn26s$97a$1@frank-exchange-of-views.oucs.ox.ac.uk>

<jackbarnett@gmail.com> wrote in message 
news:1156445304.131365.78040@m73g2000cwd.googlegroups.com...

> Anyone have an example of a perl script that use Win32::GUI for
> scrolling text ?
>

What I think you're saying can be done with a textfield and its Append 
method (inside a DoEvents loop). Add:

-vscroll => 1,
-multiline =>1,

to your textfield constructor.  Then use a DoEvents loop like:

while(Win32::GUI::DoEvents() != -1) {
    if ( [...whatever happens] ) {
            $Window->Textfield1->Append($wedwd)
    }


Haven't thought this through but that might be a start, hope it helps
Henry




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

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


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