NAME

Debug::ShowStuff::ShowVar - shortcuts for Debug::ShowStuff

SYNOPSIS

use Debug::ShowStuff ':all';
use Debug::ShowStuff::ShowVar;

# output the name of the variable followed by the value of the variable
showvar $myvar;

## outputs this line with println

##- outputs this line with prinhr

##i indents using indent

DESCRIPTION

Debug::ShowStuff::ShowVar is a preprocessor that provides shortcuts for a few Debug::ShowStuff commands. This module modifies your code so that some simple commands are translated into longer Debug::ShowStuff commands.

Debug::ShowStuff::ShowVar is a filter, so it requires very simple syntax for it to understand your code. Don't get fancy, this module won't understand it.

Commands

showvar

showvar translates a line into a println that shows the name of a variable and its value. So, for example, this line:

showvar $myvar;

translates into this line

println '$myvar: ', $myvar;

##

A double hash followed by text gets translated into a println statement of that text. So, for example, this code:

## my text

is translated into

println 'my text';

Note that there must be exactly two hash marks. Three or more will not be translated.

## is handy for when you don't want to repeat yourself documenting code. For examle, this redundant code:

# open a file
println 'open a file';
open_file();

can be written more concisely as

## open a file
open_file();

##- and ##=

##- and ##= work like ##, except that a printhr statement is created instead of println. ##- creates a horizontal rule using dashes (-). ##= creates a horizontal rule using equals (=).

##i

##i translates into an indent command, including a variable to hold the lexical indent variable. For example, suppose you want to output a value with println, then indent the rest of the scope. With just Debug::ShowStuff commands you would do this:

println 'begin';
my $indent = indent();

Instead, you can put ##i at the beginning of the first line and get the indent. So the following line accomplishes the same thing as above:

println 'begin'; ##i

TERMS AND CONDITIONS

Copyright (c) 2013 by Miko O'Sullivan. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This software comes with NO WARRANTY of any kind.

AUTHORS

Miko O'Sullivan miko@idocs.com

VERSION

Version 0.10 March 17, 2013

Initial public release.

Version 0.11 March 19, 2013

Small but important fix to documentation.