The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Dancer2::Plugin::Showterm - Replay terminal typescript captures

VERSION

version 0.0.3

SYNOPSIS

In config.yml:

    plugins:
        Showterm:
            stylesheet: /my_showterm.css

In your app:

    package MyApp;
    use Dancer2;

    use Dancer2::Plugin::Showterm;

    ...

DESCRIPTION

This plugin is a Dancer2 port of the wonderful http://showterm.io, which allows terminal screen captures taken via the UNIX tool script to be replayed in the browser.

The plugin will intercept any request for files with a .showterm extension and will generate an html page that will be able to replay the same file, but with the .typescript extension.

In other words, if you put the file mysession.typescript in the public folder of the app, then the url /mysession.showterm will display its webified version. The webified version can also be embedded in other pages via iframes:

        <iframe src="/mysession.showterm" 
                width="660" height="360" style="border: 1px solid #444">
        </iframe>

CAPTURING THE ACTION

The cli capture is done using the UNIX utility script. The plugin assumes that the captured screen is 80 columns by 24 rows.

    $ script -ttiming
    ... everything you do here will be recorded ...
    ^D  
    $ echo '---' | cat - timing >> typescript
    $ mv typescript /path/to/dancer/app/public/myscreen.typescript

Note that the typescript file the plugin uses is the concatenation of the original produced typescript with its timing file, separated with a type dash on a single line.

ADDED ROUTES

/showterm/*

The plugin adds the javascript and stylesheets assets required by the webified typescript under /showterm. Those are bundled with the plugin as shared tarball. If you want to see where this tarball is on your filesystem, you can do

    use Dancer2;
    use Dancer2::Plugin::Showterm;

    app->find_plugin('Dancer2::Plugin::Showterm')->assets_dir;

or

    $ perl -MFile::ShareDir=dist_dir -E'say dist_dir("Dancer-Plugin-Showterm")'

*.showterm

Any request for a file with the extension .showterm will be served the showterm page, using the same uri with its extension changed to .typescript as the script to play.

CONFIGURATION

    plugins:
        Showterm:
            stylesheet: /my_showterm.css

stylesheet

If provided, will be added to the showterm page.

SEE ALSO

http://showterm.io - the original service
asciinema

Alternative solution. Arguably simpler to embed (see https://asciinema.org/docs/embedding) as the project provides the required css and js files -- which mean it doesn't require any extra Dancer plugin like this one.

AUTHOR

Yanick Champoux <yanick@babyl.dyndns.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Yanick Champoux.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.