OSSP CVS Repository

ossp - Difference in ossp-pkg/var/var.pod versions 1.22 and 1.23
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [History

ossp-pkg/var/var.pod 1.22 -> 1.23

--- var.pod      2002/02/28 08:48:44     1.22
+++ var.pod      2002/02/28 11:40:46     1.23
@@ -182,6 +182,10 @@
 (C<0>,... for first variant and I<start>,...,I<end> with stepping
 I<step> for second variant). I<index> of array variable lookups. For
 I<start>, I<step> and I<end>, full arithmetic expressions are allowed.
+This loop construct can be nested, too. In this case an inner loop is
+fully repeated for each iteration of the outer loop. Additionally,
+arithmetic expressions are supported in both I<start>, I<step>, I<end>
+and I<index> parts of variable constructs in I<body>.
 
 =back
 
@@ -554,7 +558,7 @@
 might have introduced now quoted pairs into the output text, which you
 need to expand to get the desired effect.
 
-=head1 EXAMPLE
+=head1 EXAMPLE (DEVELOPER)
 
 The following simple but complete program illustrates the full usage
 of B<OSSP var>. It accepts a single argument on the command line
@@ -661,6 +665,35 @@
 and use it to play with the various B<OSSP var> variable expansion
 possibilities.
 
+=head1 EXAMPLE (USER)
+
+The following are a few sample use cases of B<OSSP var>
+variable expansions. They all assume the default syntax
+configuration and the following variable definitions: C<$foo=foo>
+(a scalar), C<$bar=E<lt>bar1,bar2,bar3,E<gt>> (an array),
+C<$baz=E<lt>baz1,baz2,baz3,E<gt>> (another array), C<$quux=quux>
+(another scalar), C<$name=E<lt>foo,bar,baz,quuxE<gt>> (another scalar)
+and C<$empty=""> (another scalar).
+
+ Input                         Output
+ ----------------------------- --------------
+ $foo                          foo
+ ${foo}                        foo
+ ${bar[0]}                     bar1
+ ${${name[1]}[0]}              bar1
+ ${foo:u:y/O/U/:s/(.*)/<\1>/}  <FUU>
+ ${foo:u:y/O/U/:s/(.*)/<\1>/}  <FUU>
+ ${empty:-foo}                 foo
+ ${foo:+yes}${foo:*no}         yes
+ ${empty:+yes}${empty:*no}     no
+ ${foo:p/6/./l}                foo...
+ ${foo:p/6/./r}                ...foo
+ [${bar[#]}${bar[#+1]:+,}]     bar1,bar2,bar3
+ [${bar[#-1]:+,}${bar[#]}]     bar1,bar2,bar3
+ [${bar[#]}]{2,1,3}            bar2bar3
+ [${bar[#]}]{1,2,3}            bar1bar3
+ [${foo[#]}[${bar[#]}]]{1,,2}  foo1bar1bar2bar3foo2bar1bar2bar3
+
 =head1 SEE ALSO
 
 pcre(3), regex(7), B<OSSP val> (Value Access).

CVSTrac 2.0.1