Data.pm 541 B

1234567891011121314151617181920212223242526272829
  1. package Trog::Data;
  2. use strict;
  3. use warnings;
  4. no warnings 'experimental';
  5. use feature qw{signatures};
  6. #It's just a factory
  7. =head1 Trog::Data
  8. This is a data model factory.
  9. =head2 Trog::Data->new(Trog::Config) = $handle
  10. Returns a new Trog::Data::* class appropriate to what is configured in the Trog::Config object passed.
  11. =cut
  12. sub new( $class, $config ) {
  13. my $module = "Trog::Data::".$config->{'general'}{'data_model'};
  14. my $req = $module;
  15. $req =~ s/::/\//g;
  16. require "$req.pm";
  17. return $module->new($config);
  18. }
  19. 1;