App-FireDiamondUtils

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

FUNCTIONS
  explain_fire_diamond_text_notation
    Usage:

     explain_fire_diamond_text_notation(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Explain fire diamond text notation in several ways.

    Examples:

    *   Show fire diamond for sulfuric acid in highlighted table style:

         explain_fire_diamond_text_notation(notation => "H3/F0/R2/W+OX"); # -> [200, undef, undef, {}]

    *   Show fire diamond for sulfuric acid in table style:

         explain_fire_diamond_text_notation(notation => "H3/F0/R2/W+OX", style => "table"); # -> [200, undef, undef, {}]

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   notation* => *str*

        (No description)

lib/App/FireDiamondUtils.pm  view on Meta::CPAN

            req => 1,
            pos => 0,
        },
        style => {
            schema => ['str*', in=>['table', 'verbose-table', 'highlighted-table', 'highlighted-verbose-table']],
            default => 'highlighted-table',
        },
    },
    examples => [
        {
            summary => 'Show fire diamond for sulfuric acid in highlighted table style',
            argv => ["H3/F0/R2/W+OX"],
        },
        {
            summary => 'Show fire diamond for sulfuric acid in table style',
            argv => ["H3/F0/R2/W+OX", "--style", "table"],
        },
    ],
};
sub explain_fire_diamond_text_notation {
    require Parse::FireDiamond;
    require Text::ANSITable;

    my %args = @_;
    my $notation = $args{notation};

lib/App/FireDiamondUtils.pm  view on Meta::CPAN

Usage:

 explain_fire_diamond_text_notation(%args) -> [$status_code, $reason, $payload, \%result_meta]

Explain fire diamond text notation in several ways.

Examples:

=over

=item * Show fire diamond for sulfuric acid in highlighted table style:

 explain_fire_diamond_text_notation(notation => "H3/F0/R2/W+OX"); # -> [200, undef, undef, {}]

=item * Show fire diamond for sulfuric acid in table style:

 explain_fire_diamond_text_notation(notation => "H3/F0/R2/W+OX", style => "table"); # -> [200, undef, undef, {}]

=back

This function is not exported.

Arguments ('*' denotes required arguments):

=over 4

script/explain-fire-diamond-text-notation  view on Meta::CPAN

line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

=head1 EXAMPLES

=head2 Show fire diamond for sulfuric acid in highlighted table style

 % explain-fire-diamond-text-notation H3/F0/R2/W+OX
 
=head2 Show fire diamond for sulfuric acid in table style

 % explain-fire-diamond-text-notation H3/F0/R2/W+OX --style table
 
=head1 HOMEPAGE

Please visit the project's homepage at L<https://metacpan.org/release/App-FireDiamondUtils>.

=head1 SOURCE

Source repository is at L<https://github.com/perlancar/perl-App-FireDiamondUtils>.

script/parse-fire-diamond-text-notation  view on Meta::CPAN

line above in your shell to activate immediately.

It is also recommended to install L<shcompgen> (see above).

=head2 other shells

For fish and zsh, install L<shcompgen> as described above.

=head1 EXAMPLES

=head2 Parse the fire diamond for citric acid

 % parse-fire-diamond-text-notation H2/F1/R0/
 +-----------------------+--------------+
 | key                   | value        |
 +-----------------------+--------------+
 | fire_hazard_meaning   | above 93 °C |
 | fire_hazard_number    | 1            |
 | health_hazard_meaning | hazardous    |
 | health_hazard_number  | 2            |
 | reactivity_meaning    | stable       |

script/parse-fire-diamond-text-notation  view on Meta::CPAN

 | key                   | value           |
 +-----------------------+-----------------+
 | fire_hazard_meaning   | above 93 °C    |
 | fire_hazard_number    | 1               |
 | health_hazard_meaning | normal material |
 | health_hazard_number  | 0               |
 | reactivity_meaning    | stable          |
 | reactivity_number     | 0               |
 +-----------------------+-----------------+

=head2 Parse the fire diamond for sulfuric acid

 % parse-fire-diamond-text-notation H3/F0/R2/W+OX
 [
    200,
    "OK (parsed)",
    {
       "fire_hazard_meaning" : "not flammable",
       "fire_hazard_number" : 0,
       "health_hazard_meaning" : "extreme danger",
       "health_hazard_number" : 3,

script/parse-fire-diamond-text-notation  view on Meta::CPAN

             "symbol" : "W"
          },
          {
             "meaning" : "oxidizer",
             "symbol" : "OX"
          }
       ]
    },
    {
       "func.fire_hazard_explanation" : "Materials that will not burn under typical fire conditions (e.g. carbon tetrachloride, silicon dioxide, perfluorohexane), including intrinsically noncombustible materials such as concrete, stone, and sand. Mat...
       "func.health_hazard_explanation" : "Short exposure could cause serious temporary or moderate residual injury (e.g. liquid hydrogen, sulfuric acid, calcium hypochlorite, carbon monoxide, hexafluorosilicic acid, zinc chloride, sodium hydroxide)"...
       "func.reactivity_explanation" : "Undergoes violent chemical change at elevated temperatures and pressures, reacts violently with water, or may form explosive mixtures with water (e.g. white phosphorus, potassium, sodium)",
       "func.specific_hazards" : [
          {
             "explanation" : "Reacts with water in an unusual or dangerous manner (e.g. caesium, sodium, diborane, sulfuric acid)",
             "symbol" : "W"
          },
          {
             "explanation" : "allows chemicals to burn without an air supply (e.g. potassium perchlorate, ammonium nitrate, hydrogen peroxide)",
             "symbol" : "OX"
          }
       ]
    }
 ]



( run in 0.480 second using v1.01-cache-2.11-cpan-de7293f3b23 )