[ic] Taking a Poll

Dan B db@cyclonehq.dnsalias.net
Fri, 20 Apr 2001 14:01:12 -0700


At 08:21 AM 4/20/2001 -0400, you wrote:
>Dan B wrote :
> > For example, wouldn't it be great if there were a tool that took an IML
> > page and converted it to the equivalent perl?
>
>I don't get it. Was this sarcasm ?

No.

>Why in world would you want to change the tags back to Perl ? This would
>mean that the tags are superfluous and that you had less difficulties
>with IC if it were completely written in Perl.

If one were trying to do some things that wasn't supported by the IML tags, 
or you needed to do a bunch of perl stuff that integrated tightly with 
other tags, in my opinion it *would* be valuable to know the equivalent perl.

Knowing what the equivalent perl was, one could substitute a given block of 
IML tags with the equivalent perl, then customize that perl more 
easily.  For example, if one were trying to do some advanced things with 
[query], one could run the code through the proverbial "IML->perl 
translator" and then customize the query to your perl coder's content.  For 
example:

[query list=1 sql=|
         SELECT  sku
         FROM    products | ]
         [query-param sku]
[/query]

would translate to something like:

my $dbh = $SQL{products}
         or return HTML "Database not shared.";
my $query = <<EOF;
SELECT sku FROM products
EOF
my $sth = $dbh->prepare($query)
         or return HTML "Couldn't open database.";
$sth->execute();
my $array = $sth->fetchall_arrayref();
for(@$array) {
         HTML qq{$array->[0]};
}

So that one could take the resulting perl and customize it to your hearts 
content.  Later,

Dan Browning, Cyclone Computer Systems, danb@cyclonecomputers.com