use warnings;
use 5.008001;
-our $VERSION = '0.005000';
+our $VERSION = '0.006022';
+$VERSION =~ tr/_//d;
use constant DECLARE_NAME => 1;
use constant DECLARE_PROTO => 2;
use constant DECLARE_NONE => 4;
use constant DECLARE_PACKAGE => 8+1; # name implicit
-use vars qw(%declarators %declarator_handlers @ISA);
+our (%declarators, %declarator_handlers, @ISA);
use base qw(DynaLoader);
use Scalar::Util 'set_prototype';
-use B::Hooks::OP::Check;
-
-bootstrap Devel::Declare;
+use B::Hooks::OP::Check 0.19;
+Devel::Declare->bootstrap;
@ISA = ();
+initialize();
+
sub import {
my ($class, %args) = @_;
my $target = caller;
=head1 NAME
-Devel::Declare - Adding keywords to perl, in perl
+Devel::Declare - (DEPRECATED) Adding keywords to perl, in perl
=head1 SYNOPSIS
This document describes how to create a simple declarator.
+=head1 WARNING
+
+=for comment mst wrote this warning for MooseX::Declare, and ether adapted it for here:
+
+B<Warning:> Devel::Declare is a giant bag of crack
+originally implemented by mst with the goal of upsetting the perl core
+developers so much by its very existence that they implemented proper
+keyword handling in the core.
+
+As of perl5 version 14, this goal has been achieved, and modules such
+as L<Devel::CallParser>, L<Function::Parameters>, and L<Keyword::Simple> provide
+mechanisms to mangle perl syntax that don't require hallucinogenic
+drugs to interpret the error messages they produce.
+
+If you are using something that uses Devel::Declare, please for the love
+of kittens use something else:
+
+=over 4
+
+=item *
+
+Instead of L<TryCatch>, use L<Syntax::Keyword::Try> or L<Try::Tiny>
+
+=item *
+
+Instead of L<Method::Signatures>, use
+L<real subroutine signatures|perlsub/Signatures> (requires perl 5.22) or L<Moops>
+
+=back
+
+If you are a maintainer of something that uses Devel::Declare itself, please take a look at the
+more modern and robust alternatives, such as L<Keyword::Declare>, L<Keyword::Simple> or using
+L<perlapi/PL_keyword_plugin> in XS directly.
+
=head1 USAGE
We'll demonstrate the usage of C<Devel::Declare> with a motivating example: a new
=head4 C<set_linestr>
This builtin sets the full text of the current line of the source document.
+Beware that injecting a newline into the middle of the line is likely
+to fail in surprising ways. Generally, Perl's parser can rely on the
+`current line' actually being only a single line. Use other kinds of
+whitespace instead, in the code that you inject.
=head3 C<skipspace>
Also it Does The Right Thing with nested delimiters (like C<q(this (is (a) quote))>).
-It returns the length of the expression matched. Use C<get_lex_stuff> to
-get the actual matched text.
+It returns the effective length of the expression matched. Really, what
+it returns is the difference in position between where the string started,
+within the buffer, and where it finished. If the string extended across
+multiple lines then the contents of the buffer may have been completely
+replaced by the new lines, so this position difference is not the same
+thing as the actual length of the expression matched. However, because
+moving backward in the buffer causes problems, the function arranges
+for the effective length to always be positive, padding the start of
+the buffer if necessary.
+
+Use C<get_lex_stuff> to get the actual matched text, the content of
+the string. Because of the behaviour around multiline strings, you
+can't reliably get this from the buffer. In fact, after the function
+returns, you can't rely on any content of the buffer preceding the end
+of the string.
+
+If the string being scanned is not well formed (has no closing delimiter),
+C<toke_scan_str> returns C<undef>. In this case you cannot rely on the
+contents of the buffer.
=head4 C<get_lex_stuff>
return ' BEGIN { MethodHandlers::inject_scope }; ';
}
-So at the beginning of every method, we assing a callback that will get invoked
+So at the beginning of every method, we are passing a callback that will get invoked
at the I<end> of the method's compilation... i.e. exactly then the closing C<'}'>
is compiled.
=head1 AUTHORS
-Matt S Trout - <mst@shadowcat.co.uk> - original author
+Matt S Trout - E<lt>mst@shadowcat.co.ukE<gt> - original author
Company: http://www.shadowcat.co.uk/
Blog: http://chainsawblues.vox.com/
Florian Ragwitz E<lt>rafl@debian.orgE<gt> - maintainer
-osfameron E<lt>osfameron@cpan.org<gt> - first draft of documentation
+osfameron E<lt>osfameron@cpan.orgE<gt> - first draft of documentation
-=head1 LICENSE
+=head1 COPYRIGHT AND LICENSE
This library is free software under the same terms as perl itself
+Copyright (c) 2007, 2008, 2009 Matt S Trout
+
+Copyright (c) 2008, 2009 Florian Ragwitz
+
+stolen_chunk_of_toke.c based on toke.c from the perl core, which is
+
+Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+2000, 2001, 2002, 2003, 2004, 2005, 2006, by Larry Wall and others
+
=cut
1;