Packages / openSUSE Tumbleweed / Unspecified / perl-String-Formatter
[Source: perl-String-Formatter]
Package: perl-String-Formatter (1.235-1.13)
[Project overview: libstring-formatter-perl]
Creare funzioni proprie in stile sprintf
String::Formatter è uno strumento per costruire routine di formattazione in stile sprintf.
Supporta la formattazione con nomi o posizionale, conversioni personalizzate, interpolazione di
stringhe fisse e semplice adattamento della larghezza subito disponibili. È facile
modificarne il comportamento per scrivere nuovi tipi di espansori di stringhe di formato. Nella
maggior parte dei casi, dovrebbe essere facile costruire ogni sorta di formattatori dalle
opzioni integrate in String::Formatter.
Normalmente, String::Formatter sarà usato per importare una routine in stile sprintf
indicata come "'stringf'", ma a cui si può dare qualsiasi nome. Questa
routine agisce come sprintf in quanto prende una stringa e alcuni input e
restituisce una nuova stringa:
my $output = stringf "Some %a format %s for you to %u.\n", { ... };
Questa routine è in realtà un wrapper attorno a un oggetto String::Formatter
creato importando stringf. Nel codice seguente, l'intera hashref
dopo "stringf" viene passata al costruttore di String::Formatter (il metodo 'new'),
tranne la chiave '-as' e qualsiasi altra chiave che inizia con un trattino.
use String::Formatter
stringf => {
-as => 'fmt_time',
codes => { ... },
format_hunker => ...,
input_processor => ...,
},
stringf => {
-as => 'fmt_date',
codes => { ... },
string_replacer => ...,
hunk_formatter => ...,
},
;
Come potete vedere, questo genererà due routine stringf, con comportamenti
diversi, installate con nomi diversi. Poiché il comportamento di
queste routine si basa sul metodo 'format' di un oggetto String::Formatter,
il resto della documentazione descriverà il comportamento dell'oggetto.
C'è anche un'esportazione 'named_stringf', che si comporta proprio come
l'esportazione 'stringf', ma usa di default gli argomenti 'named_replace' e
'require_named_input'. C'è un'esportazione 'method_stringf', che
usa di default 'method_replace' e 'require_single_input'. Infine, una
'indexed_stringf', che usa di default 'indexed_replaced' e
'require_arrayref_input'. Per saperne di più, continuate a leggere e consultate
il cookbook.
String::Formatter::Cookbook fornisce diverse ricette su come usare
String::Formatter.
Other Packages Related to perl-String-Formatter:
Download perl-String-Formatter
| Architecture | Package Size | Installed Size | Files |
|---|
| noarch | 35 KiB | 70 KiB | [list of files] |
Percorsi file del pacchetto (11)
Paths come from the repository package-file index for the observed builds. They describe archive/package associations, not every file that will exist on a running system after maintainer scripts, alternatives, generated state, diversions, or installation choices.
- /usr/lib/perl5/vendor_perl/5.44.0/String
- /usr/lib/perl5/vendor_perl/5.44.0/String/Formatter
- /usr/lib/perl5/vendor_perl/5.44.0/String/Formatter/Cookbook.pm
- /usr/lib/perl5/vendor_perl/5.44.0/String/Formatter.pm
- /usr/share/doc/packages/perl-String-Formatter
- /usr/share/doc/packages/perl-String-Formatter/Changes
- /usr/share/doc/packages/perl-String-Formatter/README
- /usr/share/licenses/perl-String-Formatter
- /usr/share/licenses/perl-String-Formatter/LICENSE
- /usr/share/man/man3/String::Formatter.3pm.gz
- /usr/share/man/man3/String::Formatter::Cookbook.3pm.gz
Field source: openSUSE Tumbleweed OSS revision tumbleweed-oss-multiarch:4db10cdde3ad82c7e22be35753c9e164b4bdd30f92db4aee17a0d4c94c5f902f