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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |