Click here to get back home

Problem with requesting page by using LWP::UserAgent

 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
Problem with requesting page by using LWP::UserAgent assassin5615 03-16-2007
Get Chitika Premium
Posted by assassin5615 on March 16, 2007, 3:38 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 assassin5615 on March 16, 2007, 4:48 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
LWP::UserAgent and 404 page not found June 22, 2005, 6:47 pm
LWP::UserAgent and redirected page responses October 21, 2005, 12:33 pm
LWP::Useragent problem with https June 9, 2005, 11:36 am
Problem posting with LWP::UserAgent October 21, 2005, 8:58 am
Requesting FLASH + PERL book May 2, 2005, 1:00 pm
LWP user agent grabs the intermediate wait page after POST intead of the actual result page February 12, 2008, 12:50 am
transfer value from one page to single frame of a second,frameset page September 14, 2008, 7:25 am
what to feed UserAgent? July 17, 2004, 4:06 pm
LWP::UserAgent & Mechanize August 1, 2004, 5:44 am
Using HTTPS in UserAgent etc October 27, 2004, 1:10 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap