3 package Devel::REPL::Plugin::B::Concise;
5 our $VERSION = '1.003027';
7 use Devel::REPL::Plugin;
8 use B::Concise 0.62 ();
9 use namespace::autoclean;
11 B::Concise::compileOpts qw(-nobanner);
15 $self->load_plugin('Turtles');
21 my $prefix = $self->default_command_prefix;
23 $self->add_turtles_matcher(qr/^
25 ( (?:\-\w+\s+)* ) # options for concise
30 sub expr_command_concise {
31 my ( $self, $eval, $opts, $code ) = @_;
35 my %opts = map { $_ => 1 } (split /\s+/, $opts);
37 my $sub = $self->compile($code, no_mangling => !delete($opts{"-mangle"}) );
39 if ( $self->is_error($sub) ) {
40 return $self->format($sub);
42 open my $fh, ">", \my $out;
45 B::Concise::compile(keys %opts, $sub)->();
60 Devel::REPL::Plugin::B::Concise - B::Concise dumping of expression optrees
64 repl> #concise -exec -terse {
67 COP (0x138b1e0) nextstate
68 OP (0x13bd280) pushmark
69 SVOP (0x138c6a0) const PV (0xbbab50) "foo"
70 OP (0x13bbae0) pushmark
71 SVOP (0x13bcee0) gv GV (0xbbb250) *Devel::REPL::Plugin::B::Concise::foo
72 UNOP (0x13890a0) entersub [1]
73 LISTOP (0x13ba020) anonhash
74 UNOP (0x5983d0) leavesub [1]
78 This plugin provides a C<concise> command that uses L<B::Concise> to dump
79 optrees of expressions.
81 The code is not actually executed, which means that when used with
82 L<Deve::REPL::Plugin::OutputCache> there is no new value in C<_>.
84 The command takes the same options as L<B::Concise/compile>, e.g. C<-basic> or
85 C<-exec> to determine the dump order, C<-debug>, C<-concise> and C<-terse> to
86 determine the formatting, etc.
90 Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt>