RFC: New module 'Module::Bundled::Files'



I've written a module, tentatively named Module::Bundled::Files. A
section of the POD docs is included to (attempt) to explain it's
purpose. It was inspired by the __tt_template_name() function in
CGI::Application::Plugin::TT.

I'm looking for any comments, particularly if anyone can suggest a
better name for the module.

Darcs repo and tar.gz is available at
http://kemitix.net/repos/module-bundled-files/

Thanks,
Paul

NAME
Module::Bundled::Files - Access files bundled with Module

VERSION
Version 0.01

SYNOPSIS
Access files installed with your module without needing to
specify an
install location on the target filesystem.

Setup

In Build.PL:

my $build = new Module::Build(...);
map{$build->add_build_element($_);}
qw{txt html tmpl};
# installs all .txt, .html and .tmpl files in the lib/ tree

Object-Oriented Interface

use base qw{Module::Bundled::Files};

if($self->mbf_exists('data.txt')){...}

my $filename = $self->mbf_path('data.txt');
open my $fh, '<', $filename or die $@;

my $fh = $self->mbf_open('data.txt');
while(<$fh>)
{
...
}

my $data = $self->mbf_read('data.txt');

Non-Object-Oriented Interface

use Module::Bundled::Files qw{:all};
my $object = new Other::Object;

if(mbf_exists($other,'otherfile.txt')){...}

my $filename = mbf_path($object,'otherfile.txt');

open my $fh, '<', $filename or die $@;

my $fh = mbf_open($object,'otherfile.txt');
while(<$fh>)
{
...
}

my $data = mbf_read($object,'otherfile.txt');

DESCRIPTION
This module provides an simple method of accessing files that
need to
be bundled with a module.

For example, a module My::Module, which needs to access a
seperate file
data.txt.

In your development directory you would place your data.txt in
your
lib/My/Module/ directory.

lib/
My/
Module.pm
Module/
data.txt

Using add_build_element(...) in your Build.PL file allows the
data.txt
file to be installed in the same relative location.

The file(s) can then be accessed using the mbf_* functions
provided by
this module.

.



Relevant Pages

  • Re: What parameter VS.Net passes to "netcf.all.wce4.armv4.cab" fil
    ... Much thanks Peter, ... The install will then be virtually silent (will ... >> VS.Net passes to this .cab file to prevent install location option. ...
    (microsoft.public.pocketpc.developer)
  • Re: package upgrade
    ... default install location.. ... such files during upgrade. ... then HP delivers the new configurations ...
    (comp.sys.hp.hpux)
  • Re: Hard drive space ?
    ... The 'Prgogram Files' folder has special significance to Windows. ... drive will fill up as you install more programs. ... you must select the install location manually while ... system settings in the registry and those registry settings will not be ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: Replacing XP Notepad under SP2?
    ... >> folders and to search hidden files and folders and subfolders. ... Maybe from the install location, if you happen to havedone the install from ... SFC 'knows' about the originating location and would ...
    (microsoft.public.windowsxp.customize)
  • Re: What parameter VS.Net passes to "netcf.all.wce4.armv4.cab" file to
    ... Peter Foot ... > When I manually execute "netcf.all.wce4.armv4.cab" file on WinCE.Net ... > file there is no dialog box to ask for location to install. ... > VS.Net passes to this .cab file to prevent install location option. ...
    (microsoft.public.pocketpc.developer)