View previous topic :: View next topic |
Author |
Message |
littlestar -
Joined: 23 Aug 2005 Posts: 7
|
Posted: Mon Oct 10, 2005 11:50 am Post subject: how to replace string |
|
|
I have a query. for example: "SELECT * FROM project". and it executed successful. I replaced " " with "+" as follows:
Code: |
my $string = 'SELECT * FROM project';
$string =~ s/ /+/g;
|
It's OK. result is "SELECT+*+FROM+project".
But when I replace in the opposite, from "+" to " ". It's impossible.
Code: |
my $string = 'SELECT+*+FROM+project';
$string =~ s/+/ /g;
|
So, I changed by this:
Code: |
$string =~ tr/+/ /;
|
Ok. It returned as initial "SELECT * FROM project". But this time, it can't execute SQL query. It has error:
Code: |
Insecure dependency in parameter 1 of DBI::db=HASH(0x889e6d8)->prepare method call while running with -T switch at Test/DB.pm line 60.
|
I don't understand why. please help me
I'm awaiting your reply, thanks so much |
|
Back to top |
|
|
Anonymoose -
Joined: 09 Sep 2003 Posts: 2192
|
Posted: Mon Oct 10, 2005 1:17 pm Post subject: |
|
|
Use \s to represent a single whitespace character. Not sure whether this will also solve your error, but it should sort your regex out... _________________
"Invent an idiot proof webserver and they'll invent a better idiot..." |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon Oct 10, 2005 2:39 pm Post subject: Re: how to replace string |
|
|
littlestar wrote: |
Code: |
Insecure dependency in parameter 1 of DBI::db=HASH(0x889e6d8)->prepare method call while running with -T switch at Test/DB.pm line 60.
|
|
This error is generated because you're using the Perl Tainted mode. Your code is OK, but Perl detected it can be unsecure and allow external unvalidated input to be used without any prior checks.
Please read http://www.aprelium.com/forum/viewtopic.php?p=44518#44518 for a similar topic. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
littlestar -
Joined: 23 Aug 2005 Posts: 7
|
Posted: Tue Oct 11, 2005 8:13 am Post subject: |
|
|
well, It's successful. be happy excessively when you helped
Thanks so much, my friends. |
|
Back to top |
|
|
|