Skip to content

Commit bfeb5aa

Browse files
author
Chris White
committed
Add Axk.pm, META_MERGE; move O::TinyDefaults->X::A
- New package XML::Axk to meet CPAN requirements - Added META_MERGE and other information to Makefile.PL - Moved Object::TinyDefaults under the XML::Axk hierarchy since it will disappear in the future anyway.
1 parent 43645d6 commit bfeb5aa

File tree

11 files changed

+124
-33
lines changed

11 files changed

+124
-33
lines changed

Changes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Revision history for XML-Axk
22

3-
0.001004 2019-02-14
3+
0.001006 2019-02-14
44
No substantive changes
55

66
0.001_003 2018-11-10

MANIFEST

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
bin/axk
22
Changes
3-
lib/Object/TinyDefaults.pm
3+
lib/XML/Axk.pm
44
lib/XML/Axk/App.pm
55
lib/XML/Axk/Base.pm
66
lib/XML/Axk/Core.pm
@@ -11,6 +11,7 @@ lib/XML/Axk/L/LTEST.pm
1111
lib/XML/Axk/Language.pm
1212
lib/XML/Axk/Matcher/Always.pm
1313
lib/XML/Axk/Matcher/XPath.pm
14+
lib/XML/Axk/Object/TinyDefaults.pm
1415
lib/XML/Axk/Preparse.pm
1516
lib/XML/Axk/Sandbox.pm
1617
lib/XML/Axk/SAX/BuildDOM2.pm

Makefile.PL

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,19 @@ use strict;
33
use warnings;
44
use Config;
55
use ExtUtils::MakeMaker;
6+
use File::Spec;
67

7-
# Get the filename of the Perl interpreter running this. Modified from perlvar.
8+
my $VERSION_FROM = File::Spec->catfile(qw(lib XML Axk.pm));
9+
# Module metadata {{{1
10+
my $provides;
11+
eval {
12+
require Module::Metadata;
13+
$provides = Module::Metadata->provides(version => '2', dir => 'lib');
14+
# Thanks to https://stackoverflow.com/a/28928985/2877364 by LEONT
15+
};
16+
# }}}1
17+
# Get the filename of the Perl interpreter running this. {{{1
18+
# Modified from perlvar.
819
# The -x test is for cygwin or other systems where $Config{perlpath} has no
920
# extension and $Config{_exe} is nonempty. E.g., symlink perl->perl5.10.1.exe.
1021
# There is no "perl.exe" on such a system.
@@ -17,9 +28,11 @@ sub get_perl_filename {
1728
}
1829
return $secure_perl_path;
1930
} # get_perl_filename()
31+
# }}}1
2032

2133
my $secure_perl_path = get_perl_filename();
2234

35+
# Makefile customization {{{1
2336
sub MY::postamble { # TODO also handle Windows nmake syntax (SET vs. export)
2437
return <<EOT;
2538
@@ -52,18 +65,21 @@ testhere: actually_uninstall
5265
EOT
5366

5467
} #postamble
68+
# }}}1
5569

56-
WriteMakefile(
70+
# Main options for EUMM
71+
my %opts = (
5772
NAME => 'XML::Axk',
5873
AUTHOR => q{Christopher White <[email protected]>},
59-
VERSION_FROM => 'lib/XML/Axk/App.pm',
74+
VERSION_FROM => $VERSION_FROM,
6075
ABSTRACT => 'awk-like XML processor',
6176
LICENSE => 'artistic_2',
62-
EXE_FILES => [ 'bin/axk' ],
77+
EXE_FILES => [ File::Spec->catfile(qw(bin axk)) ],
6378
MIN_PERL_VERSION => '5.020',
6479
CONFIGURE_REQUIRES => {
6580
'Config' => '0',
6681
'ExtUtils::MakeMaker' => '0',
82+
'File::Spec' => '0',
6783
'strict' => '0',
6884
'version' => '0.77',
6985
'warnings' => '0',
@@ -107,5 +123,34 @@ WriteMakefile(
107123
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz', },
108124
clean => { FILES => 'XML-Axk-*' },
109125
depend => { Makefile => '$(VERSION_FROM)' },
126+
127+
META_MERGE => {
128+
'meta-spec' => { version => 2 },
129+
130+
resources => {
131+
bugtracker => {
132+
web => 'https://github.com/interpreters/axk/issues',
133+
},
134+
repository => {
135+
type => 'git',
136+
url => 'https://github.com/interpreters/axk.git',
137+
web => 'https://github.com/interpreters/axk',
138+
},
139+
},
140+
141+
prereqs => {
142+
develop => {
143+
requires => {
144+
'App::RewriteVersion' => '0', # for perl-bump-version
145+
'Module::Metadata' => '1.000016',
146+
},
147+
},
148+
},
149+
150+
$provides ? (provides => $provides) : (),
151+
152+
}, #META_MERGE
110153
);
111-
# vi: set ts=4 sts=4 sw=4 et ai: #
154+
155+
WriteMakefile(%opts);
156+
# vi: set ts=4 sts=4 sw=4 et ai fdm=marker: #

lib/XML/Axk.pm

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# XML::Axk - top-level module for XML::Axk distribution.
2+
# This holds the main version, but doesn't do anything else at the moment.
3+
package XML::Axk;
4+
use strict;
5+
use warnings;
6+
use Data::Hopen;
7+
use Data::Hopen::Base;
8+
9+
our $VERSION = '0.001006';
10+
11+
#use parent 'Exporter';
12+
#our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
13+
#BEGIN {
14+
# @EXPORT = qw();
15+
# @EXPORT_OK = qw();
16+
# %EXPORT_TAGS = (
17+
# default => [@EXPORT],
18+
# all => [@EXPORT, @EXPORT_OK]
19+
# );
20+
#}
21+
22+
# Docs {{{1
23+
24+
=head1 NAME
25+
26+
XML::Axk - tools for processing XML files with an awk-like model
27+
28+
=head1 SYNOPSIS
29+
30+
See L<XML::Axk::App> for command-line usage and L<XML::Axk::Core> for
31+
embedded usage in other Perl scripts.
32+
33+
=cut
34+
35+
# }}}1
36+
37+
1;
38+
__END__
39+
# vi: set fdm=marker: #

lib/XML/Axk/App.pm

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#!perl
12
package XML::Axk::App;
23
use XML::Axk::Base;
34
use XML::Axk::Core;
@@ -7,7 +8,7 @@ use XML::Axk::Core;
78
# Semantic versioning, packed per Perl rules. Must always be at least one
89
# digit left of the decimal, and six digits right of the decimal. For
910
# prerelease versions, put an underscore before the last three digits.
10-
our $VERSION = '0.001004';
11+
our $VERSION = '0.001006';
1112

1213
use Getopt::Long qw(GetOptionsFromArray :config gnu_getopt);
1314

lib/XML/Axk/Core.pm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env perl
1+
#!perl
22
# Copyright (c) 2018 cxw42. All rights reserved. Artistic 2.
33

44
# Style note: Hungarian prefixes are used on scalars:
@@ -11,6 +11,8 @@ use XML::Axk::Base qw(:all);
1111
use XML::Axk::Preparse;
1212
use Data::Dumper;
1313

14+
our $VERSION = '0.001006';
15+
1416
=encoding UTF-8
1517
1618
=head1 NAME

lib/XML/Axk/Matcher/Always.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package XML::Axk::Matcher::Always;
66
use XML::Axk::Base;
77

8-
use Object::TinyDefaults { always => true };
8+
use XML::Axk::Object::TinyDefaults { always => true };
99

1010
sub test {
1111
my $self = shift;

lib/XML/Axk/Matcher/XPath.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use XML::Axk::DOM;
99

1010
our $VERBOSE = 0;
1111

12-
use Object::TinyDefaults
12+
use XML::Axk::Object::TinyDefaults
1313
{ kind => 'xpath',
1414
file => '(unknown source)',
1515
line => 0

lib/Object/TinyDefaults.pm renamed to lib/XML/Axk/Object/TinyDefaults.pm

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env perl
2-
# Object::TinyDefaults - Object::Tiny::XS, but with default values.
2+
# XML::Axk::Object::TinyDefaults - Object::Tiny::XS, but with default values.
33
# Copyright (c) 2018 cxw42. All rights reserved. Artistic 2.
44

5-
package Object::TinyDefaults;
5+
package XML::Axk::Object::TinyDefaults;
66

77
use 5.004;
88
use strict 'vars', 'subs';
@@ -11,8 +11,7 @@ use Data::Dumper;
1111
use Import::Into;
1212

1313
our $ObjTiny;
14-
our $VERSION;
15-
$VERSION = '0.01';
14+
our $VERSION = '0.001006';
1615

1716
BEGIN {
1817
require parent;
@@ -83,12 +82,12 @@ __END__
8382
8483
=head1 NAME
8584
86-
Object::TinyDefaults - Object::Tiny[::XS] wrapper that adds default values
85+
XML::Axk::Object::TinyDefaults - Object::Tiny[::XS] wrapper that adds default values
8786
8887
=head1 SYNOPSIS
8988
9089
package MyClass;
91-
use Object::TinyDefaults { foo => 42 } qw(bar bat);
90+
use XML::Axk::Object::TinyDefaults { foo => 42 } qw(bar bat);
9291
9392
package main;
9493
my $inst = MyClass->new(bar=>1);
@@ -98,6 +97,8 @@ C<foo=42> and C<bar=1>.
9897
9998
Requires L<Object::Tiny> or L<Object::Tiny::XS>. XS will be used if available.
10099
100+
TODO replace this with L<Class::Tiny>!
101+
101102
=head1 COPYRIGHT
102103
103104
Copyright (c) 2018 Christopher White. All rights reserved.

t/00-load.t

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@
22
use 5.020;
33
use strict;
44
use warnings;
5-
use Test::More tests => 4;
5+
use Test::More tests => 6;
66
use Module::Loaded;
77

88
BEGIN {
9-
use_ok( 'XML::Axk::App' ) || print "Could not load App\n";
10-
use_ok( 'XML::Axk::Core' ) || print "Could not load Core\n";
9+
use_ok( 'XML::Axk' ) || print "Could not load XML::Axk\n";
10+
use_ok( 'XML::Axk::App' ) || print "Could not load XML::Axk::App\n";
11+
use_ok( 'XML::Axk::Core' ) || print "Could not load XML::Axk::Core\n";
1112
}
1213

1314
diag( "Testing XML::Axk $XML::Axk::App::VERSION, Perl $], $^X" );
14-
ok(is_loaded("XML::Axk::App"), "App is loaded");
15-
ok(is_loaded("XML::Axk::Core"), "Core is loaded");
15+
ok(is_loaded("XML::Axk"), "XML::Axk is loaded");
16+
ok(is_loaded("XML::Axk::App"), "XML::Axk::App is loaded");
17+
ok(is_loaded("XML::Axk::Core"), "XML::Axk::Core is loaded");
1618

1719
# vi: set ts=4 sts=4 sw=4 et ai: #

0 commit comments

Comments
 (0)