[Bps-public-commit] r15797 - Data-Hierarchy/trunk
clkao at bestpractical.com
clkao at bestpractical.com
Mon Sep 8 06:51:53 EDT 2008
Author: clkao
Date: Mon Sep 8 06:51:52 2008
New Revision: 15797
Modified:
Data-Hierarchy/trunk/ (props changed)
Data-Hierarchy/trunk/Hierarchy.pm
Log:
r35254 at mtl (orig r189): clkao | 2004-09-14 05:13:25 +0800
* Allow options in constructor. [Autrijus Tang]
* Prepare for 0.19.
Modified: Data-Hierarchy/trunk/Hierarchy.pm
==============================================================================
--- Data-Hierarchy/trunk/Hierarchy.pm (original)
+++ Data-Hierarchy/trunk/Hierarchy.pm Mon Sep 8 06:51:52 2008
@@ -1,5 +1,5 @@
package Data::Hierarchy;
-$VERSION = '0.18';
+$VERSION = '0.19';
use strict;
use Clone qw(clone);
@@ -36,7 +36,10 @@
sub new {
my $class = shift;
- my $self = bless {}, $class;
+ # allow shorthand of ->new({...}) to mean ->new(hash => {...})
+ unshift @_, 'hash' if @_ % 2;
+
+ my $self = bless {@_}, $class;
$self->{sep} ||= '/';
$self->{hash} = shift || {};
$self->{sticky} = {};
More information about the Bps-public-commit
mailing list