#!/usr/bin/perl
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	
	my $parent = $_{parent};
	$this->croak("bad parent") unless ref $parent;
	my $id = $_{id};
	$this->croak("id required") unless length $id;
	if ($id =~ /\//) {
		die "invalid id: $id";
	}
	
	# Need a mode 777 directory for new method to write to. See that
	# method for the gory details.
	my $oldmask = umask(0);
	mkdir($id, 0777) || $this->croak("cannot make directory");	
	umask($oldmask);
	
	delete $_{parent};
	$_{id} = $this->id."/".$id;
	return $parent->new(%_);	
}
