From: Karen Etheridge Date: Mon, 9 Sep 2013 01:55:55 +0000 (-0700) Subject: Merge branch 'topic/dzil' X-Git-Tag: v1.003021~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=commitdiff_plain;h=7403333dae2210dc9235882e4178349129461ed1;hp=f049111ed91d199e926de686b2a6f179a89cba18 Merge branch 'topic/dzil' --- diff --git a/.gitignore b/.gitignore index c213622..33253ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,5 @@ -/META.* -/MYMETA.* -/Makefile -/Makefile.old -/MANIFEST.bak -/MANIFEST.SKIP.bak -/blib/ -/pm_to_blib /.build/ -/MANIFEST !.gitignore -*.bs -/xs/*.c -*.o -/cover_db/ -*.gc?? -/test-mydeps-* -/nytprof* -/inc/ -.*.sw[a-z] /Devel-REPL-* /todo.txt /todo/ diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..83b8d0a --- /dev/null +++ b/.mailmap @@ -0,0 +1,8 @@ +# https://www.kernel.org/pub/software/scm/git/docs/git-shortlog.html +Shawn M Moore Sartak +Dagfinn Ilmari Mannsåker ilmari + + יובל קוג'מן (Yuval Kogman) nothingmuch +Matt S Trout matthewt +Stevan Little stevan +Tomas Doran (t0m) t0m diff --git a/Changes b/Changes index 85c5678..07eb7aa 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,8 @@ -Revision history for Devel-REPL +Revision history for {{ $dist->name }} +{{ $NEXT }} - removed use of deprecated functions from Class::MOP + - long-deprecated Devel::REPL::Plugin::NewlineHack removed at last 1.003020 2013-07-08 - shebang fixed in re.pl so it is rewritten to point to the proper perl at diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..e69de29 diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP deleted file mode 100644 index ad47ae5..0000000 --- a/MANIFEST.SKIP +++ /dev/null @@ -1,3 +0,0 @@ -#!include_default -^(?!script/\w+\.pl|examples/[^\.]+|lib/[\/\w]+\.p(m|od)|inc/|t/\w+\.t|Makefile.PL$|README$|MANIFEST$|Changes$|META.yml$) -/Devel-REPL- diff --git a/Makefile.PL b/Makefile.PL deleted file mode 100644 index e3f142f..0000000 --- a/Makefile.PL +++ /dev/null @@ -1,84 +0,0 @@ -use strict; -use warnings; -use inc::Module::Install 0.91; -use Module::Install::Repository; - -name 'Devel-REPL'; -perl_version '5.008001'; -all_from 'lib/Devel/REPL.pm'; - -install_script 'script/re.pl'; - -# r/w: p5sagit@git.shadowcat.co.uk:Devel-REPL.git -# r/o: git://git.shadowcat.co.uk/p5sagit/Devel-REPL.git -# homepage: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/Devel-REPL.git -auto_set_repository; - -# core -requires 'File::Spec'; -requires 'Term::ReadLine'; - -# rest -requires 'Moose' => '0.93'; -requires 'MooseX::Object::Pluggable' => '0.0009'; -requires 'MooseX::Getopt' => '0.18'; -requires 'namespace::autoclean'; -requires 'File::HomeDir'; -requires 'Task::Weaken'; -requires 'B::Concise'; -requires 'Term::ANSIColor'; -requires 'Devel::Peek'; -requires 'Module::Runtime'; - -recommends 'PPI::XS' => '0.902'; - -feature 'Completion plugin - extensible tab completion', - -default => 1, - 'PPI' => 0; - -feature 'DDS plugin - better format results with Data::Dump::Streamer', - -default => 1, - 'Data::Dump::Streamer' => 0; - -feature 'DDC plugin - even better format results with Data::Dumper::Concise', - -default => 1, - 'Data::Dumper::Concise' => 0; - -feature 'INC completion driver - tab complete module names in use and require', - -default => 1, - 'File::Next' => 0; - -feature 'Interrupt plugin - traps SIGINT to kill long-running lines', - -default => (($^O =~ /Win32/) ? 0 : 1), - 'Sys::SigAction' => 0; - -feature 'Keywords completion driver - tab complete Perl keywords and operators', - -default => 1, - 'B::Keywords' => 0; - -feature 'LexEnv plugin - variables declared with "my" persist between statements', - -default => 1, - 'Lexical::Persistence' => 0; - -feature 'MultiLine::PPI plugin - continue reading lines until all blocks are closed', - -default => 1, - 'PPI' => 0; - -feature 'Nopaste plugin - upload a session\'s input and output to a Pastebin', - -default => 0, - 'App::Nopaste' => 0; - -feature 'PPI plugin - PPI dumping of Perl code', - -default => 1, - 'PPI' => 0; - -feature 'Refresh plugin - automatically reload libraries with Module::Refresh', - -default => 0, - 'Module::Refresh' => 0; - -test_requires 'Test::More' => '0.88'; -test_requires 'Test::Warnings'; - -auto_install; -WriteAll; - diff --git a/README b/README deleted file mode 100644 index 3853e94..0000000 --- a/README +++ /dev/null @@ -1,217 +0,0 @@ -NAME - Devel::REPL - a modern perl interactive shell - -SYNOPSIS - my $repl = Devel::REPL->new; - $repl->load_plugin($_) for qw(History LexEnv); - $repl->run - - Alternatively, use the 're.pl' script installed with the distribution - - system$ re.pl - -DESCRIPTION - This is an interactive shell for Perl, commonly known as a REPL - Read, - Evaluate, Print, Loop. The shell provides for rapid development or - testing of code without the need to create a temporary source code file. - - Through a plugin system, many features are available on demand. You can - also tailor the environment through the use of profiles and run control - files, for example to pre-load certain Perl modules when working on a - particular project. - -USAGE - To start a shell, follow one of the examples in the "SYNOPSIS" above. - - Once running, the shell accepts and will attempt to execute any code - given. If the code executes successfully you'll be shown the result, - otherwise an error message will be returned. Here are a few examples: - - $_ print "Hello, world!\n" - Hello, world! - 1 - $_ nosuchfunction - Compile error: Bareword "nosuchfunction" not allowed while "strict subs" in use at (eval 130) line 5. - - $_ - - In the first example above you see the output of the command ("Hello, - world!"), if any, and then the return value of the statement (1). - Following that example, an error is returned when the execution of some - code fails. - - Note that the lack of semicolon on the end is not a mistake - the code - is run inside a Block structure (to protect the REPL in case the code - blows up), which means a single statement doesn't require the semicolon. - You can add one if you like, though. - - If you followed the first example in the "SYNOPSIS" above, you'll have - the History and LexEnv plugins loaded (and there are many more - available). Although the shell might support "up-arrow" history, the - History plugin adds "bang" history to that so you can re-execute chosen - commands (with e.g. "!53"). The LexEnv plugin ensures that lexical - variables declared with the "my" keyword will automatically persist - between statements executed in the REPL shell. - - When you "use" any Perl module, the "import()" will work as expected - - the exported functions from that module are available for immediate use: - - $_ carp "I'm dieeeing!\n" - String found where operator expected at (eval 129) line 5, near "carp "I'm dieeeing!\n"" - (Do you need to predeclare carp?) - Compile error: syntax error at (eval 129) line 5, near "carp "I'm dieeeing!\n"" - BEGIN not safe after errors--compilation aborted at (eval 129) line 5. - - $_ use Carp - - $_ carp "I'm dieeeing!\n" - I'm dieeeing! - at /usr/share/perl5/Lexical/Persistence.pm line 327 - 1 - $_ - - To quit from the shell, hit "Ctrl+D" or "Ctrl+C". - - MSWin32 NOTE: control keys won't work if TERM=dumb - because readline functionality will be disabled. - - Run Control Files - For particular projects you might well end up running the same commands - each time the REPL shell starts up - loading Perl modules, setting - configuration, and so on. A run control file lets you have this done - automatically, and you can have multiple files for different projects. - - By default the "re.pl" program looks for "$HOME/.re.pl/repl.rc", and - runs whatever code is in there as if you had entered it at the REPL - shell yourself. - - To set a new run control file that's also in that directory, pass it as - a filename like so: - - system$ re.pl --rcfile myproject.pc - - If the filename happens to contain a forwardslash, then it's used - absolutely, or realive to the current working directory: - - system$ re.pl --rcfile /path/to/my/project/repl.rc - - Within the run control file you might want to load plugins. This is - covered in "The REPL shell object" section, below. - - Profiles - To allow for the sharing of run control files, you can fashion them into - a Perl module for distribution (perhaps via the CPAN). For more - information on this feature, please see the Devel::REPL::Profile manual - page. - - A default profile ships with "Devel::REPL"; it loads the following - plugins: - - * Devel::REPL::Plugin::History - - * Devel::REPL::Plugin::LexEnv - - * Devel::REPL::Plugin::DDS - - * Devel::REPL::Plugin::Packages - - * Devel::REPL::Plugin::Commands - - * Devel::REPL::Plugin::MultiLine::PPI - - Plugins - Plugins are a way to add funcionality to the REPL shell, and take - advantage of "Devel::REPL" being based on the Moose object system for - Perl 5. This means it's simple to 'hook into' many steps of the R-E-P-L - process. Plugins can change the way commands are interpreted, or the way - their results are output, or even add commands to the shell environment. - - A number of plugins ship with "Devel::REPL", and more are available on - the CPAN. Some of the shipped plugins are loaded in the default profile, - mentioned above. - - Writing your own plugins is not difficult, and is discussed in the - Devel::REPL::Plugin manual page, along with links to the manual pages of - all the plugins shipped with "Devel::REPL". - - The REPL shell object - From time to time you'll want to interact with or manipulate the - "Devel::REPL" shell object itself; that is, the instance of the shell - you're currently running. - - The object is always available through the $_REPL variable. One common - requirement is to load an additional plugin, after your profile and run - control files have already been executed: - - $_ $_REPL->load_plugin('Timing'); - 1 - $_ print "Hello again, world!\n" - Hello again, world! - Took 0.00148296356201172 seconds. - 1 - $_ - -REQUIREMENTS - In addition to the contents of the standard Perl distribution, you will - need the following: - - * Moose >= 0.74 - - * MooseX::Object::Pluggable >= 0.0009 - - * MooseX::Getopt >= 0.18 - - * MooseX::AttributeHelpers >= 0.16 - - * namespace::clean - - * File::HomeDir - - * Task::Weaken - - * B::Concise - - * Term::ANSIColor - - * Devel::Peek - - Optionally, some plugins if installed will require the following - modules: - - * PPI - - * Data::Dump::Streamer - - * Data::Dumper::Concise - - * File::Next - - * Sys::SigAction - - * B::Keywords - - * Lexical::Persistence - - * App::Nopaste - - * Module::Refresh - -AUTHOR - Matt S Trout - mst (at) shadowcatsystems.co.uk - () - -CONTRIBUTORS - Stevan Little - stevan (at) iinteractive.com - Alexis Sukrieh - sukria+perl (at) sukria.net - epitaph - mgrimes - mgrimes (at) cpan dot org - Shawn M Moore - sartak (at) gmail.com - Oliver Gorwits - oliver on irc.perl.org - Andrew Moore - "" - Norbert Buchmuller "" - Dave Houston "" - Chris Marshall - -LICENSE - This library is free software under the same terms as perl itself - diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/dist.ini b/dist.ini new file mode 100644 index 0000000..04c3d3c --- /dev/null +++ b/dist.ini @@ -0,0 +1,114 @@ +name = Devel-REPL +author = Matt S Trout - mst (at) shadowcatsystems.co.uk (L) +copyright_holder = Matt S Trout - mst (at) shadowcatsystems.co.uk (L) +license = Perl_5 +copyright_year = 2007 + +[@Author::ETHER] +:version = 0.021 +-remove = PodWeaver +-remove = AutoPrereqs +server = p5sagit +Authority.authority = cpan:PHAYLON +Test::MinimumVersion.max_target_perl = 5.008001 +-remove = PodCoverageTests ; XXX TODO +-remove = Test::PodSpelling ; XXX TODO +-remove = Test::UnusedVars ; XXX TODO + +[ExecDir] +dir = script + +[ContributorsFromGit] + +[Prereqs / RuntimeRequires] +; core +File::Spec = 0 +Term::ReadLine = 0 +; rest +Moose = 0.93 +MooseX::Object::Pluggable = 0.0009 +MooseX::Getopt = 0.18 +namespace::autoclean = 0 +File::HomeDir = 0 +Task::Weaken = 0 +B::Concise = 0 +Term::ANSIColor = 0 +Devel::Peek = 0 +Module::Runtime = 0 + +[Prereqs / TestRequires] +Test::More = 0.88 +Test::Warnings = 0 + +[Prereqs / RuntimeRecommends] +PPI::XS = 0.902 + + +[OptionalFeature / Completion] +:version = 0.005 +-description = Completion plugin - extensible tab completion +-always_recommend = 1 +-default = 1 +PPI = 0 + + +[OptionalFeature / DDS] +-description = DDS plugin - better format results with Data::Dump::Streamer +-always_recommend = 1 +-default = 1 +Data::Dump::Streamer = 0 + +[OptionalFeature / DDC] +-description = DDC plugin - even better format results with Data::Dumper::Concise +-always_recommend = 1 +-default = 1 +Data::Dumper::Concise = 0 + +[OptionalFeature / INC_completion] +-description = INC completion driver - tab complete module names in use and require +-always_recommend = 1 +-default = 1 +File::Next = 0 + +[OptionalFeature / Interrupt] +-description = Interrupt plugin - traps SIGINT to kill long-running lines +-always_recommend = 1 +; if we were munging Makefile.PL, we would make -default = 1 if $^O !~ /Win32/ +-default = 0 +Sys::SigAction = 0 + +[OptionalFeature / Keywords_completion] +-description = Keywords completion driver - tab complete Perl keywords and operators +-always_recommend = 1 +-default = 1 +B::Keywords = 0 + +[OptionalFeature / LexEnv] +-description = LexEnv plugin - variables declared with "my" persist between statements +-always_recommend = 1 +-default = 1 +Lexical::Persistence = 0 + +[OptionalFeature / MultiLine] +-description = MultiLine::PPI plugin - continue reading lines until all blocks are closed +-always_recommend = 1 +-default = 1 +PPI = 0 + +[OptionalFeature / Nopaste] +-description = Nopaste plugin - upload a session\'s input and output to a Pastebin +-always_recommend = 1 +-default = 0 +App::Nopaste = 0 + +[OptionalFeature / PPI] +-description = PPI plugin - PPI dumping of Perl code +-always_recommend = 1 +-default = 1 +PPI = 0 + +[OptionalFeature / Refresh] +-description = Refresh plugin - automatically reload libraries with Module::Refresh +-always_recommend = 1 +-default = 0 +Module::Refresh = 0 diff --git a/lib/Devel/REPL.pm b/lib/Devel/REPL.pm index b102b76..1836186 100644 --- a/lib/Devel/REPL.pm +++ b/lib/Devel/REPL.pm @@ -5,8 +5,6 @@ use Moose; use namespace::autoclean; use 5.008001; # backwards compat, doesn't warn like 5.8.1 -our $VERSION = '1.003020'; - with 'MooseX::Object::Pluggable'; use Devel::REPL::Error; diff --git a/lib/Devel/REPL/Overview.pod b/lib/Devel/REPL/Overview.pod index 2e643bf..2ded3f9 100644 --- a/lib/Devel/REPL/Overview.pod +++ b/lib/Devel/REPL/Overview.pod @@ -246,7 +246,7 @@ take a look at it: ### it is called on profile activation sub apply_profile { my ($self, $repl) = @_; - ### $self - no comments, $repl - current instance of Devel::REPL + ### $self - no comments, $repl - current instance of Devel::REPL $repl->load_plugin($_) for $self->plugins; ### load our plugins } diff --git a/lib/Devel/REPL/Plugin/B/Concise.pm b/lib/Devel/REPL/Plugin/B/Concise.pm index 5eceba2..95837ae 100644 --- a/lib/Devel/REPL/Plugin/B/Concise.pm +++ b/lib/Devel/REPL/Plugin/B/Concise.pm @@ -17,7 +17,7 @@ sub BEFORE_PLUGIN { sub AFTER_PLUGIN { my $self = shift; - my $prefix = $self->default_command_prefix; + my $prefix = $self->default_command_prefix; $self->add_turtles_matcher(qr/^ \#(concise) \s+ @@ -63,14 +63,14 @@ Devel::REPL::Plugin::B::Concise - B::Concise dumping of expression optrees repl> #concise -exec -terse { > foo => foo(), > } - COP (0x138b1e0) nextstate - OP (0x13bd280) pushmark - SVOP (0x138c6a0) const PV (0xbbab50) "foo" - OP (0x13bbae0) pushmark - SVOP (0x13bcee0) gv GV (0xbbb250) *Devel::REPL::Plugin::B::Concise::foo - UNOP (0x13890a0) entersub [1] - LISTOP (0x13ba020) anonhash - UNOP (0x5983d0) leavesub [1] + COP (0x138b1e0) nextstate + OP (0x13bd280) pushmark + SVOP (0x138c6a0) const PV (0xbbab50) "foo" + OP (0x13bbae0) pushmark + SVOP (0x13bcee0) gv GV (0xbbb250) *Devel::REPL::Plugin::B::Concise::foo + UNOP (0x13890a0) entersub [1] + LISTOP (0x13ba020) anonhash + UNOP (0x5983d0) leavesub [1] =head1 DESCRIPTION diff --git a/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm b/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm index a29ff8a..cdcf74f 100644 --- a/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm +++ b/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm @@ -101,7 +101,7 @@ around complete => sub { } }; - # look through all of + # look through all of INC: for (@INC) { my $path = $_; diff --git a/lib/Devel/REPL/Plugin/DumpHistory.pm b/lib/Devel/REPL/Plugin/DumpHistory.pm index 12070f6..c1d449d 100644 --- a/lib/Devel/REPL/Plugin/DumpHistory.pm +++ b/lib/Devel/REPL/Plugin/DumpHistory.pm @@ -6,7 +6,7 @@ use Devel::REPL::Plugin; use namespace::autoclean; ## Seems to be a sequence issue with requires -# requires qw{ history }; +# requires qw{ history }; around 'read' => sub { my $orig = shift; @@ -60,7 +60,7 @@ the history. =head1 DESCRIPTION -Plugin that adds the C<:dump> and C<:dump file_name> commands to the +Plugin that adds the C<:dump> and C<:dump file_name> commands to the repl which will print the history to STDOUT or append the history to the file given. diff --git a/lib/Devel/REPL/Plugin/NewlineHack.pm b/lib/Devel/REPL/Plugin/NewlineHack.pm deleted file mode 100644 index 03421cf..0000000 --- a/lib/Devel/REPL/Plugin/NewlineHack.pm +++ /dev/null @@ -1,28 +0,0 @@ -# Original comment: -# -# Adds a newline after print. Some readlines need it some don't. I guess -# we should clarify whether this is a bug and if so whose bug at some point -# but this'll do for now ;) - -package Devel::REPL::Plugin::NewlineHack; - -use Devel::REPL::Plugin; -use namespace::autoclean; - -warn < #ppi { > warn $]; > } diff --git a/lib/Devel/REPL/Plugin/ShowClass.pm b/lib/Devel/REPL/Plugin/ShowClass.pm index 7d9a3af..6388c5b 100644 --- a/lib/Devel/REPL/Plugin/ShowClass.pm +++ b/lib/Devel/REPL/Plugin/ShowClass.pm @@ -18,17 +18,17 @@ before 'eval' => sub { after 'eval' => sub { my $self = shift; - + my @metas_to_show; - + foreach my $class (Class::MOP::get_all_metaclass_names()) { unless (exists $self->metaclass_cache->{$class}) { push @metas_to_show => Class::MOP::get_metaclass_by_name($class) } - } - + } + $self->display_class($_) foreach @metas_to_show; - + $self->update_metaclass_cache; }; @@ -38,33 +38,33 @@ sub update_metaclass_cache { $self->metaclass_cache->{$class} = ( ("" . Class::MOP::get_metaclass_by_name($class)) ); - } + } } sub display_class { my ($self, $meta) = @_; $self->print('package ' . $meta->name . ";\n\n"); $self->print('extends (' . (join ", " => $meta->superclasses) . ");\n\n") if $meta->superclasses; - $self->print('with (' . (join ", " => map { $_->name } @{$meta->roles}) . ");\n\n") if $meta->can('roles'); + $self->print('with (' . (join ", " => map { $_->name } @{$meta->roles}) . ");\n\n") if $meta->can('roles'); foreach my $attr (map { $meta->get_attribute($_) } $meta->get_attribute_list) { $self->print('has ' . $attr->name . " => (\n"); - $self->print(' is => ' . $attr->_is_metadata . ",\n") if $attr->_is_metadata; - $self->print(' isa => ' . $attr->_isa_metadata . ",\n") if $attr->_isa_metadata; - $self->print(' required => ' . $attr->is_required . ",\n") if $attr->is_required; - $self->print(' lazy => ' . $attr->is_lazy . ",\n") if $attr->is_lazy; - $self->print(' coerce => ' . $attr->should_coerce . ",\n") if $attr->should_coerce; - $self->print(' is_weak_ref => ' . $attr->is_weak_ref . ",\n") if $attr->is_weak_ref; - $self->print(' auto_deref => ' . $attr->should_auto_deref . ",\n") if $attr->should_auto_deref; + $self->print(' is => ' . $attr->_is_metadata . ",\n") if $attr->_is_metadata; + $self->print(' isa => ' . $attr->_isa_metadata . ",\n") if $attr->_isa_metadata; + $self->print(' required => ' . $attr->is_required . ",\n") if $attr->is_required; + $self->print(' lazy => ' . $attr->is_lazy . ",\n") if $attr->is_lazy; + $self->print(' coerce => ' . $attr->should_coerce . ",\n") if $attr->should_coerce; + $self->print(' is_weak_ref => ' . $attr->is_weak_ref . ",\n") if $attr->is_weak_ref; + $self->print(' auto_deref => ' . $attr->should_auto_deref . ",\n") if $attr->should_auto_deref; $self->print(");\n"); $self->print("\n"); } foreach my $method_name ($meta->get_method_list) { next if $method_name eq 'meta' || $meta->get_method($method_name)->isa('Class::MOP::Method::Accessor'); - $self->print("sub $method_name { ... }\n"); - $self->print("\n"); + $self->print("sub $method_name { ... }\n"); + $self->print("\n"); } - $self->print("1;\n"); + $self->print("1;\n"); } 1; diff --git a/lib/Devel/REPL/Profile.pm b/lib/Devel/REPL/Profile.pm index c86b2ed..007702f 100644 --- a/lib/Devel/REPL/Profile.pm +++ b/lib/Devel/REPL/Profile.pm @@ -11,17 +11,17 @@ Devel::REPL::Profile =head1 SYNOPSIS package Devel::REPL::Profile::MyProject; - + use Moose; use namespace::autoclean; - + with 'Devel::REPL::Profile'; - + sub apply_profile { my ($self, $repl) = @_; # do something here } - + 1; =head1 DESCRIPTION diff --git a/script/re.pl b/script/re.pl index 7fd4791..66dd2e0 100755 --- a/script/re.pl +++ b/script/re.pl @@ -1,3 +1,4 @@ #!perl -use Devel::REPL::Script 'run'; +use Devel::REPL::Script; +Devel::REPL::Script->import('run'); # should be called 'run'