X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-CGI-Ex;a=blobdiff_plain;f=lib%2FCGI%2FEx%2FTemplate.pod;h=9d2c3c673b93b633b0553eccfeaac294ac80ba76;hp=83545c41b1845b080255d7bc0e79cefb81b029a0;hb=48c4840be1f154e262de2c161cb86dc5000dfe47;hpb=d710d6cd21be21c0ab2df3566c2bd61d9015cac6 diff --git a/lib/CGI/Ex/Template.pod b/lib/CGI/Ex/Template.pod index 83545c4..9d2c3c6 100644 --- a/lib/CGI/Ex/Template.pod +++ b/lib/CGI/Ex/Template.pod @@ -272,11 +272,11 @@ to virtual methods. | Hash.keys | List.join(", ") %] # = a, b -=item Added "as" scalar, list, and hash virtual methods. +=item Added "fmt" scalar, list, and hash virtual methods. - [% list.as("%s", ", ") %] + [% list.fmt("%s", ", ") %] - [% hash.as("%s => %s", "\n") %] + [% hash.fmt("%s => %s", "\n") %] =item Whitespace is less meaningful. (TT3) @@ -306,13 +306,13 @@ to virtual methods. [% a = 1.2e-20 %] - [% 123.as('%.3e') %] # = 1.230e+02 + [% 123.fmt('%.3e') %] # = 1.230e+02 =item Allow for hexidecimal input. (TT3) [% a = 0xff0000 %][% a %] # = 16711680 - [% a = 0xff2 / 0xd; a.as('%x') %] # = 13a + [% a = 0xff2 / 0xd; a.fmt('%x') %] # = 13a =item FOREACH variables can be nested. @@ -628,13 +628,13 @@ Scientific notation is supported. [% 314159e-5 + 0 %] Prints 3.14159. - [% .0000001.as('%.1e') %] Prints 1.0e-07 + [% .0000001.fmt('%.1e') %] Prints 1.0e-07 Hexidecimal input is also supported. [% 0xff + 0 %] Prints 255 - [% 48875.as('%x') %] Prints beeb + [% 48875.fmt('%x') %] Prints beeb =item Single quoted strings. @@ -750,12 +750,6 @@ object (except for true filters such as eval and redirect). [% item = 'foo' %][% item.0 %] Returns self. Allows for scalars to mask as arrays (scalars already will, but this allows for more direct access). -=item as - - [% item.as('%d') %] - -Similar to format. Returns a string formatted with the passed pattern. Default pattern is %s. - =item chunk [% item.chunk(60).join("\n") %] Split string up into a list of chunks of text 60 chars wide. @@ -792,6 +786,12 @@ This is a filter and is not available via the Text virtual object. Same as the redirect filter. +=item fmt + + [% item.fmt('%d') %] + +Similar to format. Returns a string formatted with the passed pattern. Default pattern is %s. + =item format [% item.format('%d') %] Print the string out in the specified format. It is similar to @@ -925,9 +925,9 @@ Virtual Object. =over 4 -=item as +=item fmt - [% mylist.as('%s', ', ') %] + [% mylist.fmt('%s', ', ') %] Passed a pattern and an string to join on. Returns a string of the values of the list formatted with the passed pattern and joined with the passed string. @@ -1033,9 +1033,9 @@ Virtual Object. =over 4 -=item as +=item fmt - [% myhash.as('%s => %s', "\n") %] + [% myhash.fmt('%s => %s', "\n") %] Passed a pattern and an string to join on. Returns a string of the key/value pairs of the hash formatted with the passed pattern and joined with the passed string.