File::DataClass::Functions - Common utility functions
use File::DataClass::Functions qw( list of functions to import );
Common functions used in this distribution
ensure_class_loaded( $some_class, \%options );
Require the requested class, throw an error if it doesn't load
$map = extension_map; # Accessor $value = extension_map $class, $extensions; # Mutator
An accessor / mutator for the stateful hash reference that maps filename extensions onto storage classes. Calling the accessor populates the extension map on first use. Storage subclasses call the mutator to register the extensions that they handle. If the $extensions parameter is an array reference then the storage subclass can "claim ownership" of more than one extension in a single call
$extensions
$single_char = first_char $some_string;
Returns the first character of $string
$string
$bool = is_arrayref $scalar_variable
Tests to see if the scalar variable is an array reference
$bool = is_coderef $scalar_variable
Tests to see if the scalar variable is a code reference
$bool = is_hashref $scalar_variable
Tests to see if the scalar variable is a hash reference
$bool = is_member 'test_value', qw( a_value test_value b_value );
Tests to see if the first parameter is present in the list of remaining parameters
$bool = is_mswin;
Returns true if running on mswin32 false otherwise
mswin32
$bool = is_ntfs;
Returns true if running on ntfs false otherwise
ntfs
$bool = is_stale $data, $cache_mtime, $path_mtime;
Returns true if there is no data or the cache mtime is older than the path mtime. Always returns true on NTFS
NTFS
$array_ref_of_class_name = map_extension2class $extension;
Maps a filename extensions to a list of storage classes
$dest = merge_attributes $dest, $src, $attr_list_ref;
Merges attribute hashes. The $dest hash is updated and returned. The $dest hash values take precedence over the $src hash values. The $src hash may be an object in which case its accessor methods are called
$dest
$src
merge_file_data $existing, $new;
Uses Hash::Merge to merge data from the new hash ref in with the existing
$bool = merge_for_update $dest_ref, $src, $filter;
Only merge the attributes from $src to $dest_ref if the $filter code reference evaluates to true when called with a candidate value. Return true if the destination reference was updated
$dest_ref
$filter
$storage_classname = qualify_storage_class $class_suffix;
Prepends the STORAGE_BASE classname to the supplied suffix
STORAGE_BASE
@list_of_extension_names = supported_extensions;
Returns a list of supported filename extensions
$thread_id = thread_id;
Returns the current thread id or zero if the the threads module has not been loaded
throw error => 'error_key', args => [ 'error_arg' ];
Expose throw. The exception class can be changed by calling the Exception_Class class method
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Larry Wall - For the Perl programming language
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2015 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install File::DataClass, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::DataClass
CPAN shell
perl -MCPAN -e shell install File::DataClass
For more information on module installation, please visit the detailed CPAN module installation guide.