Problem with the code
Hi everyone, The following sub checks for bad e-mail address, and reports it: if (($self-{_Email} =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/ || $self-{_Email} !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/)) { $cool = undef; # No longer cool $message = $self-{_EmailInvalidMessage}; my $m = MessageText-new(Replacements = \%r, Message = $message); $self-{_ErrorEmail} = $m-print; } However, the code is rejecting the domains ending with .info, and .name (the reason is that it has 4 digits after the zero) Can someone please tell me how to change this code so it works please. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Reformatting a file
Hello all, I'm trying to correct some shopping cart files that got messed up and need to be reformatted, so we can rebuild the database from these text order files. This is a sample of some of the data: order_items::PF110::189.95::0.00::89.95:: ^^GG111::149.95::0.00::49.95:: order_items::GU402::2::Necklace Color Black::29.95::0.00::59.90:: ^^TUE100::195.00::0.00::95.00:: ^^GG111::149.95::0.00::49.95:: ^^LM305::112.95::0.00::12.95:: ^^CO303::124.95::0.00::24.95:: order_items::GU402::2::Necklace Color Black::29.95::0.00::59.90:: ^^AN401::164.95::0.00::64.95:: ^^GU407::129.95::0.00::29.95:: ^^PF110::189.95::0.00::89.95:: Now each of these order_items lines, I need to grab the lines from the file, IE: order_items::PF110::189.95::0.00::89.95:: ^^GG111::149.95::0.00::49.95:: then put it all on one line, IE: order_items::PF110::189.95::0.00::89.95::^^GG111::149.95::0.00::49.95: Here is what the entire order file looks like: invuserid::[EMAIL PROTECTED] address1:: Princewood Dr. address2:: city::AnyWhere state::WI zip::12345 country::US firstname::John lastname::Doe midname::D. phone::1.555.1212. hphone:: nphone:: fax:: shaddress1:: Princewood Dr. shaddress2:: shcity::AnyWhere shstate::WI shzip::12345 shcountry::US shfirstname::John shlastname::Doe shmidname::D. total_weight::2.54 invno::1023467192204 invdate::6/7/2002 tot_price::289.75 tot_discount::57.95 tax_total::0.00 vat_tax::0.00 shipping_total::8.00 tot_item_shipping::0 grand_total::239.80 order_items::TUE100::195.00::0.00::95.00:: ^^PF109::159.95::0.00::59.95:: ^^LGP107::159.95::0.00::59.95:: ^^QM201::124.95::0.00::24.95:: ^^EN200::124.95::0.00::24.95:: ^^CO303::124.95::0.00::24.95:: Any suggestion/help on the best way to do this, and would be appreciated. TIA, -- Mike(mickalo)Blezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Bus Phone: 1(985)902-8484 Cellular: 1(985)320-1191 Fax:1(985)345-2419 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
sql statement parsing
hi guys, how can i parse the where clause in an SQL::Statement object instance? $statement = SQL::Statement-new(select 1,2,3 from table where x=y); now when i do this: $where = $stmt-where(); it gives me error: Can't locate object method where via package SQL::Statement (perhaps you for got to load SQL::Statement?) at blah line 34. any idea? thanks -- Hytham Shehab -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sql statement parsing
At 07:34 PM 8/10/02 +0300, Hytham Shehab wrote: how can i parse the where clause in an SQL::Statement object instance? $statement = SQL::Statement-new(select 1,2,3 from table where x=y); Hytham, Although I haven't used SQL::Statement you can certainly do something like: $condition = $1 if $statement =~ /where (.+)( order by .+){0,1}$/; I haven't tested this but I expect it to pick up the conditional part of an SQL statement which would then be up to you to parse further if needed. In your example though you have assigned the SQL statement in the code. Therefore wouldn't it make more sense if this is really how the code works to do something like: my $cond = 'x=y'; $statement = SQL::Statement-new(select 1,2,3 from table where $cond;); Then you parse upfront, so to speak. This is how I assemble queries on the fly for transactions that need that functionality. hth, Marty -- SIMPL WebSite Creation: http://face2interface.com/Home/Demo.shtml -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sql statement parsing
Hytham, Although I haven't used SQL::Statement you can certainly do something like: $condition = $1 if $statement =~ /where (.+)( order by .+){0,1}$/; I haven't tested this but I expect it to pick up the conditional part of an SQL statement which would then be up to you to parse further if needed. In your example though you have assigned the SQL statement in the code. Therefore wouldn't it make more sense if this is really how the code works to do something like: my $cond = 'x=y'; $statement = SQL::Statement-new(select 1,2,3 from table where $cond;); Then you parse upfront, so to speak. This is how I assemble queries on the fly for transactions that need that functionality. hth, Marty nice way to get the where clause, but i don't want ot get data, nor insert data, the sole purpose of my script is to type the select statement in more tree-like structure, so i don't know the values of $cond to evaluate it, besides, am using SQL::Statement for the pure purpose of parsing, no more, no less, all what i wounder is, why am getting this error message, and how to avoid it. any help or new idea? -- Hytham Shehab -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sql statement parsing
Is the below 'exactly' what you have? The reason I ask is: $statement = SQL::Statement-new(select 1, and $where = $stmt-where(); Should it be: $where = $statement-where(); HTH, David thanks david for telling my about my *EMAIL* typo, coz it is wriiten *CORRECTLY* in the script. again, thanks. -- Hytham Shehab -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: sql statement parsing
Posting your whole script, or a larger part might be helpful and get more response. sidenoteare you using strict and warnings?/sidenote My original hunch was that the where method was not being exported and therefore was not loaded by your script, upon a slight more research I was *unable* to find the where function you are using anywhere except in the documentation for SQL::Statement, which makes reference to the where method existing in the SQL::Statement::OP package which I could also not find either in the source for SQL::Statement nor elsewhere on CPAN. You might want to crack open the source for the module you have installed but I wasn't able to locate where this method is defined (other than in the docs). You might also contact the creator of the module about this specific problem. http://danconia.org Hytham Shehab wrote: hi guys, how can i parse the where clause in an SQL::Statement object instance? $statement = SQL::Statement-new(select 1,2,3 from table where x=y); now when i do this: $where = $stmt-where(); it gives me error: Can't locate object method where via package SQL::Statement (perhaps you for got to load SQL::Statement?) at blah line 34. any idea? thanks -- Hytham Shehab -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]