Aldebaran that's cool!

The question I ask myself at this stage is whether I want all the functionality to go into a script or shall I create some high-level functions or even a class and store into the module. I usually prefer the latter and in most cases a class. For example, in your case you need to read the API key from the configuration each time you send for a translation. That can probably be stored in your class. So you get functionality like:

use My::Translator; my $trans = My::Translator->new(Config => 'config.txt'); my ($ret, $conf) = $trans->translate("abc xyz"); print "output is '$ret' with confidence $conf %\n";

but even without a class/OOP you get a nice high-level API like:

use My::Translator; my $conf = Config::Tiny... my $prep = My::Translator::prepare_with_some_transformations("abc xyz" +); my ($ret, $conf) = My::Translator::translate($prep, $conf); print "output is '$ret' (via $prep) with confidence $conf %\n";

btw, if you have any scripts you want installed via make install, then insert an EXE_FILES => ['bin/myscript.pl'] into Makefile.PL as a parameter to WriteMakefile() (e.g. just below PL_FILES => {},. In this way make install will install your script(s) along with any module files.

Edit: I also find useful setting temporarily (when doing my own tests) INSTALL_BASE => '$ENV{HOME}".'/usr', as a parameter to WriteMakefile() will install this module in user's own /home/user/usr dir which does not require admin rights.


In reply to Re^3: installing module starter by bliako
in thread installing module starter 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.