| 1 | package | ||
| 2 | DBIx::Class::CDBICompat::Relationship; | ||
| 3 | |||
| 4 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | ▶ | use Sub::Name (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | =head1 NAME | ||
| 9 | |||
| 10 | DBIx::Class::CDBICompat::Relationship - Emulate the Class::DBI::Relationship object returned from meta_info() | ||
| 11 | |||
| 12 | =head1 DESCRIPTION | ||
| 13 | |||
| 14 | Emulate the Class::DBI::Relationship object returned from C<meta_info()>. | ||
| 15 | |||
| 16 | =cut | ||
| 17 | |||
| 18 | 1 | my %method2key = ( | |
| 19 | name => 'type', | ||
| 20 | class => 'self_class', | ||
| 21 | accessor => 'accessor', | ||
| 22 | foreign_class => 'class', | ||
| 23 | args => 'args', | ||
| 24 | ); | ||
| 25 | |||
| 26 | sub new { | ||
| 27 | 0 | ▶ | my($class, $args) = @_; |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 28 | |||
| 29 | 0 | return bless $args, $class; | |
| 30 | } | ||
| 31 | |||
| 32 | 1 | for my $method (keys %method2key) { | |
| 33 | 5 | my $key = $method2key{$method}; | |
| 34 | my $code = sub { | ||
| 35 | 0 | ▶ | $_[0]->{$key}; |
|
Subroutine
foreign_class: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 36 | 5 | }; | |
| 37 | |||
| 38 | 1 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 39 | 5 | *{$method} = Sub::Name::subname $method, $code; | |
| 40 | } | ||
| 41 | |||
| 42 | 1 | 1; | |