The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

File::DataClass::Functions - Common functions used in this distribution

Synopsis

   use File::DataClass::Functions qw(list of functions to import);

Description

Common functions used in this distribution

Subroutines/Methods

ensure_class_loaded

   ensure_class_loaded( $some_class, \%options );

Require the requested class, throw an error if it doesn't load

extension_map

   $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

first_char

   $single_char = first_char $some_string;

Returns the first character of $string

is_arrayref

   $bool = is_arrayref $scalar_variable

Tests to see if the scalar variable is an array ref

is_coderef

   $bool = is_coderef $scalar_variable

Tests to see if the scalar variable is a code ref

is_hashref

   $bool = is_hashref $scalar_variable

Tests to see if the scalar variable is a hash ref

is_member

   $bool = is_member q(test_value), qw(a_value test_value b_value);

Tests to see if the first parameter is present in the list of remaining parameters

is_stale

   $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

map_extension2class

   $array_ref_of_class_name = map_extension2class $extension;

Maps a filename extensions to a storage classes

merge_attributes

   $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

merge_file_data

   merge_file_data $existing, $new;

Uses Hash::Merge to merge data from the new hash ref in with the existing

qualify_storage_class

   $storage_classname = qualify_storage_class $class_suffix;

Prepends the STORAGE_BASE classname to the supplied suffix

supported_extensions

   @list_of_extension_names = supported_extensions;

Returns a list of supported filename extensions

thread_id

   $thread_id = thread_id;

Returns the current thread id or zero if the the threads module has not been loaded

throw

   throw error => q(error_key), args => [ q(error_arg) ];

Expose "throw" in CatalystX::Usul::Exception. CX::Usul::Functions has a class attribute Exception_Class which can be set via a call to set_inherited

Configuration and Environment

None

Diagnostics

None

Dependencies

Exporter
Hash::Merge
Module::Runtime
Try::Tiny
Unexpected

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Acknowledgements

Larry Wall - For the Perl programming language

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2014 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