LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Perl / MySQL oddity

[ILUG] Perl / MySQL oddity

Wesley Darlington wesley at blackstar.co.uk
Sat Apr 22 17:52:24 IST 2000


Hi Y'all,

On Sat, Apr 22, 2000 at 12:17:11AM +0100, Niall wrote:
> I suppose this more properly belongs on c.l.p or somesuch, but as I know a
> few of you are using Perl and MySQL I thought I'd try here first. I'm
> encountering a strange error when trying to populate a MySQL table with code
> like this
> 
> $Filename =~ m-(\d+ +)(.*)(/WHATEVER)-;
> 
> #  $title = $2;
> 
> $values = join ",", $dbh->quote($Description),
>  $dbh->quote(substr($Description, 0, 50)), $dbh->quote($2), 
>  $dbh->quote($Keywords), $dbh->quote($UnixPath),
>  $dbh->quote($MacPath), $dbh->quote($Volume);

I imagine DBI's quote() method uses regular expressions and as such
kills whatever value you might have in $2. Probably.

What happens if you do a...

sub please_explain {
    my $arg = shift;
    print STDERR "Everywhere you look, all you see is `$arg'.\n";
    return "";
}

$values = join ",", $dbh->quote($Description),
 $dbh->quote(substr($Description, 0, 50)), 
     please_explain($2),
     $dbh->quote($2),
 $dbh->quote($Keywords), $dbh->quote($UnixPath),
 $dbh->quote($MacPath), $dbh->quote($Volume);

Wesley.




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell