File-BaseDir

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

NAME

    File::BaseDir - Use the Freedesktop.org base directory specification

VERSION

    version 0.09

SYNOPSIS

     use File::BaseDir qw/xdg_data_files/;
     for ( xdg_data_files('mime/globs') ) {
       # do something
     }

DESCRIPTION

    This module can be used to find directories and files as specified by
    the Freedesktop.org Base Directory Specification. This specifications
    gives a mechanism to locate directories for configuration, application
    data and cache data. It is suggested that desktop applications for e.g.
    the GNOME, KDE or Xfce platforms follow this layout. However, the same
    layout can just as well be used for non-GUI applications.

    This module forked from File::MimeInfo.

    This module follows version 0.6 of BaseDir specification.

CONSTRUCTOR

 new

     my $bd = File::BaseDir->new;

    Simple constructor to allow calling functions as object oriented
    methods.

FUNCTIONS

    None of these are exported by default, but all functions can be
    exported by request. Also the groups :lookup and :vars are defined. The
    :vars group contains all the routines with a xdg_ prefix. The :lookup
    group contains the routines to locate files and directories.

 data_home

     my $path = data_home(@path);
     my $path = $bd->data_home(@path);

    Takes a list of file path elements and returns a new path by appending
    them to the data home directory. The new path does not need to exist.
    Use this when writing user specific application data.

    Example:

     # data_home is: /home/USER/.local/share
     $path = $bd->data_home('Foo', 'Bar', 'Baz');
     # returns: /home/USER/.local/share/Foo/Bar/Baz

 data_dirs

     # :lookup
     my $dir = data_dirs(@path);
     my $dir = $bd->data_dirs(@path);
     my @dirs = data_dirs(@path);
     my @dirs = $bd->data_dirs(@path);

    Looks for directories specified by @path in the data home and other
    data directories. Returns (possibly empty) list of readable
    directories. In scalar context only the first directory found is
    returned. Use this to lookup application data.

 data_files

     # :lookup
     my $file = data_files(@path);
     my $file = $bd->data_files(@path);
     my @files = data_files(@path);
     my @files = $bd->data_files(@path);

    Looks for files specified by @path in the data home and other data



( run in 0.780 second using v1.01-cache-2.11-cpan-39bf76dae61 )