comparison _test/temp.pl @ 422:b0481c071bea ref20150831

IMPL::Config::Container tests, YAMLConfiguration now works and tested
author cin
date Sun, 20 Aug 2017 00:20:41 +0300
parents bbc4739c4d48
children 60c2892a577c
comparison
equal deleted inserted replaced
421:7798345304bc 422:b0481c071bea
2 use strict; 2 use strict;
3 use Carp; 3 use Carp;
4 use Time::HiRes qw(gettimeofday tv_interval); 4 use Time::HiRes qw(gettimeofday tv_interval);
5 use Scalar::Util qw(blessed refaddr); 5 use Scalar::Util qw(blessed refaddr);
6 use YAML::XS qw(Dump Load); 6 use YAML::XS qw(Dump Load);
7 7 use Data::Dumper;
8 use URI;
8 9
9 10
10 use IMPL::require { 11 use IMPL::require {
11 Container => 'IMPL::Config::Container', 12 Container => 'IMPL::Config::Container',
12 Service => 'IMPL::Config::ServiceDescriptor', 13 Service => 'IMPL::Config::ServiceDescriptor',
13 Reference => 'IMPL::Config::ReferenceDescriptor', 14 Reference => 'IMPL::Config::ReferenceDescriptor',
14 Value => 'IMPL::Config::ValueDescriptor' 15 Value => 'IMPL::Config::ValueDescriptor',
16 YAMLConfig => 'IMPL::Config::YAMLConfig'
15 }; 17 };
16 18
17 my $data;
18 {
19 open my $h, "<", "sample.yaml" or die;
20 print "H: ", *{$h}{IO}, "\n";
21 binmode $h;
22 local $/;
23 $data = <$h>;
24 }
25 19
26 my $t = [gettimeofday]; 20 my $t = [gettimeofday];
21 my $config = YAMLConfig->new(load => 'sample.yaml');
22 print "Loaded: ",tv_interval($t,[gettimeofday]),"\n";
27 23
28 print Dump Load($data); 24 my $container = Container->new()->AutoPtr;
29 25 $config->ConfigureContainer($container);
30 print "Activated: ",tv_interval($t,[gettimeofday]),"\n";
31 26
32 27
28
29 print "Configured: ",tv_interval($t,[gettimeofday]),"\n";
30 #print Data::Dumper->Dump([$container]);
31 #$container->Dispose();
32
33 my $base = URI->new('some/path');
34 my $rel = URI->new('../other/path')->abs($base)->rel('/');
35 print $rel,"\n";
36
33 1; 37 1;