[Jifty-commit] r2808 - Jifty-DBI/trunk/lib/Jifty/DBI/Filter

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Feb 20 10:05:44 EST 2007


Author: sterling
Date: Tue Feb 20 10:05:43 2007
New Revision: 2808

Modified:
   Jifty-DBI/trunk/lib/Jifty/DBI/Filter/YAML.pm

Log:
removed imports in YAML filter to prevent namespace pollution issues

Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Filter/YAML.pm
==============================================================================
--- Jifty-DBI/trunk/lib/Jifty/DBI/Filter/YAML.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Filter/YAML.pm	Tue Feb 20 10:05:43 2007
@@ -4,8 +4,19 @@
 package Jifty::DBI::Filter::YAML;
 use base qw/ Jifty::DBI::Filter /;
 
-eval "use YAML::Syck";
-if ($@) { use YAML; }
+my ($Dump, $Load);
+
+eval "use YAML::Syck ()";
+if ($@) { 
+    use YAML (); 
+    $Dump = \&YAML::Dump;
+    $Load = \&YAML::Load;
+}
+
+else {
+    $Dump = \&YAML::Syck::Dump;
+    $Load = \&YAML::Syck::Load;
+}
 
 =head1 NAME
 
@@ -47,7 +58,7 @@
     my $value_ref = $self->value_ref;
     return unless defined $$value_ref;
 
-    $$value_ref = Dump($$value_ref);
+    $$value_ref = $Dump->($$value_ref);
 }
 
 =head2 decode
@@ -62,7 +73,7 @@
     my $value_ref = $self->value_ref;
     return unless defined $$value_ref;
 
-    $$value_ref = Load($$value_ref);
+    $$value_ref = $Load->($$value_ref);
 }
 
 =head1 IMPLEMENTATION


More information about the Jifty-commit mailing list