4
4
package Text::PerlPP ;
5
5
6
6
# Semantic versioning, packed per Perl rules. Must always be at least one
7
- # digit left of the decimal, and six digits right of the decimal.
8
- our $VERSION = ' 0.600_000' ;
7
+ # digit left of the decimal, and six digits right of the decimal. For
8
+ # prerelease versions, put an underscore before the last three digits.
9
+ our $VERSION = ' 0.600001' ;
9
10
10
11
use 5.010001;
11
12
use strict;
@@ -815,26 +816,25 @@ sub Main {
815
816
return EXIT_OK;
816
817
}
817
818
818
- # Preamble
819
-
820
819
# Save
821
820
push @Instances , $self ;
822
821
823
822
$self -> {Package } = $self -> {Opts }-> {INPUT_FILENAME };
824
823
$self -> {Package } =~ s / ^.*?([a-z_][a-z_0-9.]*).pl?$/ $1 / i ;
825
824
$self -> {Package } =~ s / [^a-z0-9_]/ _/ gi ;
826
- # $self->{Package} is not the whole name, so can start with a number.
825
+ # Not the whole name yet , so can start with a number.
827
826
$self -> {Package } = " PPP_$self ->{Package}$#Instances " ;
828
827
829
828
# Make $self accessible from inside the package.
830
829
# This has to happen first so that :macro or :immediate blocks in the
831
830
# script can access it while the input is being parsed.
832
831
{
833
832
no strict ' refs' ;
834
- ${ " $self ->{Package}::" . PPP_SELF_INSIDE }
835
- = $Text::PerlPP::Instances [$#Instances ];
833
+ ${ " $self ->{Package}::" . PPP_SELF_INSIDE } = $self ;
836
834
}
837
835
836
+ # --- Preamble -----------
837
+
838
838
$self -> StartOB(); # Output from here on will be included in the generated script
839
839
840
840
# Help the user know where to look
@@ -846,7 +846,7 @@ sub Main {
846
846
emit " use constant { true => !!1, false => !!0 };\n " ;
847
847
emit ' our $' . PPP_SELF_INSIDE . " ;\n " ; # Lexical alias for $self
848
848
849
- # Definitions
849
+ # --- Definitions --------
850
850
851
851
# Transfer parameters from the command line (-D) to the processed file,
852
852
# as textual representations of expressions.
@@ -910,6 +910,8 @@ sub Main {
910
910
}
911
911
emit " );\n " ;
912
912
913
+ # --- User input ---------
914
+
913
915
# Initial code from the command line, if any
914
916
if ($self -> {Opts }-> {EVAL }) {
915
917
$self -> emit_pound_line( ' <-e>' , 1 );
@@ -921,7 +923,7 @@ sub Main {
921
923
922
924
my $script = $self -> EndOB(); # The generated Perl script
923
925
924
- # --- Run it ---
926
+ # --- Run it -------------
925
927
if ( $self -> {Opts }-> {DEBUG } ) {
926
928
print $script ;
927
929
0 commit comments