I've been looking at the source for the pm and wonder if I shouldn't imitate it in significant ways. source listing for Translate.pm For example, should I use Readonly for these values?

my ( $REST_HOST, $REST_URL, $CONSOLE_URL, %SIZE_LIMIT_FOR ); { Readonly $REST_HOST => 'translation.googleapis.com'; Readonly $REST_URL => "https://$REST_HOST/language/translate +/v2"; Readonly $CONSOLE_URL => "https://console.developers.google.com +/cloud-resource-manager"; Readonly %SIZE_LIMIT_FOR => ( translate => 2000, # google states 2K but observed results +vary detect => 2000, languages => 9999, # N/A ); }

Also, I want to build a central hash to store the data. Values would go in with Getopt::Long and end up in %self . This treatment creates a class of it. One thing I don't see is where the value of $class gets passed to the sub new:

sub new { my ( $class, $param_hr ) = @_; my %self = ( key => 0, format => 0, model => 0, prettyprint => 0, default_source => 0, default_target => 0, data_format => 'perl', timeout => 60, force_post => 0, rest_url => $REST_URL, agent => ( sprintf '%s/%s', __PACKAGE__, $VERSION ), cache_file => 0, headers => {}, );

In reply to Re^3: chunking up texts correctly for online translation by Aldebaran
in thread chunking up texts correctly for online translation by Aldebaran

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.