Winfried Trumper > Text-Placeholder-0.04 > Text::Placeholder::Group::SQL::Result

Download:
Text-Placeholder-0.04.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

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

SYNOPSIS ^

        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";

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.

METHOD REFERENCE (API) ^

subject($row)

Sets or gets the retrieved row.

fields

Gets the captured placeholder parts.

placeholder_re

The regular expression for matching placeholders.

KNOWN BUGS AND LIMITATIONS ^

This is the first public release.

AUTHOR ^

Winfried Trumper <pub+perl(a)wt.tuxomania.net>

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.

syntax highlighting: