geektron has asked for the wisdom of the Perl Monks concerning the following question:
while i'd love to spend the time cleaning it up, i just need to fix a display problem right now. because the headers are fetched, all the CSS information also gets fetched ( along w/ title, etc ), and it's blowing up the display.
here's what i've been trying to do, without much success:
there may be a better, non-regex way ( and i'm open to suggestions ), but it seemed a brute force regex answer would be quick ....## dummy URL my $out = get("http://www.webpage.com"); + + $out =~ s/\cM//g; ## doesn't seem to match $out =~ s#^<head>[\w|\s]+</head>#<!-- header removed -->#mio; $out =~ s/<head>(.*?)</head>#<!-- header removed -->/im; + + ## these work ... but only take out one line #$out =~ s#<html>#<!-- header removed -->#mi; #$out =~ s#<title>(.*)</title>#<!-- header removed -->#mi; #$out =~ s#<meta(.*)>#<!-- header removed -->#mi; ## also doesn't work $out =~ s#<style type(.*?)</style>#<!-- header removed -->#im;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strip header from page fetched w/ LWP
by Fletch (Bishop) on Feb 09, 2004 at 17:34 UTC | |
by geektron (Curate) on Feb 09, 2004 at 17:42 UTC | |
by hardburn (Abbot) on Feb 09, 2004 at 17:53 UTC | |
|
Re: strip header from page fetched w/ LWP
by Anonymous Monk on Feb 09, 2004 at 17:37 UTC | |
|
Re: strip header from page fetched w/ LWP
by Anonymous Monk on Feb 10, 2004 at 07:34 UTC |