App-ZofCMS

 view release on metacpan or  search on metacpan

lib/App/ZofCMS/Plugin/CRUD.pm  view on Meta::CPAN

sub _key { 'plug_crud' }
sub _defaults {
    return (
        table       => 'products',
        file_dir    => 'files',
        can         => 'CRUDL',
        no_time_sort => 0,
        opt         => {
            RaiseError => 1,
            AutoCommit => 1,
            mysql_enable_utf8 => 1,
        },

        # These are plug's parameters, but with no defaults
        #   dsn     => 'DBI:mysql:database=zofdb;host=localhost',
        #   user    => db_login
        #   pass    => db_pass
        #   opt     => db_opt
        #   items   => CRUD items
        #  list_sub => # sub for processing the list of output items

lib/App/ZofCMS/Plugin/CRUD.pm  view on Meta::CPAN


    ### Mandatory fields without defaults: dsn, user, items

    plug_crud => {
        dsn             => 'DBI:mysql:database=zofdb;host=localhost',
        user            => 'db_login',
        pass            => 'db_pass',
        opt             => {
            RaiseError        => 1,
            AutoCommit        => 1,
            mysql_enable_utf8 => 1,
        },
        items       => [
            'Item',
            { Description => [ 'textarea', optional => 1 ] },
            { File        => 'file'                        },
            { Time        => sub { time(); }               },
        ],
        list_sub        => # sub for processing the list of output items
        table           => 'products',
        file_dir        => 'files/',

lib/App/ZofCMS/Plugin/CRUD.pm  view on Meta::CPAN

    pass => 'test',

B<Optional>. Specifies your password for the SQL database. If not specified,
behaviour will be akin to not having a set password.

=head3 C<opt>

    opt => {
        RaiseError => 1,
        AutoCommit => 1,
        mysql_enable_utf8 => 1,
    }

B<Optional>. Takes a hashref as a value. Specifies the
additional options for L<DBI>'s C<connect_cached()> method.
See L<DBI>'s docs for C<connect_cached()> method for more info on this
one. B<Defaults to:>
C<< { RaiseError => 1, AutoCommit => 1, mysql_enable_utf8 => 1, } >>

=head3 C<table>

    table => 'products',

B<Optional>. Takes a string as a value that represents the name of the
table in which to store the data. B<Defaults to:> C<products>

=head3 C<items>



( run in 0.239 second using v1.01-cache-2.11-cpan-00829025b61 )