in reply to Re: Re: Rebuttle to chromatics
in thread Rebuttle to chromatics

Actually, HTML::Template loads the html off the file system. You do something like:
my $t = HTML::Template->new(filename => $file);
And pass any dynamic elements in.

We have an inhouse module called SQL::Serialized which is basically an autoload method that takes the method name, attaches .sql to the file and tries to load the query out of a file with that name.

We have been toying with releasing it vs rewriting it to use Inline (Inline::SQL). Then, we could also do something like Inline::HTML::Template.

This probably sounds goofy, but there is one situation in which SQL::Serialized is a massive bitch: utility scrips; the support files (.sql's) either have to be in a hardcoded location or the current directory.

My idea was to take advantage of using __DATA__ blocks for storing queries so that we don't have to deal with sql files for that. Inline has support for this sort of thing.

But, as it stands, currently, queries look like this

my $dbh = DBI->connect; my $sql = SQL::Serialized->new(directory => './sql'); my $sth = $dbh->prepare_cached($sql->big_query); $sth->execute(@place_held);
My views come from the fact that if you change database, you are going to have to change your SQL anyway. Although, one person I know says that if you write all your sql against dbase or some silly, lowest common denominator, databse that isn't the case.