21 opendir(D, $dir) || return ();
22 @list = grep {/$pattern/ && -f File::Spec->catfile($dir, $_) } readdir(D);
27 eval qq{ require videosite::$p; };
29 print("Failed to load plugin: $@");
33 $g = eval qq{ videosite::$p->new();};
35 print("Failed to instanciate: $@");
40 if ($type eq $g->{'TYPE'}) {
43 printf('%s has wrong type (got %s, expected %s)', $p, $g->{'TYPE'}, $type);
52 my $c = {-name => 'environment', -schemas => {}};
54 if (exists($ENV{'http_proxy'})) {
55 $c->{-schemas}->{'http'} = $ENV{'http_proxy'}
58 if (exists($ENV{'https_proxy'})) {
59 $c->{-schemas}->{'https'} = $ENV{'https_proxy'}
74 my ($success, $notest, $fail) = (0,0,0);
76 GetOptions("d" => \$debug);
78 # This is some dark magic to find out our real base directory,
79 # where we hope to find our plugins.
80 $bp = File::Spec->catdir(dirname(realpath($0)), 'videosite');
81 unshift(@INC, dirname(realpath($0)));
83 @g = ploader($bp, '.*Grabber\.pm$', 'grabber');
84 ($f) = ploader($bp, '^FileGetter\.pm$', 'getter');
86 unless(@g and defined($f)) {
87 print("No plugins could be loaded\n");
92 $_->setio(sub { printf(@_); print("\n"); } );
96 $_->setconn(\&connectors);
100 printf("Doing self tests:\n");
104 printf(" %s...", $_->{'NAME'});
105 $r = $_->_selftest();
111 printf(" no self test\n");
119 printf("\n\n%d succeeded\n%d failed\n%d not testable\n", $success, $fail, $notest);