File: notes.txt

package info (click to toggle)
libstring-formatter-perl 0.102080-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 164 kB
  • ctags: 16
  • sloc: perl: 471; makefile: 12
file content (31 lines) | stat: -rw-r--r-- 732 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

stringf FORMAT, LIST;

  stringf => {
    codes         => { ... },     # the conversions!
    prepare_input => sub { ... }, # deals with LIST as a whole
    iterator      => sub { ... }, # loops over markers, calling conversions
    formatter     => sub { ... }, # postproc output for common -3.1# behavior
  }

codes => {
  x => sub {
    my ($self, $input, $arg, $formatter) = @_;
    # input is also in $_

    return $str; # or \$str to avoid postprocessing
  },
}

kinda of conversions:

  stringf "format %x %y %z", $positional, $based, $interpolation;

  stringf "%x-%y...%z, $object_to_format

  stringf "This is the %{adj}s %{noun}s ever.", { adj => $a, noun => $n };

less likely:

  stringf "%x-%y...%z, $obj1, $obj2;