Changeset 817
- Timestamp:
- 05/24/06 22:38:32
- Files:
-
- trunk/plagger/lib/Plagger/Cookies.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Cookies.pm
r807 r817 4 4 use UNIVERSAL::require; 5 5 6 our %Instances; 7 6 8 sub create { 7 9 my($class, $conf) = @_; 8 10 9 unless (ref $conf ) {10 $conf = $class->auto_guess($conf);11 Plagger->context->log(debug => "$conf->{file} => $conf->{type}") if $conf->{type};11 unless (ref $conf && $conf->{type}) { 12 my $file = ref $conf ? $conf->{file} : $conf; 13 $conf = $class->auto_guess($file); 12 14 } 13 15 14 my $type = delete $conf->{type}; 15 my $impl = $type ? "HTTP::Cookies::$type" : "HTTP::Cookies"; 16 $impl->require or Plagger->context->error("Error loading $impl: $@"); 16 $Instances{$conf->{file}} ||= do { 17 my $type = delete $conf->{type}; 18 my $impl = $type ? "HTTP::Cookies::$type" : "HTTP::Cookies"; 19 Plagger->context->log(debug => "$conf->{file} => $impl"); 20 $impl->require or Plagger->context->error("Error loading $impl: $@"); 17 21 18 $impl->new(%$conf); 22 $impl->new(%$conf); 23 }; 19 24 } 20 25
