Click here to get back home

To get the HTTP response headers such as content length from a web server

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
To get the HTTP response headers such as content length from a web server dhawangayash 02-23-2007
Posted by dhawangayash on February 23, 2007, 6:16 am
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


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

Posted by Tad McClellan on February 23, 2007, 7:30 am
Please log in for more thread options
>>
>> [snip]
>>
>> > if I print "$1\n",
>> > the file prints just fine. But, if I do something like print "$1 after
>> > \n", the whole output is messed up. If I print "before $1\n", nothing
>> > prints at all. If I print "before $1 after\n", only after prints.
>>
>> not really sure, but could be a rogue "\r" in $1,


> There
> is a rogue carriage return (0xd) in the string

> Is there something I can do to deal with this
> situation?


Repair the corrupted file:

perl -p -i -e 'tr/\r//d' bad_file


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

Similar ThreadsPosted
The Question headers vs. the Answer content January 5, 2006, 7:58 pm
HTTP::Response and gzip July 25, 2006, 12:46 pm
Using a buffer with HTTP::Response? May 23, 2008, 6:50 am
HTTP::Request response September 23, 2008, 3:28 pm
HTTP::Request/GET response not expected May 6, 2005, 12:00 pm
Reading HTTP response body that is gzip'd *and* in UTF-8 August 4, 2006, 2:36 pm
How to suppress http headers during download August 8, 2005, 11:22 am
Proper echoing of HTTP headers from LWP call ? October 17, 2007, 8:51 pm
How to handle a HTTP::Request with gzip, deflate headers December 3, 2004, 4:49 am
How do I do full access logging including HTTP headers? October 29, 2006, 4:56 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap