Perl-ToPerl6

 view release on metacpan or  search on metacpan

lib/Perl/ToPerl6/Command.pm  view on Meta::CPAN

    require Perl::ToPerl6;

    my %pc_params = (-profile => $EMPTY, -necessity => $NECESSITY_LOWEST);
    my @transformers = Perl::ToPerl6->new( %pc_params )->transformers();
    my $prototype = Perl::ToPerl6::ProfilePrototype->new( -transformers => \@transformers );
    _out $prototype;

    exit $EXIT_SUCCESS;
}

#-----------------------------------------------------------------------------

sub _render_transformer_docs {

    my (%opts) = @_;
    my $pattern = delete $opts{-doc};

    require Perl::ToPerl6;
    $mogrify = Perl::ToPerl6->new(%opts);
    _set_up_pager($mogrify->config()->pager());

    require Perl::ToPerl6::TransformerFactory;
    my @site_transformers  = Perl::ToPerl6::TransformerFactory->site_transformer_names();
    my @matching_transformers  = grep { /$pattern/ixms } @site_transformers;

    # "-T" means don't send to pager
    my @perldoc_output = map {`perldoc -T $_`} @matching_transformers;
    _out @perldoc_output;

    exit $EXIT_SUCCESS;
}

#-----------------------------------------------------------------------------

sub _display_version {
    _out "$VERSION\n";
    exit $EXIT_SUCCESS;
}

#-----------------------------------------------------------------------------
1;

__END__

#-----------------------------------------------------------------------------

=pod

=for stopwords
Twitter

=head1 NAME

Perl::ToPerl6::Command - Guts of L<perlmogrify|perlmogrify>.


=head1 SYNOPSIS

    use Perl::ToPerl6::Command qw< run >;

    local @ARGV = qw< --statistics-only lib bin >;
    run();


=head1 DESCRIPTION

This is the implementation of the L<perlmogrify|perlmogrify> command.  You can use
this to run the command without going through a command interpreter.


=head1 INTERFACE SUPPORT

This is considered to be a public class.  However, its interface is
experimental, and will likely change.


=head1 IMPORTABLE SUBROUTINES

=over

=item C<run()>

Does the equivalent of the L<perlmogrify|perlmogrify> command.  Unfortunately, at
present, this doesn't take any parameters but uses C<@ARGV> to get its
input instead.  Count on this changing; don't count on the current
interface.


=back


=head1 TO DO

Make C<run()> take parameters.  The equivalent of C<@ARGV> should be
passed as a reference.

Turn this into an object.


=head1 AUTHOR

Jeffrey Goff <drforr@pobox.com>


=head1 AUTHOR EMERITUS

Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>


=head1 COPYRIGHT

Copyright (c) 2005-2011 Imaginative Software Systems.  All rights reserved.

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.  The full text of this license
can be found in the LICENSE file included with this module.

=cut

##############################################################################
# Local Variables:



( run in 3.763 seconds using v1.01-cache-2.11-cpan-364913b4093 )