Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: installing module starter

by Athanasius (Archbishop)
on Jun 05, 2019 at 06:22 UTC ( [id://11100984]=note: print w/replies, xml ) Need Help??


in reply to installing module starter

Hello Aldebaran,

I have to use pre tags because the hyphen blows up in c tags

That’s because your “hyphens” are actually Unicode minus signs, i.e. U+2212 (8722) (HTML −) instead of normal hyphens/dashes, i.e. U+2010 (8208) (HTML -) normal hyphens, i.e. U+002D (HTML -).1

(In the code as given, the module-starter snippets use the minus sign, but the command sudo apt install libmodule-starter-perl uses normal hyphens.)

Hope that helps,

1Thanks to daxim for the correction.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: installing module starter
by daxim (Curate) on Jun 05, 2019 at 14:24 UTC
    instead of normal hyphens/dashes, i.e. U+2010 (8208) (HTML -)
    Surely the character that's relevant to the problem should be U+002D ‹-› \N{HYPHEN-MINUS} (&#45;)?
Re^2: installing module starter
by Aldebaran (Curate) on Jun 05, 2019 at 22:50 UTC
    That’s because your “hyphens” are actually Unicode minus signs

    Oy, I knew something was up when the character went unicode in the c tags. Thank you for taking the time to point it out. I like to preserve the vertical space in my threads for replies, so will put new code, comments, and questions in readmore tags:

    Thanks for your comment,

      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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11100984]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-25 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found