[24058] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6255 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 13 21:05:42 2004

Date: Sat, 13 Mar 2004 18:05:07 -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           Sat, 13 Mar 2004     Volume: 10 Number: 6255

Today's topics:
    Re: *perl* regexps -- a library other applications can  (David Combs)
    Re: bit string parsing and mapping question (Anno Siegel)
    Re: C expressions in Perl (Anno Siegel)
    Re: C expressions in Perl <tassilo.parseval@rwth-aachen.de>
    Re: File Creation From Form <noreply@gunnar.cc>
    Re: File Creation From Form <flavell@ph.gla.ac.uk>
    Re: File Creation From Form <noreply@gunnar.cc>
    Re: formmail problem (James)
    Re: formmail problem <noreply@gunnar.cc>
    Re: help with HTTP::Daemon <wherrera@lynxview.com>
        How to remove lines containing "continuation" operator (werlax)
    Re: how to reset a variable <tore@aursand.no>
    Re: how to reset a variable <tadmc@augustmail.com>
    Re: how to reset a variable <6tc1@qlinkDOTqueensu.ca>
    Re: how to reset a variable <noreply@gunnar.cc>
    Re: how to reset a variable <tore@aursand.no>
    Re: oracle socket creation <kevin@vaildc.net>
    Re: oracle socket creation <vetro@online.no>
    Re: Perl 5.8.3 "make test" fails the "wait" test (Anno Siegel)
        reading and writing text based on cursor position. (supportgeek)
        recognizing hidden INPUT TYPE within HTML (Martin L.)
    Re: recognizing hidden INPUT TYPE within HTML <roel-perl@st2x.net>
    Re: recognizing hidden INPUT TYPE within HTML <wherrera@lynxview.com>
    Re: recognizing hidden INPUT TYPE within HTML <nospam@bigpond.com>
    Re: recognizing hidden INPUT TYPE within HTML <flavell@ph.gla.ac.uk>
    Re: recognizing hidden INPUT TYPE within HTML <tore@aursand.no>
    Re: Text editor implemented in Perl <sgovindachar@yahoo.com>
    Re: Text editor implemented in Perl <tassilo.parseval@rwth-aachen.de>
    Re: using an assoc. array as a 'set' <bik.mido@tiscalinet.it>
    Re: variable initialization question ctcgag@hotmail.com
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 13 Mar 2004 23:41:10 +0000 (UTC)
From: dkcombs@panix.com (David Combs)
Subject: Re: *perl* regexps -- a library other applications can use?
Message-Id: <c3066m$5a7$1@reader1.panix.com>


Thanks, all, for the info, *and* url too!

David



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

Date: 13 Mar 2004 21:01:30 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: bit string parsing and mapping question
Message-Id: <c2vsra$f4a$1@mamenchi.zrz.TU-Berlin.DE>

David K. Wall <dwall@fastmail.fm> wrote in comp.lang.perl.misc:
> Paul <Paul.Sue@telus.com> wrote:
> 
> > Let's say a command outputs results like this:
> > 
> > code1 = 1
> > code2 = 0
> > code3 = 0
> > code4 = 0
> > code5 = 1
> > code6 = 0
> > code7 = 1
> > code8 = 0
> > 
> > (always 8 lines returned; values are 0 or 1)
> > 
> > I want a script to read this in and then map all the 1's to a
> > user-friendly code.
> > 
> > E.g.:
> > @desc = qw(lowMem badHandle badPasswd noSpace badArg invalidInput
> > badSyntax outOfRange);
> > 
> > So for the above command output, it would output something like:
> > 
> > Errors: lowMem badArg badSyntax
> 
> Cribbing a bit from previous replies, how about this?
> 
> my $com_output = <<END;
> code1 = 1
> code2 = 0
> code3 = 0
> code4 = 0
> code5 = 1
> code6 = 0
> code7 = 1
> code8 = 0
> END
> 
> # make sure the command was successful....
> 
> my %hash = split /\n|\s+=\s+/, $com_output;
> my @desc = qw(lowMem badHandle    badPasswd noSpace 
>               badArg invalidInput badSyntax outOfRange);
> print join ', ', @desc[ grep { $hash{'code'.($_+1)} } 0..$#desc ];

I think that an array isn't the best data structure for the descriptors.
The index starts at 1, and that means hassle.  I'd build a hash from the
keys as they come.  Then select the lines we need, extract the keys and
print using a hash slice, like you did.  An intermediate variable
doesn't hurt:

    my %desc;
    @desc{ 'code1' .. 'code8'} = qw(
        lowMem badHandle badPasswd noSpace 
        badArg invalidInput badSyntax outOfRange
    );

    my @sel = map /(code\d)/, grep /1$/, split /\n/, $com_output;
    print join( ', ', @desc{ @sel}), "\n";

Anno


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

Date: 13 Mar 2004 20:17:45 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: C expressions in Perl
Message-Id: <c2vq99$dgu$1@mamenchi.zrz.TU-Berlin.DE>

Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:

[ use constant FALSE => ...]

> No, it's the same problem with undef. What you could probably do (but I
> haven't thoroughly tested) is:
> 
>     use constant FALSE => ();
> 
> This will evaluate to false in list context.

Good enough, as far as it goes.  But then someone will expect "$x eq
FALSE" to be equivalent to "not $x", and fail.  I think you could
pull that off with a sufficiently overloaded object, but whatever for?

Being able to use everything as a boolean directly is one of the
strong sides of Perl.  "Enhancing" the concept by the introduction
of "FALSE" and (forbid) "TRUE" constants is a bad idea.

Anno


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

Date: 13 Mar 2004 23:26:06 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: C expressions in Perl
Message-Id: <c305ae$l4e$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Anno Siegel:

> Tassilo v. Parseval <tassilo.parseval@post.rwth-aachen.de> wrote in comp.lang.perl.misc:
> 
> [ use constant FALSE => ...]
> 
>> No, it's the same problem with undef. What you could probably do (but I
>> haven't thoroughly tested) is:
>> 
>>     use constant FALSE => ();
>> 
>> This will evaluate to false in list context.
> 
> Good enough, as far as it goes.  But then someone will expect "$x eq
> FALSE" to be equivalent to "not $x", and fail.  I think you could
> pull that off with a sufficiently overloaded object, but whatever for?

Very right. You will have a very hard time using one of the comparison
operators along with the right flavour of 'false' as there are quite a
few of them (the empty list, undef, 0, "", "0").

> Being able to use everything as a boolean directly is one of the
> strong sides of Perl.  "Enhancing" the concept by the introduction
> of "FALSE" and (forbid) "TRUE" constants is a bad idea.

This idea of defining constants can only come from someone having a
different language-background, methinks. It is quite common to do such
things in C although C also knows about implicit falseness (0 and NULL).
But those are only two items (and technically they are even identical).
Furthermore, no distinction between 'eq' and '==' that could further
blur things exists.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sat, 13 Mar 2004 22:47:32 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: File Creation From Form
Message-Id: <c2vvh8$21dgvc$1@ID-184292.news.uni-berlin.de>

Alan J. Flavell wrote:
> On Sat, 13 Mar 2004, Gunnar Hjalmarsson wrote:
>> but that we are talking about iso-8859-1 characters.
> 
> He's not presently setting charset=iso-8859-1 on his content-type 
> header; if the browser doesn't know what encoding (charset) to use,
> then it's going to take whatever default the user has set it to.

I don't follow you now, Alan. I thought that what matters for the
treatment of submitted form data was the charset of the form or of the
page which includes the form, and we haven't seen any of those, have
we? I thought that the fact that OP's posted script didn't include
charset when printing the content-type header only affected what's
printed to STDOUT by that script, in this case the string "Done".

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



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

Date: Sat, 13 Mar 2004 22:00:19 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: File Creation From Form
Message-Id: <Pine.LNX.4.53.0403132154330.27560@ppepc56.ph.gla.ac.uk>

On Sat, 13 Mar 2004, Gunnar Hjalmarsson wrote:

> Alan J. Flavell wrote:
> > He's not presently setting charset=iso-8859-1 on his content-type
> > header; if the browser doesn't know what encoding (charset) to use,
> > then it's going to take whatever default the user has set it to.
>
> I don't follow you now, Alan. I thought that what matters for the
> treatment of submitted form data was the charset of the form or of the
> page which includes the form,

Yes, you're right...

> and we haven't seen any of those, have we?

Correct.  I'm afraid I based my comment on the assumption that we'd
only been shown a minimal sample of the script to demonstrate the
issue.  And filled in some blanks without stating my assumptions.
Sorry.

> I thought that the fact that OP's posted script didn't include
> charset when printing the content-type header only affected what's
> printed to STDOUT by that script,

Indeed it does, and a typical response to a script getting no (or not
enough) information would be to (re)write the form.  But as you
rightly say, that wasn't shown in the example.

To the O.P: whichever way you use to create the page which contains
the form (say, by means of another part of the script, or by means of
a static HTML page), it needs to have an appropriate character
encoding (charset=) defined, or else you'll have extra difficulties to
cope with.

Does that go some way to set the story straight?


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

Date: Sun, 14 Mar 2004 00:22:13 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: File Creation From Form
Message-Id: <c30532$21dvu6$1@ID-184292.news.uni-berlin.de>

Alan J. Flavell wrote:
> I'm afraid I based my comment on the assumption that we'd only been
> shown a minimal sample of the script to demonstrate the issue.  And
> filled in some blanks without stating my assumptions.

<snip>

> To the O.P: whichever way you use to create the page which contains
> the form (say, by means of another part of the script, or by means
> of a static HTML page), it needs to have an appropriate character
> encoding (charset=) defined, or else you'll have extra difficulties
> to cope with.
> 
> Does that go some way to set the story straight?

Indeed it does. Btw, indirectly I filled in some blanks, too. While I
was optimistic in my assumptions, you were rather assuming worst case.
Only OP can tell who was 'right'. ;-)

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



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

Date: 13 Mar 2004 15:49:39 -0800
From: jamersoniiv@yahoo.co.uk (James)
Subject: Re: formmail problem
Message-Id: <110564f1.0403131549.136694f1@posting.google.com>

Hi, yep you're right it is the original formmail program, I just took
out the block of comments to make it smaller for this newsgroup, but
other than that it's pretty much as the original was, at least the one
I downloaded a couple of years ago anyway.
I'll go check out that cgi url you posted though and see if I get
anywhere with that.
The error I was getting was:

"Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, websupport@blahblah.net and
inform them of the time the error occurred, and anything you might
have done that may have caused the error.

More information about this error may be available in the server error
log."

But the admin aren't available right now so I was seeing if it was
something I could fix myself, or whether it was a problem at their
end.

Thankyou all for your help by the way, please feel free to help
somemore if you have any other ideas, it would be much appreciated.
:-)

James


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

Date: Sun, 14 Mar 2004 01:30:51 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: formmail problem
Message-Id: <c3093v$21bnhr$1@ID-184292.news.uni-berlin.de>

James wrote:
> The error I was getting was:
> 
> "Internal Server Error

<snip>

> please feel free to help somemore if you have any other ideas, it
> would be much appreciated. :-)

You should familiarize yourself with perlfaq9, which includes some
references to useful documents for troubleshooting CGI programs:

     http://www.perldoc.com/perl5.8.0/pod/perlfaq9.html

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



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

Date: Sat, 13 Mar 2004 13:03:00 -0700
From: Bill <wherrera@lynxview.com>
To: mike <m.amedeo@NOSPAMatt.net>
Subject: Re: help with HTTP::Daemon
Message-Id: <405368F4.4020106@lynxview.com>

mike wrote:
> If someone could point me on how to accomplish this. I do not want to 
> run an entire webserver to give me information about a system. I written 
> cgi scripts that I run under apache that will show filesystems, 
> processes etc. But I was trying to write a perl script use HTTP::Daemon 
> that will give me the output of a command say df -k, ps -ef on a 
> browser. I tried many different thing with the script below but my 
> browser connects but nothing is displayed. Can anyone provide some advice.
> 
> Thanks
> Mike
> 
> #!/usr/bin/perl
> use HTTP::Daemon;
> my $http = HTTP::Daemon->new ( LocalPort => 8200);
> print $http->url;
> while (my $connect = $http->accept) {
> $connect->send_response(`df -k`);
> 
>          }
>          $connect->close;
>          undef $connect;
> 

->send_response needs to construct a HTTP::Response object. The call 
needs the arguments to do that. Read docs on HTTP::*.



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

Date: 13 Mar 2004 16:46:27 -0800
From: werlax@hotmail.com (werlax)
Subject: How to remove lines containing "continuation" operator
Message-Id: <744cd116.0403131646.21916ffa@posting.google.com>

I am looking for a way to process a file containing C code and remove
specific lines.  These lines can be more than one line long and,
therefore, may have the \ operator at the end of the line.  Currently
I am setting a variable when the \ is found and removing any lines
that follow until no more \ are found.  It seems to me that I should
be able to use a more simple method but I don't know how I could do
this.  I was hoping to come up with a simple -i -e method.  Is this
possible?

An example line.  All lines to be removed begin with the "#pragma"
statement.

#pragma export(ConfigurationRepository::write\
   (char** ppsBuffer,const string& strTSTAMP_TRANS,\
   const short iUNIQUENESS_KEY))

I hope I provided enough information.
Thanks for any help!


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

Date: Sat, 13 Mar 2004 20:27:42 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: how to reset a variable
Message-Id: <pan.2004.03.13.19.24.59.536565@aursand.no>

On Sat, 13 Mar 2004 08:41:47 -0800, Novice wrote:
> This code does not exist in any program of mine.  This code is an
> example of a small subset of the logic that exists in my code.

What is actually the _point_ of posting "false" code if you want help?

> What I should have written in my original post is:
> 
> Code excerpt:
> #------------------------
> for ($iterator = 0; $iterator <= $#lines; $iterator++)
> {
>   $line = @lines[$iterator];
>   $_ = $line;
> 
>   $someScalarVar;
> 
>   if (/^someTextImParsingOnANewLine/)
>   {
>     $someScalarVar = $line;
>     #after assigning - parse the text contained in somScalarVar
>   }
>   #additional conditional else if's that test for other regular
> expressions
> 
>   #process contents of someScalarVar if it contains any data/text 
> 
> }
> #------------------------

This code is still extremely C'ish.  Better off writing it like this;

  foreach ( @lines ) {
      next unless ( /^someTextImParsingOnANewLine/ );
      # Do whatever you want with $_
  }

Eventuelly, if you feel more comfortable with properly named variables;

  foreach my $line ( @lines ) {
      next unless ( $line =~ /^someTextImParsingOnANewLine/ );
      # Do whatever you want with $line
  }


-- 
Tore Aursand <tore@aursand.no>
"Life is pleasant. Death is peaceful. It's the transition that's
 troublesome." -- Isaac Asimov


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

Date: Sat, 13 Mar 2004 12:47:14 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: how to reset a variable
Message-Id: <slrnc56lpi.2m6.tadmc@magna.augustmail.com>

Novice <6tc1@qlink.queensu.ca> wrote:

>   $line = @lines[$iterator];


You should always enable warnings when developing Perl code.

   use warnings;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 13 Mar 2004 17:46:03 -0500
From: "Novice" <6tc1@qlinkDOTqueensu.ca>
Subject: Re: how to reset a variable
Message-Id: <c302v9$iis$1@knot.queensu.ca>


"Tore Aursand" <tore@aursand.no> wrote in message
news:pan.2004.03.13.19.24.59.536565@aursand.no...
> On Sat, 13 Mar 2004 08:41:47 -0800, Novice wrote:
> > This code does not exist in any program of mine.  This code is an
> > example of a small subset of the logic that exists in my code.
>
> What is actually the _point_ of posting "false" code if you want help?

The actual/true code is over 2000 lines - I only needed to understand why
the logic was failing (i.e. why the variable wasn't being reset) and now I
do.  I didn't need/want the users of this newsgroup to read through my
entire program or try to understand the strange naming conventions I used -
so I extracted the "important" details, renamed the variables and kept the
logic.

Thanks,
Novice

[snip]








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

Date: Sun, 14 Mar 2004 00:07:46 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: how to reset a variable
Message-Id: <c3047t$21dutq$1@ID-184292.news.uni-berlin.de>

Tore Aursand wrote:
> On Sat, 13 Mar 2004 08:41:47 -0800, Novice wrote:
>> This code does not exist in any program of mine.  This code is an
>> example of a small subset of the logic that exists in my code.
> 
> What is actually the _point_ of posting "false" code if you want
> help?

Actually, in the Posting Guidelines posters are advised to post
"false" code:

"First make a short (less than 20-30 lines) and complete program that
illustrates the problem you are having. People should be able to run
your program by copy/pasting the code from your article. (You will
find that doing this step very often reveals your problem directly.
Leading to an answer much more quickly and reliably than posting to
Usenet.)"

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



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

Date: Sun, 14 Mar 2004 01:07:20 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: how to reset a variable
Message-Id: <pan.2004.03.14.00.02.58.913219@aursand.no>

On Sun, 14 Mar 2004 00:07:46 +0100, Gunnar Hjalmarsson wrote:
>> What is actually the _point_ of posting "false" code if you want help?

> Actually, in the Posting Guidelines posters are advised to post "false"
> code:
> [...]

Fair enough, but I was referring to the following statement:

  "This code does not exist in any program of mine.  This code is an
   example of a small subset of the logic that exists in my code."

Do I misunderstand something here?  I understand very well that one
shouldn't post thousands of lines of code, but instead try to post what's
relevant, but the "small subset of the logic" confused me.


-- 
Tore Aursand <tore@aursand.no>
"Writing is a lot like sex. At first you do it because you like it.
 Then you find yourself doing it for a few close friends and people you
 like. But if you're any good at all, you end up doing it for money."
 -- Unknown


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

Date: Sat, 13 Mar 2004 20:23:20 GMT
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: Re: oracle socket creation
Message-Id: <kevin-FD36A0.15231013032004@news.verizon.net>

In article <m34qsslkqn.fsf@quimby.dirtyhack.org>,
 Vetle Roeim <vetro@online.no> wrote:

> * Perl GuRu2b
> > anyone ever used perl to monitor an Oracle database?
> > Goal:
> > send select statement to oracle DB every 5 minutes or so to verify that it
> > is up and running.  Capture output and translate to pass/fail on web page
> >
> > I am thinking 
> > NET::Telnet
> > but I don't know the connect string to pass to the DB.
> >
> > I could open a socket and connect directly but once again I don't know
> > what to send.
> > Any help would be greatly appreciated.
> 
>   There are Perl modules you can use for connecting to an Oracle
>   database. Check out DBI, <URL:http://dbi.perl.org>, which has a
>   driver for Oracle.

And DBI has a "ping" method to tell if the database is alive, but I 
don't know if this is implemented in the Oracle driver.  You're still 
going to need a connection string for the database, though.
-- 
Found Poetry (_Science News_, 14-Jun-2003): oldest _homo sapiens_ find
+-----------------------------------------+ ocean eddies' far-flung effects;
|  Kevin Michael Vail <kevin@vaildc.net>  | superior threads spun
+-----------------------------------------+ the pox from prairie dogs.


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

Date: Sat, 13 Mar 2004 22:50:03 +0100
From: Vetle Roeim <vetro@online.no>
Subject: Re: oracle socket creation
Message-Id: <m3ptbga038.fsf@quimby.dirtyhack.org>

* Kevin Michael Vail

>> > I could open a socket and connect directly but once again I don't know
>> > what to send.
>> > Any help would be greatly appreciated.
>> 
>>   There are Perl modules you can use for connecting to an Oracle
>>   database. Check out DBI, <URL:http://dbi.perl.org>, which has a
>>   driver for Oracle.
>
> And DBI has a "ping" method to tell if the database is alive, but I 
> don't know if this is implemented in the Oracle driver.

  From the original posting:

    >> > Goal:
    >> > send select statement to oracle DB every 5 minutes or so to
    >> > verify that it is up and running.  Capture output and
    >> > translate to pass/fail on web page

  That's how he want's to monitor it. There's no need for some sort of
  "ping" functionality.


> You're still going to need a connection string for the database,
> though.

  Well... Guess where you can find information about that.


-- 
#!/usr/bin/vr


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

Date: 13 Mar 2004 19:34:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Perl 5.8.3 "make test" fails the "wait" test
Message-Id: <c2vnoh$bob$1@mamenchi.zrz.TU-Berlin.DE>

Tom Williams <tomdkat@comcast.net> wrote in comp.lang.perl.misc:
> I'm building Perl 5.8.3 on a RedHat 9 Linux system using gcc-3.3.3. 
> The system has glibc-2.3.2 installed.  I've got Perl 5.8.2
> (multi-threaded) installed and it works fine. I also use
> mod_perl-1.99_13 with the Perl 5.8.2 installation (connected to Apache
> 2.0.48) and it all works fine (save some mod_perl quirks).
> 
> I'm trying to upgrade to Perl 5.8.3 and the build runs smoothly until
> I run "make test" and only ONE test fails and that's the "wait" test:

[test results snipped]

> So, given I'm building a multi-threaded perl-5.8.3 does the failure of
> the above test mean I really can't use the perl "bundle" I just built?
>  My intent is to upgrade Perl on the system to 5.8.3 (from 5.8.2) and
> then build mod_perl-1.99_13 using Perl 5.8.3 (multi-threaded) and then
> use the new mod_perl in my Apache 2.0.48 (using the worker MPM)
> server.
> 
> Is this Perl 5.8.3 "safe" to use, given the test failure above?

That can't be answered until the individual test and the reason for
its failure are known, perhaps not even then.  I wouldn't trust it
for production before then.

Anno


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

Date: 13 Mar 2004 14:35:46 -0800
From: molivier@caregroup.harvard.edu (supportgeek)
Subject: reading and writing text based on cursor position.
Message-Id: <da063e5d.0403131435.6436ee4a@posting.google.com>

Greetings.

Would anyone know the right direction to point me on this one?

I need to read text from a Windows Application based on cursor
position.
And enter text based on what is read.

Example:(the interface of the windows application would look something
like this.)

-----------------------------------
Windows Application               X
-----------------------------------
Name:
Address:
City:
State:
Zip:
-----------------------------------

I need to scan the application for address - and put in my address,
etc...
Right now I am using sendkeys (win32::GuiTest) but it really isn't
cutting it)

The only part I need help on in this is getting the location of where
it says address, or whatever field is the case.

I was thinking it might be possible to somehow read to the left based
on cursor position. If anyone could point me in the right direction I
would appreciate it.

Thanks in Advance.

Mike


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

Date: 13 Mar 2004 11:14:47 -0800
From: mjpliv@eastlink.ca (Martin L.)
Subject: recognizing hidden INPUT TYPE within HTML
Message-Id: <36fd063b.0403131114.2aea00c6@posting.google.com>

If I open FILEHANDLE and read in an HTML file, short of a complex
search pattern, how do I extract the <INPUT TYPE = "hidden"> data into
the script? When the HTML files were created there were several of
these tags embedded in to code for future use.

Martin L.


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

Date: 13 Mar 2004 19:55:16 GMT
From: Roel van der Steen <roel-perl@st2x.net>
Subject: Re: recognizing hidden INPUT TYPE within HTML
Message-Id: <slrnc56pqs.l25.roel-perl@localhost.localdomain>

On Sat, 13 Mar 2004 at 19:14 GMT, Martin L. wrote:
> how do I extract the <INPUT TYPE = "hidden"> data into
> the script?

What code do you have so far? What do you want to do with the
data you "extract into the script"? If you want help, please
try to describe exactly what your problem is.


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

Date: Sat, 13 Mar 2004 13:50:46 -0700
From: Bill <wherrera@lynxview.com>
Subject: Re: recognizing hidden INPUT TYPE within HTML
Message-Id: <1MCdnTmqIdG26c7dRVn-tA@adelphia.com>

Martin L. wrote:
> If I open FILEHANDLE and read in an HTML file, short of a complex
> search pattern, how do I extract the <INPUT TYPE = "hidden"> data into
> the script? When the HTML files were created there were several of
> these tags embedded in to code for future use.

rtfm:

http://search.cpan.org/~sburke/HTML-Tree-3.18/lib/HTML/Tree/Scanning.pod




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

Date: Sun, 14 Mar 2004 09:31:10 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: recognizing hidden INPUT TYPE within HTML
Message-Id: <1517996.nq9TsnBcTV@GMT-hosting-and-pickle-farming>

Martin L. wrote:

> If I open FILEHANDLE and read in an HTML file, short of a complex
> search pattern, how do I extract the <INPUT TYPE = "hidden"> data into
> the script? When the HTML files were created there were several of
> these tags embedded in to code for future use.
> 
> Martin L.

Whats complex about a regular expression that serches for "Input type"?

gtoomey


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

Date: Sat, 13 Mar 2004 23:43:53 +0000
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: recognizing hidden INPUT TYPE within HTML
Message-Id: <Pine.LNX.4.53.0403132338490.27956@ppepc56.ph.gla.ac.uk>

On Sun, 14 Mar 2004, Gregory Toomey wrote:

> Whats complex about a regular expression that serches for "Input type"?

All the usual things, if it's to deal correctly with things like

<!-- <input type="hidden"  ...>  -->

and <img alt='<input type="hidden" ...>' ...>

and <input id="foo" name="bar" value=">" type="hidden">

and so on.

So: except perhaps in some very simple and tightly-controlled cases,
the way to parse HTML is with an HTML parser, not with a regex.

It's not the first time that's been said here, either.


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

Date: Sun, 14 Mar 2004 01:07:21 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: recognizing hidden INPUT TYPE within HTML
Message-Id: <pan.2004.03.14.00.06.17.492930@aursand.no>

On Sun, 14 Mar 2004 09:31:10 +1000, Gregory Toomey wrote:
>> If I open FILEHANDLE and read in an HTML file, short of a complex
>> search pattern, how do I extract the <INPUT TYPE = "hidden"> data into
>> the script? When the HTML files were created there were several of
>> these tags embedded in to code for future use.

> Whats complex about a regular expression that serches for "Input type"?

 ...because that regular expression would need to parse HTML, which is way
beyond rocket science.  NASA go home.

Use a HTML parser for this - as someone already have pointed out - or try
to imagine parsing the following HTML using a "non-complex regular
expression";

  <!-- Commenting is > than life itself! -->
  <!-- <input type="hidden" name="not_me" value="some" /> -->
  <input type="hidden" name="but_me" value"more_>_than" />

Surely not perfectly valid HTML, but - then again - how man web sites
conforms to the standards?


-- 
Tore Aursand <tore@aursand.no>
"Fighting terrorism is like being a goalkeeper. You can make a hundred
 brilliant saves but the only shot that people remember is the one that
 gets past you." -- Paul Wilkinson


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

Date: Sat, 13 Mar 2004 20:27:50 GMT
From: "Suresh Govindachar" <sgovindachar@yahoo.com>
Subject: Re: Text editor implemented in Perl
Message-Id: <a9K4c.8452$_3.104666@typhoon.sonic.net>

"James Taylor"
[regarding editors that can be enhanced with perl]

The following link involves -- in part -- enhancing
Vim with *external* perl scripts:

http://www.sonic.net/~suresh/eui/

Also, for everything Vim (including downloading), see:

http://vim.sourceforge.net

(As far as I know, perl regex cannot be used *directly*
for searches and substitutions even when Vim is compiled
with a perl interpreter;  Vim's built-in perl-interpreter
is for using perl indirectly in functions.  Also, unless
one compiles Vim oneself, the built in version of perl in
the distribution for Windows is 5.6 and one'll need
perl56.dll.)

--Suresh







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

Date: 13 Mar 2004 23:16:19 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Text editor implemented in Perl
Message-Id: <c304o3$k4s$1@nets3.rz.RWTH-Aachen.DE>

Also sprach James Taylor:

> In article <c2qc77$n69$1@nets3.rz.RWTH-Aachen.DE>,
> Tassilo v. Parseval <tassilo.parseval@rwth-aachen.de> wrote:
>> 
>> You can use vim with a Perl interpreter compiled in. This
>> allows both writing vim scripts in Perl as well as using
>> Perl commands to edit the buffer.
> 
> Sounds useful. Where might I be able to download a Linux
> binary to play with?

Your Linux distribution certainly has a binary package. I know that
Debian also has a vim package with an embedded Perl interpreter. I don't
know about other distributions.

On the other hand one can always compile it rather easily by doing

    ./configure --enable-perlinterp

in the unpacked source directory (as obtainable somewhere from
http://www.vim.org).

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


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

Date: Sat, 13 Mar 2004 21:34:19 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: using an assoc. array as a 'set'
Message-Id: <7pr6505q8lftoee1b363inltk8ak5tild8@4ax.com>

On 12 Mar 2004 19:02:48 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>I was envisioning a system that works directly with the objects
>mathematics works with: sets, relations, mappings, groups, what have you.
>Oh, numbers too, I almost forgot those...  Sets and their operations would
>be the only primitives (in hardware).  The mathematical literature is
>full of recipes how to build (almost) any other structure from sets,
>so no wheels have to be invented.  The recipes, however, show utter
>disconcern for efficiency.

<OT but="interesting">
Hehe, you may be interested in giving a peek into
<http://www.dpmms.cam.ac.uk/~ardm/inefff.{dvi,ps}>
</OT>


Michele
-- 
you'll see that it shouldn't be so. AND, the writting as usuall is
fantastic incompetent. To illustrate, i quote:
- Xah Lee trolling on clpmisc,
  "perl bug File::Basename and Perl's nature"


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

Date: 14 Mar 2004 01:14:27 GMT
From: ctcgag@hotmail.com
Subject: Re: variable initialization question
Message-Id: <20040313201427.126$ql@newsreader.com>

Paul Lalli <ittyspam@yahoo.com> wrote:
> On Wed, 10 Mar 2004, Alexander Stremitzer wrote:
>
> > I found that the following statement only initializes the first
> > variable. my ($a,$b,$c) = 0;
> > A way that works is:
> > my ($a,$b,$c) = (0,0,0);
> >
> > Is there a simpler way to initialize all variables with the same value
> > 0 ?
>
> Yes, but before I answer that, you should be asking yourself why you're
> doing that.  Perl variables are undef by default, which is treated as 0
> in numeric context.

Let's say you are running an accumulator.  It is true that you don't
get a warning upon incrementing an undef accumulator.  However, there is no
point in having an accumulator which you don't use elsewhere, and when you
do use it elsewhere you may find that it will emit errors on the boundary
condition that the accumulator was incremented zero times.  That's ugly and
not particularly desirable.

> There's generally no reason to initialize a variable
> to 0.

Unless you like clean programs.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service                        $9.95/Month 30GB


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

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


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