File: Edge.pm

package info (click to toggle)
libsql-translator-perl 0.11011-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,380 kB
  • sloc: perl: 251,748; sql: 3,805; xml: 233; makefile: 7
file content (34 lines) | stat: -rw-r--r-- 1,125 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
package # hide from pause
  SQL::Translator::Schema::Graph::Edge;

use strict;
use warnings;

use Class::MakeMethods::Template::Hash (
  new => ['new'],
  scalar => [ qw( type ) ],
  array => [ qw( traversals ) ],
  object => [
          'thisfield'    => {class => 'SQL::Translator::Schema::Field'}, #FIXME
          'thatfield'    => {class => 'SQL::Translator::Schema::Field'}, #FIXME
          'thisnode'     => {class => 'SQL::Translator::Schema::Graph::Node'},
          'thatnode'     => {class => 'SQL::Translator::Schema::Graph::Node'},

         ],
);

sub flip {
  my $self = shift;

#warn "self thisfield: ".$self->thisfield->name;
#warn "self thatfield: ".$self->thatfield->name;

  return SQL::Translator::Schema::Graph::Edge->new( thisfield => $self->thatfield,
                                       thatfield => $self->thisfield,
                                       thisnode  => $self->thatnode,
                                       thatnode  => $self->thisnode,
                                       type => $self->type eq 'import' ? 'export' : 'import'
                                      );
}

1;