Text::Placeholder::Group::SQL::Result - construct field lists for SELECT and format the result set
use Text::Placeholder; my $placeholder = Text::Placeholder->new( my $sql_result = '::SQL::Result'); $sql_result->placeholder_re('^fld_(\w+)$'); $placeholder->compile('<td>[=fld_some_name=]</td>'); my $statement = "SELECT ". join(', ', @{$sql_result->fields}). " FROM some_table"; print "$statement\n"; # my $rows = $dbh->selectall_arrayref($statement, ...); # foreach my $row (@$rows) {... my $row = [7, 8, 9]; $sql_result->subject($row); print ${$placeholder->execute()}, "<-\n";
Provides placeholder placeholders based on a configurable RE, which needs one capture group. Placeholders are substituted by the captured pattern. A list of captures can be obtained, from which SQL statements can be constructed.
Sets or gets the retrieved row.
Gets the captured placeholder parts.
The regular expression for matching placeholders.
This is the first public release.
Winfried Trumper <pub+perl(a)wt.tuxomania.net>
Copyright (C) 2011 Winfried Trumper
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Text::Placeholder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Placeholder
CPAN shell
perl -MCPAN -e shell install Text::Placeholder
For more information on module installation, please visit the detailed CPAN module installation guide.