From: rkinyon Date: Sat, 25 Feb 2006 02:33:43 +0000 (+0000) Subject: Fixed the hypothetical TIESCALAR X-Git-Tag: 0-98~14 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=df9a659d4a89ec1f646f397960698afe8df5bbfc;p=dbsrgits%2FDBM-Deep.git Fixed the hypothetical TIESCALAR --- diff --git a/lib/DBM/Deep/Scalar.pm b/lib/DBM/Deep/Scalar.pm new file mode 100644 index 0000000..1d03e04 --- /dev/null +++ b/lib/DBM/Deep/Scalar.pm @@ -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__