Fixed the hypothetical TIESCALAR
rkinyon [Sat, 25 Feb 2006 02:33:43 +0000 (02:33 +0000)]
lib/DBM/Deep/Scalar.pm [new file with mode: 0644]

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__