pages tagged Perl http://meng6net.localhost/tag/Perl/ <p><small>Copyright © 2005-2020 by <code>Meng Lu &lt;lumeng3@gmail.com&gt;</code></small></p> Meng Lu's home page ikiwiki Tue, 16 May 2017 23:59:39 +0000 Installing and configuring Perl http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Perl/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_Perl/ Perl computing configuration documentation installation note software Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <h2>Installing and configuring Perl using perlbrew on macOS or Linux</h2> <ul> <li> <p>Installing Perl using <a href= "http://perlbrew.pl/">Perlbrew</a>. It will be a Perl installation separate from macOS's system Perl (/usr/bin/perl).</p> <pre><code> curl -L http://install.perlbrew.pl | bash </code></pre></li> </ul> <p>Put the appropriate initialization command into <code>~/.bashrc</code>:</p> <pre> <code>if &lt;span class="createlink"&gt;bashrc &lt;/span&gt;; then source ~/perl5/perlbrew/etc/bashrc fi </code></pre> <p>Open a new terminal.</p> <ul> <li> <p>Upgrade perlbrew</p> <pre><code> perlbrew self-upgrade </code></pre></li> <li> <p>Install or upgrade perl</p> </li> </ul> <p>Replace with X.Y.Z with the latest stable version found on <a href= "https://www.perl.org/get.html">https://www.perl.org/get.html</a>:</p> <pre><code>perlbrew install perl-X.Y.Z </code></pre> <p>Tell perlbrew which version of Perl to use:</p> <pre><code>perlbrew use X.Y.Z </code></pre> <p>Upgrade Perl:</p> <pre><code>perlbrew upgrade-perl </code></pre> <p>It can be a slow process, monitor the log:</p> <pre><code>tail -f ~/perl5/perlbrew/build.perl-X.Y.Z.log </code></pre> <ul> <li> <p>Verify perl installed correctly:</p> <pre><code> perlbrew use X.Y.Z perl -V </code></pre></li> </ul> <p>Verify that <code>$HOME/perl5/lib/perl5</code> is in <code>@INC</code>.</p> <ul> <li> <p>Install cpanm</p> <pre><code> perlbrew install-cpanm </code></pre></li> <li> <p>Install Perl modules using <code>cpanm</code></p> </li> </ul> <p><code>Markdown::Foswiki</code>, a Perl module for Markdown-to-TWiki conversion:</p> <pre><code>cpanm Markdown::Foswiki </code></pre> <p><a href= "http://search.cpan.org/~leont/experimental-0.016/lib/experimental.pm"> <code>experimental</code></a> module:</p> <pre><code>cpanm experimental </code></pre> Installing and configuring Ikiwiki http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_ikiwiki/ http://meng6net.localhost/computing/installing_and_configuring/installing_and_configuring_ikiwiki/ Perl computing configuration documentation ikiwiki installation note software Tue, 16 May 2017 23:59:39 +0000 2017-05-16T23:59:39Z <h2>Misc</h2> <h3>Bug related to <code>decode</code> call</h3> <p>Modify /usr/lib/x86_64-linux-gnu/perl/5.20/Encode.pm</p> <pre><code>sub decode($$;$) { my ( $name, $octets, $check ) = @_; return undef unless defined $octets; $octets .= ''; $check ||= 0; my $enc = find_encoding($name); unless ( defined $enc ) { require Carp; Carp::croak("Unknown encoding '$name'"); } return $octets if Encode::is_utf8($octets); # Fix bug: do not decode already-decoded string my $string = $enc-&gt;decode( $octets, $check ); $_[1] = $octets if $check and !ref $check and !( $check &amp; LEAVE_SRC() ); return $string; } </code></pre> <h2>Templates</h2> <h3>Default templates</h3> <h3>Linux</h3> <p>On Linux, it's typically in /usr/share/ikiwiki/templates/.</p> <h4>macOS</h4> <p>If installing ikiwiki on macOS using <a href= "http://meng6net.localhost/tag/Perl/installing_and_configuring_pkgsrc">'pkgsrc'</a>, <code>share/ikiwiki/templates/</code> should be relative to the root directory where all 'pkgsrc' files are installed, which is by default <code>/opt/pkg/</code>.</p> <h3>Computer-wide templates (applied to all Ikiwiki websites built on a computer)</h3> <p>Specify an additional directory for ikiwiki to look for templates:</p> <pre> <code>$ ikiwiki --setup setupfile --templatedir '/Users/meng/my-config-files/Ikiwiki/templatedir' [more options] </code></pre> <p>or specify it in the <code>setupfile</code>:</p> <pre><code>use IkiWiki::Setup::Standard { ..., templatedir =&gt; '/Users/meng/my-config-files/Ikiwiki/templatedir', ... } </code></pre> <p>I intend to keep tempaltes applicable to all Ikiwiki websites in '/Users/lumeng/my-config-files/Ikiwiki/templatedir'.</p> <h3>Website-specific templates applied to only the current Ikiwiki website</h3> <p>In addition to the default templates and the user-configured templates applicable to all Ikiwiki websites, keep templates only applicable to the current Ikiwiki website in its own source directory 'sourcedir/templates/'.</p> <h3>References</h3> <ul> <li>https://ikiwiki.info/templates/</li> <li> https://ikiwiki.info/forum/How_to_use_multiple_template_files_directories<strong>63</strong>/</li> </ul>