Carrot

 view release on metacpan or  search on metacpan

lib/Carrot/Productivity/Text/Placeholder/Miniplate/SQL/Result./documentation/Result-en.pod  view on Meta::CPAN

=pod

=head1 NAME

Carrot::Productivity::Text::Placeholder::Miniplate::SQL::Result - construct field lists for SELECT and format the result set

=head1 SYNOPSIS

	$class_names->provide(
		my $template_class = '::Productivity::Text::Placeholder::Template');

	my $template = $template_class->constructor(
		my $sql_result = '::SQL::Result');
	$sql_result->placeholder_re('^fld_(\w+)$');
	$template->compile('<td>[=fld_some_name=]</td>');

	my $statement = "SELECT ". $sql_result->field_list->(). " FROM some_table";
	print "$statement\n";

	# my $rows = $dbh->selectall_arrayref($statement, ...);
	# foreach my $row (@$rows) {...
	my $row = [7, 8, 9];
	$sql_result->set_subject($row);

	print ${$template->execute()}, "<-\n";

=head1 DESCRIPTION

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.


=head1 METHOD REFERENCE (API)

=over 8

=item subject($row)

Sets or gets the retrieved row.

=item field_lists

Gets an anonymous sub to return the captured placeholder parts dynamically.

=item placeholder_re

The regular expression for matching placeholders.

=back

=head1 KNOWN BUGS AND LIMITATIONS

This is the first public release.

=head1 AUTHOR

Winfried Trumper E<lt>pub+perl(a)wt.tuxomania.netE<gt>

=head1 COPYRIGHT AND LICENSE

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.

=cut



( run in 0.641 second using v1.01-cache-2.11-cpan-4ab04211f4c )