| Cantella-Store-UUID documentation | Contained in the Cantella-Store-UUID distribution. |
Cantella::Store::UUID::Util - Useful things that didn't belong in the objects
Will recursively make a directory hioerarchy $levels deep using
$dir as the root. $dir will not be created.
Guillermo Roditi (groditi) <groditi@cpan.org>
This software is copyright (c) 2009 by Guillermo Roditi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
| Cantella-Store-UUID documentation | Contained in the Cantella-Store-UUID distribution. |
package Cantella::Store::UUID::Util; use strict; use warnings; use Sub::Exporter -setup => { exports => [ '_mkdirs' ] }; our $VERSION = '0.003003'; sub _mkdirs { my $dir = shift; my $levels = shift; --$levels; for my $node ( (0..9), qw(A B C D E F) ){ my $subdir = $dir->subdir($node); if( -f $subdir ){ die("Can't create dir '${subdir}': a file with a conflicting name exists"); } if( ! $subdir->mkpath ){ die("Can't create dir '${subdir}': $!"); } _mkdirs($subdir, $levels) if $levels > 0; } } 1; __END__;