Module-Generic

 view release on metacpan or  search on metacpan

CHANGES  view on Meta::CPAN

      Module::Generic and Module::Generic::File::Magic trigger XSLoader on the same .so.
    - Fixed a latent bug in the pure-Perl implementations of _is_array, _is_code,
      _is_glob, _is_integer, _is_number, _is_scalar: the guard
      'return(0) if( scalar( @_ < 2 ) )' was incorrectly testing the boolean result of
      the comparison rather than the argument count. Corrected to
      'return(0) if( scalar( @_ ) < 2 )'.
    - Fixed _is_overloaded, _is_object to return 0 (explicit false integer) instead of
      undef in all negative cases, in line with the boolean contract of the _is_* family.
    - Fixed _is_code to use Scalar::Util::reftype() instead of ref() so that blessed
      coderefs are correctly recognised (ref() returns the class name, not 'CODE', for
      blessed coderefs).
    - Added unit test t/33.xs_methods.t covering all twelve XS-accelerated methods,
      verifying correctness of edge cases including undef arguments, blessed references,
      tied scalars, strict mode for _is_hash, and element mutability for _get_args_as_array.
    - Fixed GV_ADD | GV_ADDMULTI in _set_backend() within Generic.xs to suppress the
      spurious 'Name used only once: possible typo' warning emitted by DynaLoader for
      $Module::Generic::File::Magic::BACKEND.

v1.2.5 2026-03-22T22:04:02+0900
    - Corrected Module::Generic::Number to return a number to JSON
    - Corrected DESTROY in Module::Generic::Scalar::IO

v1.2.4 2026-03-14T08:53:46+0900
    - Fixed SEGV on exit in threaded Perl by protecting Module::Generic::Global END block
      and Module::Generic DESTROY against use-after-free on shared data
    - Fixed pack() format in Module::Generic::File::IO::locked() to use 32-bit integers
      on 32-bit systems (e.g. NetBSD i386), replacing non-portable 'q'
    - Fixed concurrent file locking test in t/10.file.t to pass a timeout so threads wait
      for the lock instead of failing immediately
    - Fixed t/32.file_magic.t to resolve symlinks on /bin/ls before MIME detection
    - Added skip in t/31.global.t for Perl compiled with USE_LONG_DOUBLE + useithreads
      where shared data structures cause unavoidable crashes
    - Improved documentation for Module::Generic::File::Magic

v1.2.3 2026-03-12T23:40:42+0900
    - Release v1.2.3 with minor documentation correction

v1.2.2 2026-03-10T19:06:12+0900
    - Minor improvement in as_string in Module::Generic::HeaderValue, now accepting
      an option to force the double quotes on a token name.
    - Fixed Module::Generic::Global::set() max_size eviction triggering one
      entry too early when Perl is compiled with useithreads, due to a key
      being pre-inserted into the repository before the size check

v1.2.1 2026-03-09T21:58:36+0900
    - Corrected serialisation for Module::Generic::DateTime
    - Added Module::Generic::File::Magic, a new libmagic-based MIME type detector
      with a pure-Perl JSON fallback, replacing the use of File::MMagic
    - Improved Module::Generic::File::Magic::from_buffer() to fall back to a
      temporary file when magic_buffer() returns a generic type, working around
      inconsistent behaviour across libmagic versions (5.39, 5.46)
    - Updated Module::Generic::Finfo::mime_type() to use Module::Generic::File::Magic
    - Fixed read-only value error in Module::Generic::Global on Perl 5.28
    - Fixed off-by-one in Module::Generic::Global max_size eviction (>= vs >)

v1.2.0 2026-03-08T22:47:58+0900
    - Added new module Module::Generic::File::Magic providing file type and MIME type detection
      through a three-level backend cascade: an XS binding to libmagic (loaded at runtime via
      dlopen, requiring only the libmagic1 runtime package, so no libmagic-dev at build time),
      a pure-Perl JSON backend using a bundled magic signature database derived from the
      freedesktop.org shared-mime-info XML, and a final fallback to the file(1) subprocess.
      The active backend is available via $Module::Generic::File::Magic::BACKEND and the
      backend() method. All MAGIC_* flag constants are exported via the :flags tag.
    - Added Generic.xs to the distribution to provide the XS backend for
      Module::Generic::File::Magic. The XS MODULE is declared as Module::Generic so that
      XSLoader resolves Generic.so correctly; PACKAGE = Module::Generic::File::Magic ensures
      all XS functions are installed in the correct namespace.
    - Added lib/Module/Generic/File/magic.json: a compact JSON magic signature database
      generated from the upstream freedesktop.org shared-mime-info XML (630 entries, covering
      binary signatures with offset ranges, endianness-aware integer types, AND sub-matches,
      and bitmask support).
    - Added scripts/gen_magic_json.pl: a generator script to regenerate magic.json from an
      updated freedesktop.org XML source. Supports XML::LibXML, XML::Twig, and XML::Parser.
      Included in the distribution for reference but not installed by make install.
    - Added unit test t/32.file_magic.t for Module::Generic::File::Magic.
    - Updated Module::Generic::Finfo to use Module::Generic::File::Magic for mime_type()
      detection, replacing the previous File::MMagic::XS / File::MMagic fallback chain.
    - Updated Module::Generic::File to add the alias method 'stringify' to 'load_utf8'
    - Added the option 'pretty' to the method 'unload_perl' in Module::Generic::File
    - Improved Module::Generic::Global by allowing a new option 'on_get' to set a callback upon deserialisation
    - Improved Module::Generic::File, and especially the subroutine 'tmpfile'
    - Improved cleanup in Module::Generic::Global

v1.1.3 2025-10-24T21:08:39+0900
    - Improved method colour_parse(), and related unit tests
    - Added methods force_tty() to affect colour messaging output, and colour_max_depth() used in colour_parse() for coloured debugging output.

v1.1.2 2025-10-19T16:37:01+0900
    - Corrected method error() to also check for non-empty . Gitlab #5

v1.1.1 2025-10-12T07:53:51+0900
    - Correcting method _load_class to respect the 'no_import' option.
    - Minor update in the documentation for Module::Generic::Global

v1.1.0 2025-09-30T15:30:30+0900
    - Improved the methods checksum_md5, checksum_sha256, and checksum_sha512 in Module::Generic::File

v1.0.6 2025-09-10T11:23:50+0900
    - Added methods parents, splitdir, and splitpath in Module::Generic::File
    - Corrected a faulty unit test in 27.dynamic.t
    - Added dynamic support methods _is_version and _looks_like_path
    - Improved a bit the documentation for Module::Generic
    - Corrected the test suite for Module::Generic::Dynamic (Gitlab issue #14 brought by Slaven Rezić)
    - Substantially enhanced the module Module::Generic::Dynamic
    - Improved documentation for Module::Generic::Dynamic

v1.0.5 2025-08-31T18:43:48+0900
    - Improved _set_get_hash_as_mix_object, and corrected minor issue in Module::Generic::Dynamic

v1.0.4 2025-08-30T17:46:06+0900
    - Corrected the freeze method of Module::Generic::Hash

v1.0.3 2025-08-30T14:29:05+0900
    - Corrected a minor oversight in Module::Generic::Null new
    - Corrected a minor error in documentation of Module::Generic::Array for 'callback'
    - Improved methods '_set_get_array_as_object', '_set_get_object_array', and '_set_get_object_array_object' in Module::Generic
    - Added methods 'has_callback', and 'get_callback' in Module::Generic::Array
    - Corrected method 'close' in Module::Generic::File to only apply to file for fileno.
    - Improved the method 'mime_type' in Module::Generic::Finfo

v1.0.2 2025-07-30T08:35:32+0900
    - Improved method _set_get_object_without_init in Module::Generic
    - Added the option of specifying a format to _set_get_datetime, and improved the method
    - Improved _parse_timestamp in Module::Generic
    - Corrected a minor bug in callbacks for _set_get_array_as_object in Module::Generic
    - Improved _set_get_boolean to allow specifying a boolean class
    - Enhanced _set_get_number with standard optional constraints
    - Added the method 'md5' (with an alias 'md5_checksum', and 'md5_hex') in Module::Generic::Hash
    - Improved callbacks handling in _set_get* methods
    - Improved Module::Generic::File::Cache by using Module::Generic::Global
    - Improved methods open, lock, and unlock in Module::Generic::File
    - Improved module Module::Generic::File::IO, added method locked and lock_state
    - Corrected a bug in method _set_get_scalar_as_object in Module::Generic



( run in 0.513 second using v1.01-cache-2.11-cpan-13bb782fe5a )