5.10 is actually required for possessive quantifiers
Dan Book [Sat, 7 Nov 2015 05:32:49 +0000 (00:32 -0500)]
.travis.yml
Build.PL [new file with mode: 0644]
INSTALL
META.json
Makefile.PL [deleted file]
cpanfile
dist.ini
lib/DOM/Tiny.pm
lib/DOM/Tiny/CSS.pm
lib/DOM/Tiny/Collection.pm
lib/DOM/Tiny/HTML.pm

index ed5c2e7..a598abc 100644 (file)
@@ -6,4 +6,3 @@ perl:
   - "5.14"
   - "5.12"
   - "5.10"
-  - "5.8"
diff --git a/Build.PL b/Build.PL
new file mode 100644 (file)
index 0000000..95b08cb
--- /dev/null
+++ b/Build.PL
@@ -0,0 +1,116 @@
+# This Build.PL for DOM-Tiny was generated by
+# Dist::Zilla::Plugin::ModuleBuildTiny::Fallback 0.020
+use strict;
+use warnings;
+
+my %configure_requires = (
+    'Module::Build::Tiny' => '0.034',
+);
+
+my @missing = grep {
+    ! eval "require $_; $_->VERSION($configure_requires{$_}); 1"
+} keys %configure_requires;
+
+if (not @missing)
+{
+    # This section for DOM-Tiny was generated by Dist::Zilla::Plugin::ModuleBuildTiny 0.014.
+    use strict;
+    use warnings;
+
+    use 5.010001;
+    # use Module::Build::Tiny 0.034;
+    Module::Build::Tiny::Build_PL();
+}
+else
+{
+    if (not $ENV{PERL_MB_FALLBACK_SILENCE_WARNING})
+    {
+        warn <<'EOW';
+*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***
+
+If you're seeing this warning, your toolchain is really, really old* and you'll
+almost certainly have problems installing CPAN modules from this century. But
+never fear, dear user, for we have the technology to fix this!
+
+If you're using CPAN.pm to install things, then you can upgrade it using:
+
+    cpan CPAN
+
+If you're using CPANPLUS to install things, then you can upgrade it using:
+
+    cpanp CPANPLUS
+
+If you're using cpanminus, you shouldn't be seeing this message in the first
+place, so please file an issue on github.
+
+This public service announcement was brought to you by the Perl Toolchain
+Gang, the irc.perl.org #toolchain IRC channel, and the number 42.
+
+----
+
+* Alternatively, you are running this file manually, in which case you need
+to learn to first fulfill all configure requires prerequisites listed in
+META.yml or META.json -- or use a cpan client to install this distribution.
+
+You can also silence this warning for future installations by setting the
+PERL_MB_FALLBACK_SILENCE_WARNING environment variable, but please don't do
+that until you fix your toolchain as described above.
+
+EOW
+        sleep 10 if -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT));
+    }
+
+
+    # This section was automatically generated by Dist::Zilla::Plugin::ModuleBuild v5.041.
+    use strict;
+    use warnings;
+
+    require Module::Build; Module::Build->VERSION(0.28);
+
+
+    my %module_build_args = (
+      "configure_requires" => {
+        "Module::Build::Tiny" => "0.034"
+      },
+      "dist_abstract" => "Minimalistic HTML/XML DOM parser with CSS selectors",
+      "dist_author" => [
+        "Dan Book <dbook\@cpan.org>"
+      ],
+      "dist_name" => "DOM-Tiny",
+      "dist_version" => "0.001",
+      "license" => "artistic_2",
+      "module_name" => "DOM::Tiny",
+      "recursive_test_files" => 1,
+      "requires" => {
+        "Carp" => 0,
+        "Class::Tiny::Chained" => 0,
+        "Exporter" => 0,
+        "List::Util" => 0,
+        "Scalar::Util" => 0,
+        "perl" => "5.010001"
+      },
+      "test_requires" => {
+        "Encode" => 0,
+        "JSON::Tiny" => "0.41",
+        "Test::More" => "0.88"
+      }
+    );
+
+
+    my %fallback_build_requires = (
+      "Encode" => 0,
+      "JSON::Tiny" => "0.41",
+      "Test::More" => "0.88"
+    );
+
+
+    unless ( eval { Module::Build->VERSION(0.4004) } ) {
+      delete $module_build_args{test_requires};
+      $module_build_args{build_requires} = \%fallback_build_requires;
+    }
+
+    my $build = Module::Build->new(%module_build_args);
+
+
+    $build->create_build_script;
+}
diff --git a/INSTALL b/INSTALL
index 52679e3..17283c8 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -24,16 +24,16 @@ Alternatively, if your CPAN shell is set up, you should just be able to do:
 As a last resort, you can manually install it. Download the tarball, untar it,
 then build it:
 
-    % perl Makefile.PL
-    % make && make test
+    % perl Build.PL
+    % ./Build && ./Build test
 
 Then install it:
 
-    % make install
+    % ./Build install
 
 If you are installing into a system-wide directory, you may need to run:
 
-    % sudo make install
+    % sudo ./Build install
 
 ## Documentation
 
index 0d1df2e..54fb65a 100644 (file)
--- a/META.json
+++ b/META.json
@@ -26,7 +26,7 @@
    "prereqs" : {
       "configure" : {
          "requires" : {
-            "ExtUtils::MakeMaker" : "0"
+            "Module::Build::Tiny" : "0.034"
          }
       },
       "develop" : {
@@ -43,7 +43,7 @@
             "Exporter" : "0",
             "List::Util" : "0",
             "Scalar::Util" : "0",
-            "perl" : "5.008001"
+            "perl" : "5.010001"
          }
       },
       "test" : {
diff --git a/Makefile.PL b/Makefile.PL
deleted file mode 100644 (file)
index 198749a..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.041.
-use strict;
-use warnings;
-
-use 5.008001;
-
-use ExtUtils::MakeMaker;
-
-my %WriteMakefileArgs = (
-  "ABSTRACT" => "Minimalistic HTML/XML DOM parser with CSS selectors",
-  "AUTHOR" => "Dan Book <dbook\@cpan.org>",
-  "CONFIGURE_REQUIRES" => {
-    "ExtUtils::MakeMaker" => 0
-  },
-  "DISTNAME" => "DOM-Tiny",
-  "LICENSE" => "artistic_2",
-  "MIN_PERL_VERSION" => "5.008001",
-  "NAME" => "DOM::Tiny",
-  "PREREQ_PM" => {
-    "Carp" => 0,
-    "Class::Tiny::Chained" => 0,
-    "Exporter" => 0,
-    "List::Util" => 0,
-    "Scalar::Util" => 0
-  },
-  "TEST_REQUIRES" => {
-    "Encode" => 0,
-    "JSON::Tiny" => "0.41",
-    "Test::More" => "0.88"
-  },
-  "VERSION" => "0.001",
-  "test" => {
-    "TESTS" => "t/*.t"
-  }
-);
-
-
-my %FallbackPrereqs = (
-  "Carp" => 0,
-  "Class::Tiny::Chained" => 0,
-  "Encode" => 0,
-  "Exporter" => 0,
-  "JSON::Tiny" => "0.41",
-  "List::Util" => 0,
-  "Scalar::Util" => 0,
-  "Test::More" => "0.88"
-);
-
-
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
-  delete $WriteMakefileArgs{TEST_REQUIRES};
-  delete $WriteMakefileArgs{BUILD_REQUIRES};
-  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
-}
-
-delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
-  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
-
-WriteMakefile(%WriteMakefileArgs);
index ae29cc4..fdecdae 100644 (file)
--- a/cpanfile
+++ b/cpanfile
@@ -1,4 +1,4 @@
-requires 'perl' => '5.008001';
+requires 'perl' => '5.010001';
 requires 'Carp';
 requires 'Class::Tiny::Chained';
 requires 'Exporter';
index 2ae7152..c203e92 100644 (file)
--- a/dist.ini
+++ b/dist.ini
@@ -5,4 +5,5 @@ copyright_holder = Dan Book
 copyright_year   = 2015
 
 [@Author::DBOOK]
+installer = ModuleBuildTiny::Fallback
 pod_tests = 1
index 84dfeea..8c208c7 100644 (file)
@@ -164,10 +164,8 @@ sub type { shift->tree->[0] }
 sub val {
   my $self = shift;
 
-  my $tag = $self->tag;
-
   # "option"
-  return defined $self->{value} ? $self->{value} : $self->text if $tag eq 'option';
+  return $self->{value} // $self->text if (my $tag = $self->tag) eq 'option';
 
   # "textarea", "input" or "button"
   return $tag eq 'textarea' ? $self->text : $self->{value} if $tag ne 'select';
index a694186..dbe552a 100644 (file)
@@ -98,9 +98,7 @@ sub _compile {
 
     # Attributes
     elsif ($css =~ /\G$ATTR_RE/gco) {
-      my $op = defined $2 ? $2 : '';
-      my $value = defined $3 ? $3 : (defined $4 ? $4 : $5);
-      push @$last, ['attr', _name($1), _value($op, $value, $6)];
+      push @$last, ['attr', _name($1), _value($2 // '', $3 // $4 // $5, $6)];
     }
 
     # Pseudo-class (":not" contains more selectors)
@@ -135,7 +133,7 @@ sub _equation {
   return $num if $equation !~ /(?:(-?(?:\d+)?)?(n))?\s*\+?\s*(-?\s*\d+)?\s*$/i;
   $num->[0] = defined($1) && $1 ne '' ? $1 : $2 ? 1 : 0;
   $num->[0] = -1 if $num->[0] eq '-';
-  $num->[1] = $3 || 0;
+  $num->[1] = $3 // 0;
   $num->[1] =~ s/\s+//g;
   return $num;
 }
index 4068fa5..709a1c1 100644 (file)
@@ -49,7 +49,7 @@ sub grep {
 }
 
 sub join {
-  join +(defined $_[1] ? $_[1] : ''), map {"$_"} @{$_[0]};
+  join $_[1] // '', map {"$_"} @{$_[0]};
 }
 
 sub last { shift->[-1] }
index 48a89e0..faec2f5 100644 (file)
@@ -121,7 +121,7 @@ sub parse {
         # Attributes
         my (%attrs, $closing);
         while ($attr =~ /$ATTR_RE/go) {
-          my ($key, $value) = ($xml ? $1 : lc $1, defined $3 ? $3 : $4);
+          my ($key, $value) = ($xml ? $1 : lc $1, $3 // $4);
 
           # Empty tag
           ++$closing and next if $key eq '/';