Click here to get back home

mySQL error handling with PERL

 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
mySQL error handling with PERL jnam 06-21-2005
Posted by jnam on June 21, 2005, 9:37 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 Paul Lalli on June 21, 2005, 7:25 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
Error Handling in Net::SSH::Perl November 13, 2006, 3:58 pm
IIS Like Error using Perl Active State w/ SQL Server or MySQL April 28, 2006, 2:12 pm
cp error handling September 17, 2004, 4:06 am
Error handling July 4, 2007, 6:21 am
Net::Google error handling March 7, 2005, 9:02 am
Best error handling mechanism? June 4, 2007, 9:13 pm
Net::Telnet Error handling/trapping February 5, 2007, 4:38 pm
Error in Handling Unicode(UTF16-LE) File & String May 6, 2008, 4:00 am
Msql-Mysql-modules: unable to find my mySQL 'include' dir March 4, 2005, 2:57 am
Handling constants in Perl? April 19, 2005, 11:40 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap