1Debug::ShowStuff::ShowVUasre(r3)Contributed Perl DocumenDteabtuigo:n:ShowStuff::ShowVar(3)
2
3
4

NAME

6       Debug::ShowStuff::ShowVar - shortcuts for Debug::ShowStuff
7

SYNOPSIS

9        use Debug::ShowStuff ':all';
10        use Debug::ShowStuff::ShowVar;
11
12        # output the name of the variable followed by the value of the variable
13        showvar $myvar;
14
15        ## outputs this line with println
16
17        ##- outputs this line with prinhr
18
19        ##i indents using indent
20

DESCRIPTION

22       Debug::ShowStuff::ShowVar is a preprocessor that provides shortcuts for
23       a few Debug::ShowStuff commands.  This module modifies your code so
24       that some simple commands are translated into longer Debug::ShowStuff
25       commands.
26
27       Debug::ShowStuff::ShowVar is a filter, so it requires very simple
28       syntax for it to understand your code.  Don't get fancy, this module
29       won't understand it.
30

Commands

32   showvar
33       showvar translates a line into a println that shows the name of a
34       variable and its value.  So, for example, this line:
35
36        showvar $myvar;
37
38       translates into this line
39
40        println '$myvar: ', $myvar;
41
42   ##
43       A double hash followed by text gets translated into a println statement
44       of that text.  So, for example, this code:
45
46        ## my text
47
48       is translated into
49
50        println 'my text';
51
52       Note that there must be exactly two hash marks.  Three or more will not
53       be translated.
54
55       ## is handy for when you don't want to repeat yourself documenting
56       code.  For examle, this redundant code:
57
58        # open a file
59        println 'open a file';
60        open_file();
61
62       can be written more concisely as
63
64        ## open a file
65        open_file();
66
67   ##- and ##=
68       ##- and ##= work like ##, except that a printhr statement is created
69       instead of println.  ##- creates a horizontal rule using dashes (-).
70       ##= creates a horizontal rule using equals (=).
71
72   ##i
73       ##i translates into an indent command, including a variable to hold the
74       lexical indent variable.  For example, suppose you want to output a
75       value with println, then indent the rest of the scope.  With just
76       Debug::ShowStuff commands you would do this:
77
78        println 'begin';
79        my $indent = indent();
80
81       Instead, you can put ##i at the beginning of the first line and get the
82       indent.  So the following line accomplishes the same thing as above:
83
84        println 'begin'; ##i
85

TERMS AND CONDITIONS

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

AUTHORS

93       Miko O'Sullivan miko@idocs.com
94

VERSION

96       Version 0.10    March 17, 2013
97           Initial public release.
98
99       Version 0.11    March 19, 2013
100           Small but important fix to documentation.
101
102
103
104perl v5.32.0                      2020-07-28      Debug::ShowStuff::ShowVar(3)
Impressum