DocSet::Util - Commonly used functions
use DocSet::Util; copy_file($src, $dst); write_file($filename, $content); create_dir($path); read_file($filename, $r_content); read_file_paras($filename, $ra_content); my $ext = filename_ext($filename); my $date = get_date(); my $timestamp = get_timestamp(); my $uri = path2uri($os_path); require_package($package); my $output = proc_tmpl($tmpl_root, $tmpl_file, $mode, $vars); banner($string); my $sub_ref = build_matchmany_sub($ra_regex); dumper($ref); confess($string); note($string); my $exec_path = which('perldoc');
All the functions are exported by default.
META: to be completed (see SYNOPSIS meanwhile)
Since the patterns are compiled by insertion into m//, make sure that any
/ are escaped. Be careful with using quotemeta() for this, since you don't want to espace special regex char, e.g.
my $exec_path = which('perldoc');
a portable function to search for executables on the system.
Accepts a single argument which is the name of the executable to search for. Returns the full path to the executable if found, an empty string otherwise.
Parts of the implementation are borrowed from modperl-2.0/lib/Apache/Build.pm and modified to take into an account Win32's
PATHEXT environment variable or the hardcoded list of known executable extensions for Win9x which doesn't have this variable.
Stas Bekman <stas (at) stason.org>