Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kentnl/module-path-simplify
Simplify absolute paths for pretty-printing
https://github.com/kentnl/module-path-simplify
Last synced: 4 days ago
JSON representation
Simplify absolute paths for pretty-printing
- Host: GitHub
- URL: https://github.com/kentnl/module-path-simplify
- Owner: kentnl
- License: other
- Created: 2015-04-14T04:02:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-04-14T10:57:47.000Z (over 9 years ago)
- Last Synced: 2023-04-16T05:55:56.960Z (over 1 year ago)
- Language: Perl
- Size: 223 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.mkdn
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
# NAME
Module::Path::Simplify - Simplify absolute paths for pretty-printing.
# VERSION
version 0.001000
# DESCRIPTION
This module aids in simplifying paths to modules you may already have had lying around,
for instance, like in `%INC`, and aids in compressing them into a format more easily skimmed,
for use in diagnostic reporting such as stack-traces, where legibility of the trace is more important
to you than being able to use path `URIs` verbatim.# USAGE
use Module::Path::Simplify;
my $simplifier = Module::Path::Simplify->new();
print $simplifier->simplify( $INC{'Module/Path/Simplify.pm'} )
# This may output something like $INC[0]/Module/Path/Simplify.pm
# or even ${VP} or ${SP}, depending on where you installed it.print $simplifier->pp_aliases;
# This will emit a key => value table of all the aliases used so far
# by this instance, expanding the display setting of the alias to the path matched.
#
# In cases where the aliases are different to their display values for better compressability
# the raw internal alias names will be displayed in parentheses at the end of the line.# METHODS
## `new`
Create a `simplifier` object.
Normally, `new` captures the state of `@INC` at its creation time.
This can be disabled to use a per-resolution dynamic `@INC` via
->new( inc_dynamic => 1 );
Additionally, `@INC` can be overridden with a custom list via
->new( inc => [ @INC ] );
[`inc_dynamic`](#inc_dynamic) and [`inc`](#inc) don't work together, and setting `inc_dynamic`
will cause `inc` to be ignored.## `simplify`
Return a simplified version of a path, or the path itself
if there are no simplifications availableprint $simpl->simplify( $INC{'Test/More.pm'} )
## `aliases`
Returns the internal alias tracking object.
## `pp_aliases`
Return a string detailing the used simplification aliases
and where they map to. ( And possibly their internal identifier )## `inc_dynamic`
Returns whether or not this simplifier is using a dynamic `@INC`.
## `inc`
Returns the snapshot `@INC` in use when not using `inc_dynamic`
# AUTHOR
Kent Fredric
# COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Kent Fredric .
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.