Here is another workaround, more practical and more down-to-earth:

In your project's dir I assume you have lib/ with all your mojo code. Create dirs lib/Mojo and lib/Mojo/resources . Copy original Mojo::Util in lib/Mojo/Util.pm . In my linux box I can do whichpm Mojo::Util and get /usr/local/share/perl5/5.32/Mojo/Util.pm (to install whichpm do cpanm -f App::whichpm). Copy /usr/local/share/perl5/5.32/Mojo/resources/html_entities.txt into lib/Mojo/resources/html_entities.txt and edit according to your needs. This will be what Mojo::Util will use as its html_entities.txt. That's the first part.

The second part is to modify your mojo-app script so that it looks for packages FIRST in your lib/ dir before anywhere else including the Mojolicious installation location. Mine looks like this:

#!/usr/bin/env perl use strict; use warnings; our $VERSION = '0.01'; #ADD THIS before loading anything else #adjust catdir so that it finds 'lib' from where THIS script resides #mine is scripts/hero that's why I have the '..' use FindBin; use File::Spec; use lib File::Spec->catdir($FindBin::Bin, '..', 'lib'); # or just use lib a constant path to avoid loading extra packages ##### use Mojo::File qw(curfile); use Mojolicious::Commands; # Start command line interface for application Mojolicious::Commands->start_app('Hero');

The caveat is that your local Mojo::Util will not be updated when Mojolicious gets an update. But there are workarounds for this too, I am sure.

bw, bliako


In reply to Re: Customize Mojo's html_entities.txt by bliako
in thread Customize Mojo's html_entities.txt by Anonymous Monk

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.