multiple lines / success or failure?!

From: Geoff Cox (geoffacox_at_dontspamblueyonder.co.uk)
Date: 03/31/04


Date: Wed, 31 Mar 2004 06:50:18 GMT

Hello

Re my previous posting on how to capture successive blocks of text
between <p> and </p> where the </p> is not on the first line of the
blocl of text in an html file ....

The only way that I have been able to extract the text and place it in
the correct place in the newly created file has been to edit all the
original html files so that the <p> and the </p> are on the same line,
ie instead of

<p>sjdhjhsjdhjhs
sjdjksjdkksj
jskdjkjs</p>

I have

<p>sjdhjhsjdhjhs sjdjksjdkksj jskdjkjs</p>

This is a failure on my part!

I have not tried HTML::Parser yet as I cannot find any help info to
get me started. All seen so far assume more than I know or understand
on OOP. I am back to where I was once on the use of ODBC when
eventually I found a little help and wrote my own steps 1 to 10 to
implement a simple example of this data base / CGI connectivity...

I am using Active Perl and Windows 98 and have tried to get the text
over multiple lines using

local $/ = "\0d\0a";

but the odd thing is that I have been ablle to get multiple lines of
text from a text version of an sql file with the default $/ value
using

sub intro {

my ($pathhere) = @_;
   open (INN, "d:/keep/sqlfile.txt");
my $lineintro;
# my $lineintro = <INN>;
       while (defined ($lineintro = <INN>)) {
              if ($lineintro =~ /$pathhere','(.*?)'\)\;/) {
               print OUT ("<tr><td>$1 <p> </td>\n");
                                                          }
                                            }
          }

and when I look at this sql text file using a hex editor I can see
that at the end of the block of text is 0D0A which is the same as the
<p> multiple lines </p> block in the html file but there I could not
get the text without breaking the rest of the Perl code...with or
without $/ = "\0d\0a";

Well, I could go on and on but I would like to use the HTML::Parser so
look forward to hearing about some intro type info with sample scripts
on its use! Or any Perl books which do this? Perhaps the latest Perl
O'Reilly books are OK?

Cheers

Geoff



Relevant Pages

  • Re: Sending HTML file as mail from mail command (mail -s )
    ... > textfile as a HTML file as the body of the mail please help me. ... of Perl, it's a little biit confusing to me as to why you're asking us. ... Depending on your platform and version of `mail`, you may be able to add ...
    (perl.beginners)
  • Re: interaction with a module and http tags
    ... the problem you stated had nothing to do with Perl because it isn't Perl that renders your HTML file. ... For what it's worth, I ran your code and allowed it to generate one <head>, two, and even zero. ... I mean that _maybe_ what browser you are using also matters. ...
    (perl.beginners)
  • Re: Shared Acess to a File from perl script
    ... modifies the data in HTML file based on the arguments which are sent. ... I have used a foreach loop to traverse through the contents of the ... The perl script is called from different PC's and ... The '>' mode opens the file for writing and if the file already exists it is truncated to zero size and all previous data is lost and new data is written as if it were a new file. ...
    (perl.beginners)
  • Re: printing css
    ... but I am new to perl and really don't know much about print ... Does the above HTML launch the image if you copy and paste it into an ... the html file on it's own shows the image,(obviously after removing the ... I did place the pl file in the cgi-bin directory and chmodded it to 755, ...
    (comp.lang.perl.misc)
  • Re: printing css
    ... but I am new to perl and really don't know much about ... your mistake is in the HTML and has nothing ... the html file on it's own shows the image,(obviously after removing ... Do you use an absolute or a relative path to your image? ...
    (comp.lang.perl.misc)