GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  DIRECTORY::SCRATCH::STRUCTURED (3)

.ds Aq ’

NAME



 Directory::Scratch::Structured - creates temporary files and directories from a structured description



CONTENTS

SYNOPSIS



  my %tree_structure =
                (
                dir_1 =>
                        {
                        subdir_1 =>{},
                        file_1 =>[],
                        file_a => [],
                        },
                dir_2 =>
                        {
                        subdir_2 =>
                                {
                                file_22 =>[],
                                file_2a =>[],
                                },
                        file_2 =>[],
                        file_a =>[12345],
                        file_b =>[],
                        },
                       
                file_0 => [] ,
                ) ;
               
  use Directory::Scratch::Structured qw(create_structured_tree) ;
  my $temporary_directory = create_structured_tree(%tree_structure) ;
 
  or
 
  use Directory::Scratch ;
  use Directory::Scratch::Structured  qw(piggyback_directory_scratch) ;

  my $temporary_directory = Directory::Scratch->new;
  $temporary_directory->create_structured_tree(%tree_structure) ;



DESCRIPTION

This module adds a create_structured_tree subroutine to the Directory::Scratch.

DOCUMENTATION

I needed a subroutine to create a bunch of temporary directories and files while running tests. I used the excellent Directory::Scratch to implement such a functionality. I proposed the subroutine to the Directory::Scratch author but he preferred to implement a subroutine using an unstructured input data based on the fact that Directory::Scratch didn’t use structured data. This is, IMHO, flawed design, though it may require slightly less typing.

I proposed a hybrid solution to reduce the amount of subroutines and integrate the subroutine using structured input into Directory::Scratch but we didn’t reach an agreement on the API. Instead I decided that I would piggyback on Directory::Scratch.

You can access create_structured_tree through a subroutine or a method through a Directory::Scratch object.

Whichever interface you choose, the argument to the create_structured_tree consists of tuples (hash entries). The key represents the name of the object to create in the directory.

If the value is of type:
ARRAY A file will be created, it’s contents are the contents of the array (See Directory::Scratch)
HASH A directory will be created. the element of the hash will also be , recursively, created
OTHER The subroutine will croak.

SUBROUTINES/METHODS

    create_structured_tree



  use Directory::Scratch::Structured qw(create_structured_tree) ;
 
  my $temporary_directory = create_structured_tree(%tree_structure) ;
  my $base = $temporary_directory->base() ;



Returns a default Directory::Scratch object.

    directory_scratch_create_structured_tree

Adds create_structured_tree to Directory::Scratch when you Load <B>Directory::Scratch::StructuredB> with the <B>piggyback_directory_scratchB> option.



  use Directory::Scratch ;
  use Directory::Scratch::Structured qw(piggyback_directory_scratch) ;

  my $temporary_directory = Directory::Scratch->new;
  $temporary_directory->create_structured_tree(%tree_structure) ;



    _create_structured_tree

Used internally by both interfaces

    piggyback

Used internally to piggyback Directory::Scratch.

BUGS AND LIMITATIONS

None so far.

AUTHOR



        Khemir Nadim ibn Hamouda
        CPAN ID: NKH
        mailto:nadim@khemir.net



LICENSE AND COPYRIGHT

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SUPPORT

You can find documentation for this module with the perldoc command.



    perldoc Directory::Scratch::Structured



You can also look for information at:
o AnnoCPAN: Annotated CPAN documentation

<http://annocpan.org/dist/Directory-Scratch-Structured>

o RT: CPAN’s request tracker

Please report any bugs or feature requests to L <bug-directory-scratch-structured@rt.cpan.org>.

We will be notified, and then you’ll automatically be notified of progress on your bug as we make changes.

o Search CPAN

<http://search.cpan.org/dist/Directory-Scratch-Structured>

SEE ALSO

Directory::Scratch
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 DIRECTORY::SCRATCH::STRUCTURED (3) 2016-04-03

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.