Perlfect Solutions
 

[Perlfect-search] BUG: get_* and non-HTML files

Daniel Naber daniel.naber@t-online.de
Fri, 26 Oct 2001 21:07:30 +0200
--------------Boundary-00=_IGUTP8PDFWY1PHLKQPGM
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

On Thursday 25 October 2001 07:28, you wrote:

> In get_cleaned_body(), you have the following:
>
> =A0 my ($cleaned) =3D (${$buffer} =3D~ m/<BODY.*?>(.*)<\/BODY>/is);
> =A0 $cleaned =3D ${$buffer} if( ! $cleaned ); =A0 =A0 =A0 # PDF files d=
on't have a
> <body>
>
> How can you assume that a PDF file will not have the text matched by
> that regex? =A0You can't.

Can you try this patch? I cannot test it, as I cannot produce any PDFs=20
like that (any of my PDFs don't work with pdftotext).

Regards
 Daniel

--=20
http://www.danielnaber.de

--------------Boundary-00=_IGUTP8PDFWY1PHLKQPGM
Content-Type: text/x-diff;
  charset="iso-8859-1";
  name="perlfect_pdf_body.diff"
Content-Disposition: attachment; filename="perlfect_pdf_body.diff"
Content-Transfer-Encoding: base64

SW5kZXg6IGluZGV4ZXIucGwKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL2hvbWUvcGVybGZlY3QuY29t
LWRldi9zZWFyY2gvaW5kZXhlci5wbCx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS41OQpkaWZmIC11
IC1yMS41OSBpbmRleGVyLnBsCi0tLSBpbmRleGVyLnBsCTIwMDEvMTAvMjYgMTg6MTg6NDcJMS41
OQorKysgaW5kZXhlci5wbAkyMDAxLzEwLzI2IDE5OjAxOjQ0CkBAIC0xLDUgKzEsNSBAQAogIyEv
dXNyL2Jpbi9wZXJsIC13Ci0jJHJjcyA9ICcgJElkOiBpbmRleGVyLnBsLHYgMS41OSAyMDAxLzEw
LzI2IDE4OjE4OjQ3IGRhbmllbCBFeHAgJCAnIDsJCisjJHJjcyA9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