Aldebaran has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to replicate the material in chp 12 of _Intermediate Perl_. I have done this before successfully but can't get off the starting line now. I started so; I have to use pre tags because the hyphen blows up in c tags:

module−starter −−module=Minnow −−author="Gilligan" −−email=gilligan@island.example.com −−verbose

sudo apt install libmodule-starter-perl

and got:

$ Command 'module−starter' not found, did you mean:

  command 'module-starter' from deb libmodule-starter-perl

Try: sudo apt install <deb name>

Fair enough, I'll do that:

$ sudo apt install libmodule-starter-perl
sudo password for bob: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libaom0 libdav1d0 libllvm6.0 x11proto-dri2-dev x11proto-gl-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libcommon-sense-perl libfile-homedir-perl libfile-remove-perl
  libfile-which-perl libjson-perl libjson-xs-perl
  libmodule-install-authortests-perl libmodule-install-perl
  libmodule-scandeps-perl libpar-dist-perl libtypes-serialiser-perl
The following NEW packages will be installed:
  libcommon-sense-perl libfile-homedir-perl libfile-remove-perl
  libfile-which-perl libjson-perl libjson-xs-perl
  libmodule-install-authortests-perl libmodule-install-perl
  libmodule-scandeps-perl libmodule-starter-perl libpar-dist-perl
  libtypes-serialiser-perl
0 upgraded, 12 newly installed, 0 to remove and 192 not upgraded.
Need to get 479 kB of archives.
After this operation, 1,380 kB of additional disk space will be used.
Do you want to continue? Y/n y
...

It continues with no announcement of errors.

...still module−starter is not a known command. I install Module::Starter (again, I think):

$ sudo cpan
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.18)
Enter 'h' for help.

cpan1> install Module::Starter
Reading '/home/bob/.cpan/Metadata'
  Database was generated on Tue, 28 May 2019 00:41:03 GMT
Fetching with LWP:
http://www.cpan.org/authors/01mailrc.txt.gz
Reading '/home/bob/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
...
Installing /usr/local/bin/module-starter
Appending installation info to /usr/lib/x86_64-linux-gnu/perl/5.26/perllocal.pod
  DBOOK/Module-Starter-1.76.tar.gz
  /usr/bin/make install  -- OK

After all this, I'm still shooting blanks:

$ module−starter −−module=Minnow −−author="Gilligan" −−email=gilligan@island.example.com −−verbose

Command 'module−starter' not found, did you mean:

  command 'module-starter' from deb libmodule-starter-perl

Try: sudo apt install <deb name>

$ module−starter hhhh

Command 'module−starter' not found, did you mean:

  command 'module-starter' from deb libmodule-starter-perl

Try: sudo apt install <deb name>
$ 

Fishing for tips. Thanks for your comment.

Replies are listed 'Best First'.
Re: installing module starter
by Athanasius (Archbishop) on Jun 05, 2019 at 06:22 UTC

    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 &#8722;) instead of normal hyphens/dashes, i.e. U+2010 (8208) (HTML -) normal hyphens, i.e. U+002D (HTML &#45;).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,

      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;)?
      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.

Re: installing module starter
by Fletch (Bishop) on Jun 05, 2019 at 12:29 UTC

    Don't know about the packaged version, from the cpan session output it's installing things to /usr/local/bin but it looks like from the error message your shell looks to not be searching there. Make sure that it's mentioned in your PATH environment variable with something like:

    export PATH="/usr/local/bin:$PATH"

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re: installing module starter
by thomas895 (Deacon) on Jun 06, 2019 at 04:32 UTC

    Have you restarted your shell? Some (e.g. tclsh in my experience) will not recognize new entries in $PATH unless you do a exec bash or open a new terminal.

    -Thomas
    "Excuse me for butting in, but I'm interrupt-driven..."