App-BPOMUtils

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

  bpom_show_nutrition_facts
    Usage:

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

    Round values and format them as nutrition fact table (ING - informasi
    nilai gizi).

    Examples:

    *   An example, in linear text format (color/emphasis is shown with
        markup):

         bpom_show_nutrition_facts(
           carbohydrate => 13.113,
           color => "never",
           fat => 0.223,
           output_format => "linear_text",
           package_size => 20,
           protein => 0.99,
           saturated_fat => 0.01,
           serving_size => 175,
           sodium => 0.223,
           sugar => 7.173
         );

        Result:

         [
           200,
           "OK",
           "*INFORMASI NILAI GIZI*  *JUMLAH PER KEMASAN (20 g*) : *Energi total 10 kkal*, Energi dari lemak 0 kkal, Energi dari lemak jenuh 0 kkal, *Lemak total 0 g (0% AKG)*, *Lemak jenuh 0 g (0% AKG)*, *Protein 0 g (0% AKG)*, *Karbohidrat total 3 g...
           { "cmdline.skip_format" => 1 },
         ]

    *   The same example in vetical HTML table format:

         bpom_show_nutrition_facts(
           carbohydrate => 13.113,
           fat => 0.223,
           output_format => "vertical_html_table",
           package_size => 20,
           protein => 0.99,
           saturated_fat => 0.01,
           serving_size => 175,
           sodium => 0.223,
           sugar => 7.173
         );

        Result:

         [
           200,
           "OK",
           "\n<style>\n  table { border-collapse: collapse; border: 1px solid; }\n  tr.has_bottom_border { border-bottom: 1pt solid black; }\n  // td:first-child { background: red; }\n</style>\n<table><colgroup><col style=\"width:16pt;\"><col style=\...
           { "cmdline.skip_format" => 1 },
         ]

    *   The same example, in vertical text format (color/emphasis is shown
        with markup):

         bpom_show_nutrition_facts(
           carbohydrate => 13.113,
           color => "never",
           fat => 0.223,
           output_format => "vertical_text_table",
           package_size => 20,
           protein => 0.99,
           saturated_fat => 0.01,
           serving_size => 175,
           sodium => 0.223,
           sugar => 7.173
         );

        Result:

         [
           200,
           "OK",
           ".---------------------------------------------------------------------------------------------------------------------.\n|                                               *INFORMASI NILAI GIZI*                                               ...
           { "cmdline.skip_format" => 1 },
         ]

    This function is not exported by default, but exportable.

    Arguments ('*' denotes required arguments):

    *   browser => *true*

        View output HTML in browser instead of returning it.

    *   carbohydrate* => *ufloat*

        Total carbohydrate, in g/100g.

    *   color => *str* (default: "auto")

        (No description)

    *   fat* => *ufloat*

        Total fat, in g/100g.

    *   name => *str*

        (No description)

    *   output_format => *str* (default: "vertical_text_table")

        (No description)

    *   package_size* => *ufloat*

        Packaging size, in g.



( run in 3.093 seconds using v1.01-cache-2.11-cpan-f56aa216473 )