File: Inflator.pm

package info (click to toggle)
libdbix-class-schema-populatemore-perl 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 400 kB
  • sloc: perl: 3,412; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,482 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package DBIx::Class::Schema::PopulateMore::Inflator;

use Moo;

=head1 NAME

DBIx::Class::Schema::PopulateMore::Inflator - Base Class for keyword Inflators

=head1 DESCRIPTION

When L<DBIx::Class::Schema::PopulateMore::Command> executes, it uses a visitor object 
(see L<DBIx::Class::Schema::PopulateMore::Visitor> to descend the key values of the
data hash that is used to put stuff into the given tables.  If it finds a value
that matches a particular regexp, that means the value needs to be inflated and
it's passed to the inflating dispatcher, which finds the correct Inflator based
on the given namespace.

=head1 ATTRIBUTES

This class defines the following attributes.

=head1 METHODS

This module defines the following methods.

=head2 name

returns the name of this inflator.  Should be something you expect to be unique
across all defined inflators.  Defaults to something based on the namespace.

=cut

sub name
{
    my $class = ref shift @_;
    my $package = __PACKAGE__;
    my ($name) = ($class =~m/^$package\:\:(.+)$/);
    
    return $name;
}


=head2 inflate($command, $string)

This is called by L<DBIx::Class::Schema::PopulateMore::Command> dispatcher, when there 
is a match detected by the visitor.

=cut

sub inflate
{ 
    die "You forgot to implement ->inflate";
}


=head1 AUTHOR

Please see L<DBIx::Class::Schema::PopulateMore> For authorship information

=head1 LICENSE

Please see L<DBIx::Class::Schema::PopulateMore> For licensing terms.

=cut


1;