Perl::Dist::WiX::Tag::Directory - <Directory> tag that knows how to search its children.


This document describes Perl::Dist::WiX::Tag::Directory version 1.500.


        my $dir_tag = Perl::Dist::WiX::Tag::Directory->new(
                id => 'Perl',
                name => 'perl',
                path => 'C:\strawberry\perl',

        # Parameters can be passed as a hash, or a hashref.
        # A hashref is shown.
        my $dir_tag_2 = $dir_tag->add_directory({
                id => 'Vendor',
                name => 'vendor',
                path => 'C:\strawberry\perl\vendor',
        my $dir_tag_3 = $dir_tag->get_directory_object('Vendor');

        my $dir_tag_4 = $dir_tag->search_dir({
                path_to_find => 'C:\strawberry\perl\vendor',
                descend => 1,
                exact => 1,


This is an XML tag that refers to a directory that is used in a Perl::Dist::WiX based distribution.


This class is a WiX3::XML::Directory and inherits its API, so only additional API is documented here.


The new constructor takes a series of parameters, validates them and returns a new Perl::Dist::WiX::Tag::Directory object.

If an error occurs, it throws an exception.

It inherits all the parameters described in the WiX3::XML::Directory->new() method documentation.


    $dir_obj = $dir_obj->add_directories_id(
                'Perl',    'perl',
                'License', 'licenses',
    #   id          directory

The add_directories_id method adds multiple directories objects as children of the current object.

Each directory object to be created is specified by the id to be used and the directory to be referred to, which is a subdirectory of the directory referred to by the current tag.

It returns the object that is being operated on, so that methods can be chained.


get_directory_object returns the Perl::Dist::WiX::Tag::Directory object with the id that was passed in as the only parameter, as long as it is a child tag of this tag, or a grandchild/great-grandchild/etc. of this tag.

If you pass the ID of THIS object in, it gets returned.

An undefined value is returned if no object with that ID could be found.


        my $perl_bin_directory_tag = $directory->search_dir(
                path_to_find => 'C:\strawberry\perl\bin',
                descend => 1,
                exact => 0,

Attempts to find the path_to_find in this directory tag (and in the children of this tag, if descend is true.)

If exact is false, this method is allowed to return an object that defines a subpath of the path_to_find.

path_to_find is required. descend defaults to true, and exact defaults to false.


Bugs should be reported via the CPAN bug tracker at

For other issues, contact the author.


Curtis Jewell <>




Copyright 2009 - 2010 Curtis Jewell.

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

The full text of the license can be found in the LICENSE file included with this module.