Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: RFC: Name and/or API for module ("Type::FromData")

by InfiniteSilence (Curate)
on Apr 09, 2014 at 20:19 UTC ( #1081719=note: print w/ replies, xml ) Need Help??


in reply to RFC: Name and/or API for module ("Type::FromData")

The first practical problem I run into with this module is that the user really isn't free to choose any name for a field -- in your example the use of 'when' in unacceptable in PostgreSQL. Perhaps some kind of target setting like 'forMYSQL' or 'forPostgres' would generate some kind of error when a reserved word is utilized for a field name (or maybe munge it with something to make it acceptable).

Second, I would prefer to be able to override the regexes that define what a particular thing is -- a date, a numeric type, or a string -- with my own regexes.

Third, some RDBMS allow for custom data types to be defined. This module should have some allowance for those.

Otherwise I think this module is a good idea. The name seems okay. I would slap some pod into it and give it a very low version number.

BTW, this line is wrong:

$dt->guess( @$data );
Should be,
$dt->guess( @data );

Celebrate Intellectual Diversity


Comment on Re: RFC: Name and/or API for module ("Type::FromData")
Select or Download Code
Re^2: RFC: Name and/or API for module ("Type::FromData")
by Corion (Pope) on Apr 09, 2014 at 20:42 UTC

    Indeed - I have thought about extensibility and the SQL dialects, but I really think those should come after there is some generic type definition instead of strings getting passed around. But I don't want to write the code for the generic data type myself :)

Re^2: RFC: Name and/or API for module ("Type::FromData")
by chacham (Vicar) on Apr 10, 2014 at 18:48 UTC
    WHEN is not a good name as it is a keyword in the CASE statement.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1081719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2015-07-07 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls