Branching off of 0.981 to fix Win32 issues
[dbsrgits/DBM-Deep.git] / lib / DBM / Deep / Scalar.pm
diff --git a/lib/DBM/Deep/Scalar.pm b/lib/DBM/Deep/Scalar.pm
new file mode 100644 (file)
index 0000000..1d03e04
--- /dev/null
@@ -0,0 +1,24 @@
+package DBM::Deep::Scalar;
+
+use strict;
+
+use base 'DBM::Deep';
+
+sub _get_self {
+    eval { local $SIG{'__DIE__'}; tied( ${$_[0]} ) } || $_[0]
+}
+
+sub TIESCALAR {
+    ##
+    # Tied hash constructor method, called by Perl's tie() function.
+    ##
+    my $class = shift;
+    my $args = $class->_get_args( @_ );
+    
+    $args->{type} = $class->TYPE_SCALAR;
+
+    return $class->_init($args);
+}
+
+1;
+__END__