File: Affe.pm

package info (click to toggle)
libdbix-class-dynamicdefault-perl 0.04-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 1,497; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 632 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use strict;
use warnings;

package TestSchema::Affe;

use parent qw/DBIx::Class/;

__PACKAGE__->load_components(qw/DynamicDefault Core/);
__PACKAGE__->table('affe');

__PACKAGE__->add_columns(
    moo => {
        data_type                 => 'integer',
        dynamic_default_on_update => 'moo_default',
        always_update             => 1,
    },
    kooh => {
        data_type                 => 'text',
        dynamic_default_on_update => 'kooh_default',
    },
);

__PACKAGE__->set_primary_key(qw/moo/);

{
    my $i = 0;

    sub moo_default {
        return ++$i;
    }
}

sub kooh_default {
    return 'zomtec';
}

1;