App-CSVUtils-csv_mix_formulas

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


        Output to the same file as input.

        Normally, you output to a different file than input. If you try to
        output to the same file ("-o INPUT.csv -O") you will clobber the
        input file; thus the utility prevents you from doing it. However,
        with this "--inplace" option, you can output to the same file. Like
        perl's "-i" option, this will first output to a temporary file in
        the same directory as the input file then rename to the final file
        at the end. You cannot specify output file ("-o") when using this
        option, but you can specify backup extension with "-b" option.

        Some caveats:

        *   if input file is a symbolic link, it will be replaced with a
            regular file;

        *   renaming (implemented using rename()) can fail if input filename
            is too long;

        *   value specified in "-b" is currently not checked for acceptable
            characters;

        *   things can also fail if permissions are restrictive;

    *   inplace_backup_ext => *str* (default: "")

        Extension to add for backup of input file.

        In inplace mode ("--inplace"), if this option is set to a non-empty
        string, will rename the input file using this extension as a backup.
        The old existing backup will be overwritten, if any.

    *   input_escape_char => *str*

        Specify character to escape value in field in input CSV, will be
        passed to Text::CSV_XS.

        Defaults to "\\" (backslash). Overrides "--input-tsv" option.

    *   input_filenames => *array[filename]* (default: ["-"])

lib/App/CSVUtils/csv_mix_formulas.pm  view on Meta::CPAN

=item * B<inplace> => I<true>

Output to the same file as input.

Normally, you output to a different file than input. If you try to output to the
same file (C<-o INPUT.csv -O>) you will clobber the input file; thus the utility
prevents you from doing it. However, with this C<--inplace> option, you can
output to the same file. Like perl's C<-i> option, this will first output to a
temporary file in the same directory as the input file then rename to the final
file at the end. You cannot specify output file (C<-o>) when using this option,
but you can specify backup extension with C<-b> option.

Some caveats:

=over

=item * if input file is a symbolic link, it will be replaced with a regular file;

=item * renaming (implemented using C<rename()>) can fail if input filename is too long;

=item * value specified in C<-b> is currently not checked for acceptable characters;

=item * things can also fail if permissions are restrictive;

=back

=item * B<inplace_backup_ext> => I<str> (default: "")

Extension to add for backup of input file.

In inplace mode (C<--inplace>), if this option is set to a non-empty string, will
rename the input file using this extension as a backup. The old existing backup
will be overwritten, if any.

=item * B<input_escape_char> => I<str>

Specify character to escape value in field in input CSV, will be passed to Text::CSV_XS.

Defaults to C<\\> (backslash). Overrides C<--input-tsv> option.

=item * B<input_filenames> => I<array[filename]> (default: ["-"])

script/csv-mix-formulas  view on Meta::CPAN

=head1 VERSION

This document describes version 0.002 of csv-mix-formulas (from Perl distribution App-CSVUtils-csv_mix_formulas), released on 2024-02-24.

=head1 SYNOPSIS

B<csv-mix-formulas> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)

B<csv-mix-formulas> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)

B<csv-mix-formulas> [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|/"--verbose">>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--ingredient-...

=head1 DESCRIPTION

Each formula is a CSV comprised of at least two fields. The first field (by
default literally the first field, but can also be specified using
C<--ingredient-field>) is assumed to contain the name of ingredients. The second
field (by default literally the second field, but can also be specified using
C<--weight-field>) is assumed to contain the weight of ingredients. A percent
form is recognized and will be converted to its decimal form (e.g. "60%" or
"60.0 %" will become 0.6).

script/csv-mix-formulas  view on Meta::CPAN

=item B<--inplace>

Output to the same file as input.

Normally, you output to a different file than input. If you try to output to the
same file (C<-o INPUT.csv -O>) you will clobber the input file; thus the utility
prevents you from doing it. However, with this C<--inplace> option, you can
output to the same file. Like perl's C<-i> option, this will first output to a
temporary file in the same directory as the input file then rename to the final
file at the end. You cannot specify output file (C<-o>) when using this option,
but you can specify backup extension with C<-b> option.

Some caveats:

=over

=item * if input file is a symbolic link, it will be replaced with a regular file;

=item * renaming (implemented using C<rename()>) can fail if input filename is too long;

=item * value specified in C<-b> is currently not checked for acceptable characters;

=item * things can also fail if permissions are restrictive;

=back


=item B<--inplace-backup-ext>=I<s>, B<-b>

Extension to add for backup of input file.

Default value:

 ""

In inplace mode (C<--inplace>), if this option is set to a non-empty string, will
rename the input file using this extension as a backup. The old existing backup
will be overwritten, if any.


=item B<--json>

Set output format to json.

=item B<--naked-res>

When outputing as JSON, strip result envelope.



( run in 0.606 second using v1.01-cache-2.11-cpan-49f99fa48dc )