RE: Mechanize

From: Paul Kraus (pkraus_at_pelsupply.com)
Date: 11/14/03


To: "'Kevin Old'" <kold@kold.homelinux.com>
Date: Fri, 14 Nov 2003 10:08:07 -0500

Ok here is a sample of the data. Its very confidential so I am trying to
be selective on what I send. I am just including the header information
since its not going to be dangerous to send :)

 Basically a table exists on this page that has merchant transaction
info like this...

The only lines on these pages that have dat that I need all have
class="statement" and align="center" in the td tag...

Thanks for all your help.
Paul

<tr>
<tr>
<td class="statement" valign="top"
align="center">Settlement<br>Date</td>
<td class="statement" valign="top" align="center">Terminal ID</td>
<td class="statement" valign="top" align="center">Batch
Control<br>Number</td>
<td class="statement" valign="top" align="right" >Net<br>Amount</td>
<td class="statement" valign="top" align="center">Items</td>
</tr>

-----Original Message-----
From: Kevin Old [mailto:kold@kold.homelinux.com]
Sent: Friday, November 14, 2003 9:47 AM
To: pkraus@pelsupply.com
Cc: 'Beginners Perl'
Subject: RE: Mechanize

On Fri, 2003-11-14 at 09:36, Paul Kraus wrote:
> Yes I have read the POD in fact I have them printed out in front of
> me. Unless I am missing something and I doubt I am since I have read
> it like 4 times. All you can really do using mechanize is parse the
> content for links and forms.
>
> I need to parse out data from the page that is neither a link or form.
>
> I need to read the content a line at a time and using a regex find the

> content I want to isolate.
>
> Your second link all though helpful also seems to be only dealing with

> the above mentioned conditions.
>
> Sorry if this seems trivial. I am not new to perl but $a-content() is
> not working the way I would expect it to behave.
>
> The regex I would use is /class="statement" align="center"/

Paul,

I'd love to help, but don't have anything to test against. Can you send
me the results from $a->content so that I can see what you're getting?

Couldn't you just save the results from $a->content to a scalar, then
use a regex on it?

my $results = $a->content();
$results =~ m/what I'm looking for/;

Also, from the POD for WWW::Mechanize:

Mech is well suited for use in testing web applications. If you use one
of the Test::*, like Test::HTML::Lint modules, you can check the fetched
content and use that as input to a test call.

use Test::More;
    like( $a->content(), qr/$expected/, "Got expected content" );

Hope this helps,
Kevin

-- 
Kevin Old <kold@kold.homelinux.com>


Relevant Pages

  • RE: Mechanize
    ... On Fri, 2003-11-14 at 09:36, Paul Kraus wrote: ... > Yes I have read the POD in fact I have them printed out in front of me. ... > I need to parse out data from the page that is neither a link or form. ... > I need to read the content a line at a time and using a regex find the ...
    (perl.beginners)
  • Parsing and regex
    ... I am writing a program to parse a Cisco ASA log file. ... I have created a database that contains the 6 ... digit rule number which is unique, a severity level, the full ASA rule ... regex "rule" in the database. ...
    (comp.lang.perl.misc)
  • Re: sscanf in c#
    ... |> | With sscanf, I believe you can do something like: ... |> I prefer using TryParse over RegEx, just a matter of taste, and quite ... some minimal code arround the individual type's Parse and TryParse ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: sscanf in c#
    ... |> | With sscanf, I believe you can do something like: ... |> I prefer using TryParse over RegEx, just a matter of taste, and quite ... some minimal code arround the individual type's Parse and TryParse ...
    (microsoft.public.dotnet.languages.csharp)
  • RE: Mechanize
    ... Yes I have read the POD in fact I have them printed out in front of me. ... Unless I am missing something and I doubt I am since I have read it like ... I need to parse out data from the page that is neither a link or form. ... Paul Kraus ...
    (perl.beginners)