The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

import_content.pl - import content from a file into a MojoMojo page

SYNOPSIS

script/util/import_content.pl /path/to/page page.markdown

Since this operation is undoable, the script will prompt you to confirm that you really want to replace the contents of the last version of /path/to/page with what's in page.markdown.

DESCRIPTION

Replace the contents of the last version of a page with the content from a file. Useful if you want to fix a typo in a page without bumping the version and creating yet another revision in the database. Of course, can be used for evil, but then so could be a series of SQL commands.

AUTHORS

Dan Dascalescu (dandv), http://dandascalescu.com

LICENSE

You may distribute this code under the same terms as Perl itself.

COPYRIGHT

Copyright (C) 2010, Dan Dascalescu.

preview

Return the middle of a string. Examples:

preview('abcdefghijk', 10)
        'ab [...] k'
        
preview('abcdefghijkl', 10), "\n";
        'ab [...] l'
        
preview('abcdefghijkl', 11), "\n";
        'ab [...] kl'
        
preview('abcdefghijklm', 10), "\n";
        'ab [...] m'

preview('abcdef0000000000ghijklm', 10), "\n";
        'ab [...] m'