3 package Devel::REPL::Plugin::B::Concise;
4 use Devel::REPL::Plugin;
8 B::Concise::compileOpts(qw(-nobanner));
10 use namespace::clean -except => [ 'meta' ];
14 $self->load_plugin('Turtles');
20 my $prefix = $self->default_command_prefix;
22 $self->add_turtles_matcher(qr/^
24 ( (?:\-\w+\s+)* ) # options for concise
29 sub expr_command_concise {
30 my ( $self, $eval, $opts, $code ) = @_;
34 my %opts = map { $_ => 1 } (split /\s+/, $opts);
36 my $sub = $self->compile($code, no_mangling => !delete($opts{"-mangle"}) );
38 if ( $self->is_error($sub) ) {
39 return $self->format($sub);
41 open my $fh, ">", \my $out;
44 B::Concise::compile(keys %opts, $sub)->();
59 Devel::REPL::Plugin::B::Concise - B::Concise dumping of expression optrees
63 repl> #concise -exec -terse {
66 COP (0x138b1e0) nextstate
67 OP (0x13bd280) pushmark
68 SVOP (0x138c6a0) const PV (0xbbab50) "foo"
69 OP (0x13bbae0) pushmark
70 SVOP (0x13bcee0) gv GV (0xbbb250) *Devel::REPL::Plugin::B::Concise::foo
71 UNOP (0x13890a0) entersub [1]
72 LISTOP (0x13ba020) anonhash
73 UNOP (0x5983d0) leavesub [1]
77 This plugin provides a C<concise> command that uses L<B::Concise> to dump
78 optrees of expressions.
80 The code is not actually executed, which means that when used with
81 L<Deve::REPL::Plugin::OutputCache> there is no new value in C<_>.
83 The command takes the same options as L<B::Concise/compile>, e.g. C<-basic> or
84 C<-exec> to determine the dump order, C<-debug>, C<-concise> and C<-terse> to
85 determine the formatting, etc.
89 Yuval Kogman E<lt>nothingmuch@woobling.orgE<gt>