NAME
SimpleMock::Util - Utility functions for SimpleMock
DESCRIPTION
This module provides utility functions for the SimpleMock framework.
FUNCTIONS
All of these functions are exportable on request.
all_file_subs
my @subs = SimpleMock::Util::all_file_subs($file);
Returns a list of all subroutine names defined in the given file. The file must already be loaded and in %INC.
generate_args_sha
my $sha = SimpleMock::Util::generate_args_sha($args);
Generates a SHA-256 hash of the provided arguments. If no arguments are provided, it returns '_default'.
This is used to create a unique identifier for the arguments passed to a mock function so that we can retrieve mocks via a lookup hash.
namespace_from_file
my $namespace = SimpleMock::Util::namespace_from_file($file);
Converts a file path to a namespace. For example, `Foo/Bar.pm` becomes `Foo::Bar`.
file_from_namespace
my $file = SimpleMock::Util::file_from_namespace($namespace);
Converts a namespace back to a file path. For example, `Foo::Bar` becomes `Foo/Bar.pm`.