Stas Bekman

NAME

DocSet::Util - Commonly used functions

SYNOPSIS

  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');

DESCRIPTION

All the functions are exported by default.

METHODS

META: to be completed (see SYNOPSIS meanwhile)

  • copy_file

  • write_file

  • create_dir

  • read_file

  • read_file_paras

  • filename_ext

  • path2uri

  • get_date

  • get_timestamp

  • require_package

  • proc_tmpl

  • banner

  • build_matchmany_sub

    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. ^, $, etc.

  • which

      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.

  • dumper

  • confess

  • cluck

  • carp

  • note

AUTHORS

Stas Bekman <stas (at) stason.org>