File: repl.pm

package info (click to toggle)
libcatmandu-cmd-repl-perl 0.01-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 100 kB
  • sloc: perl: 32; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 1,062 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package Catmandu::Cmd::repl;

use Catmandu::Sane;
use parent 'Catmandu::Cmd';
use Devel::REPL;

=head1 NAME

Catmandu::Cmd::repl - interactive shell for Catmandu

=head1 VERSION

Version 0.01

=cut

our $VERSION = '0.01';

=head1 SYNOPSIS

    catmandu repl

=cut

sub command_opt_spec {
    ();
}

sub command {
    my ($self, $opts, $args) = @_;

    my @plugins = qw(LexEnv DDC Packages Commands MultiLine::PPI Colors);

    my $init = <<PERL;
use Catmandu::Sane;
use Catmandu qw(:all);
PERL

    my $repl = Devel::REPL->new;
    $repl->load_plugin($_) for @plugins;
    $repl->current_package('main');
    $repl->eval($init);
    $repl->run;
}

=head1 AUTHOR

Nicolas Steenlant, C<< <nicolas.steenlant at ugent.be> >>

=head1 LICENSE AND COPYRIGHT

Copyright 2012 Ghent University Library

This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

=cut

1;