This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Add specifiable construction handler for Input_file class
authorKarl Williamson <khw@cpan.org>
Mon, 27 Jul 2015 03:30:07 +0000 (21:30 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 29 Jul 2015 04:15:57 +0000 (22:15 -0600)
This object is for the files in the Unicode Character Database.  This
commit adds the capability for the constructor new() to be passed a code
reference to call after everything else is constructed, but before
control is returned.

charclass_invlists.h
lib/unicore/mktables
regcharclass.h

index d8dae29..b127bab 100644 (file)
@@ -99521,7 +99521,7 @@ static const UV XPosixXDigit_invlist[] = { /* for EBCDIC POSIX-BC */
  * 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
  * 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
  * a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * 3e5d72e6b1f87e746fa1bc36c92cb1e29eaf458f1ff70a6cfdf840a0537cdaf1 lib/unicore/mktables
+ * 2a67aa5828e35ee78f396604d0475d471e6d65283ff64116652d45a5a7cd7d88 lib/unicore/mktables
  * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
  * c6884f4d629f04d1316f3476cb1050b6a1b98ca30c903262955d4eae337c6b1e regen/charset_translations.pl
  * 7b6f61662df48e0cbfb234a926e02e5cb9468af052f7f9feb84285996f30df09 regen/mk_invlists.pl
index a1c9f3c..95d9830 100644 (file)
@@ -2115,6 +2115,7 @@ package Input_file;
 # while(next_line()) {...} loop.
 #
 # You can also set up handlers to
+#   0) call during object construction time, after everything else is done
 #   1) call before the first line is read, for pre processing
 #   2) call to adjust each line of the input before the main handler gets
 #      them.  This can be automatically generated, if appropriately simple
@@ -2230,6 +2231,12 @@ sub trace { return main::trace(@_); }
     main::set_access('has_missings_defaults',
                                         \%has_missings_defaults, qw{ c r });
 
+    my %construction_time_handler;
+    # Subroutine to call at the end of the new method.  If undef, no such
+    # handler is called.
+    main::set_access('construction_time_handler',
+                                        \%construction_time_handler, qw{ c });
+
     my %pre_handler;
     # Subroutine to call before doing anything else in the file.  If undef, no
     # such handler is called.
@@ -2471,6 +2478,9 @@ sub trace { return main::trace(@_); }
                          : *_next_line;
         }
 
+        &{$construction_time_handler{$addr}}($self)
+                                        if $construction_time_handler{$addr};
+
         return $self;
     }
 
index 3d09a03..fa1e5a5 100644 (file)
  * 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
  * 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
  * a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * 3e5d72e6b1f87e746fa1bc36c92cb1e29eaf458f1ff70a6cfdf840a0537cdaf1 lib/unicore/mktables
+ * 2a67aa5828e35ee78f396604d0475d471e6d65283ff64116652d45a5a7cd7d88 lib/unicore/mktables
  * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
  * c6884f4d629f04d1316f3476cb1050b6a1b98ca30c903262955d4eae337c6b1e regen/charset_translations.pl
  * d9c04ac46bdd81bb3e26519f2b8eb6242cb12337205add3f7cf092b0c58dccc4 regen/regcharclass.pl