View on
MetaCPAN
Andy Wardley > Badger > Badger::Workplace

Download:
Badger-0.12.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  4
Open  2
View/Report Bugs
Source  

NAME ^

Badger::Workplace - a place to do work

DESCRIPTION ^

This is a very simple base class for modules that operate on or around a particular filesystem directory. See Badger::Config::Filesystem for an example of it in us.

CONFIGURATION OPTIONS ^

root / dir / directory

Any of root, dir or directory can be provided to specify the root directory of the workplace.

urn

This option can be set to define a Universal Resource Name (URN) for the workplace for reference purposes. If undefined it defaults to the name of the root directory.

uri

This option can be set to define a Universal Resource Identifier (URN) for the workplace for reference purposes. If undefined it defaults to the name of the value of urn.

mkdir

The object constructor will fail if the root directory specified via root (or dir or directory) does not exist. Alternately, set the mkdir option to any true value and the directory will be created automatically.

METHODS ^

dir($name) / directory($name)

Returns a Badger::Filesystem::Directory object for a named sub-directory relative to the workplace root.

When called with any arguments it returns a Badger::Filesystem::Directory object for the workplace root directory.

file($name)

Returns a Badger::Filesystem::File object for a named files relative to the workplace root.

uri($path)

When called without any arguments this method returns the base URI for the workspace.

    print $workspace->uri;              # e.g. foo

When called with a relative URI path as an argument, it returns the URI resolved relative to the project base URI.

    print $workspace->uri('bar');       # e.g. foo/bar

AUTHOR ^

Andy Wardley http://wardley.org/

COPYRIGHT ^

Copyright (C) 2008-2014 Andy Wardley. All Rights Reserved.

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

syntax highlighting: