MiscUtils(3)          User Contributed Perl Documentation         MiscUtils(3)



NNAAMMEE
      MiscUtils - Miscellanous Utitlies. Provided in hopes that you will add
      your own functions.

SSYYNNOOPPSSIISS
          use MiscUtils;

          print rindent(4).'I am 4 tabs over!';

          mkdirs('/xtra/shared/mp3s/by/author/m/mo/mono/life_in_mono.mp3');

          # hypothetical - see discussion below
          this_useful_function_I_wrote_and_use_constantly ('I added it in myself');

DDEESSCCRRIIPPTTIIOONN
      MiscUtils is a collection of utility functions I found myself using in
      alot of my scripts. Then I thought it would be better to just throw
      them all into one huge unrelated, incoherant module. Then I thought it
      would be good to share with the world. Then I thought the world would
      benifit even more if they threw in thier own functions they constantly
      use.

      DDIISSCCLLAAIIMMEERR

      This module is mostly provided as a means of making quick hacks
      quicker. For a serious or distributed script you should not rely on or
      require anyone to have this module. To get the functions out of this
      module into your serious or distributed scripts, just cut and paste
      directly into your script or module(s). The module is nothing special,
      so don't be afraid to hack it up.

PPRROOVVIIDDEEDD FFUUNNCCTTIIOONNSS
      rriinnddeenntt

      Returns x number of tabs.

      Arguments

      1   The number of spaces to indent.

      Returns: (string) argument number of tabs

      Example:
          print _r_i_n_d_e_n_t(4).'I am 4 tabs over!';

      iinnddeenntt

      Prints onto a filehandle or stdout x number of tabs.

      Arguments

      1   The number of spaces to indent.

      2   A reference to a filehandle [optional] [default:STDOUT]

      Returns: nothing

      Example:
          _i_n_d_e_n_t(4);
          print "I am 4 tabs over!\n";

      mmkkddiirrss

      Makes the directories specified in the path.

      Arguments

      1   The full file/path name to be made if it does not exist.

      Returns: 1 upon success, 0 upon failure.

      Example:
          if
      (mkdirs('/xtra/shared/mp3s/by/author/m/mo/mono/life_in_mono.mp3')) {
              # /xtra/shared/mp3s/by/author/m/mo/mono/ will definitaly exist.
          }

      sswwaapp__ddiirrss

      Simplify relative path, path blending.

      Arguments

      1   The full file/path name

      2   The first part of the path that will be swapped.

      3   The first part of the path that you want to swap with.

      Returns: The new path.

      Example:
          print swap_dirs('/publicwww/oldsite/index.php', '/publicwww/',
      'http://lackluster.tzo.com:1024/');
          # prints http://lackluster.tzo.com:1024/oldsite/index.php

      ddeebbuugg

      Debug (pretty print) array ref, hash ref, or scalar. Not as cool as
      Data::Dumper

      Arguments

      1   The item to be debugged. Arrays and Hashes must be in reference
          form.

      2   Variable/Output name.

      3   Indentation level [optional|internal]

      Returns: nothing

      Example:
          my @words = qw(a ab abc abcd);
          debug (\@words, 'my words');

      ffiilltteerr__tteexxtt

      Transforms non-XML-data elements to useful stoarge.

      Arguments

      1   Text to transform.

      Returns: Transformed Text.

      Example:
          print $some_var_with_smart_quotes_and_punctuation;

BBUUGGSS
      Uh.... are you sure they aren't yours? Let me know if you find any.

AAUUTTHHOORR
      BPrudent (Brandon Prudent)

      email: [email protected]



perl v5.8.0                       2003-11-02                      MiscUtils(3)