View | Details | Raw Unified | Return to bug 143527
Collapse All | Expand All

(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/Makefile (-1 / +1 lines)
Lines 6-12 Link Here
6
#
6
#
7
7
8
PORTNAME=	Test-Module-Used
8
PORTNAME=	Test-Module-Used
9
PORTVERSION=	0.1.8
9
PORTVERSION=	0.1.9
10
CATEGORIES=	devel perl5
10
CATEGORIES=	devel perl5
11
MASTER_SITES=	CPAN
11
MASTER_SITES=	CPAN
12
PKGNAMEPREFIX=	p5-
12
PKGNAMEPREFIX=	p5-
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (Test-Module-Used-0.1.8.tar.gz) = 4fe2c075f39832e15cfecbde06dd38c0
1
MD5 (Test-Module-Used-0.1.9.tar.gz) = b8dde9e0e427e01cefe89b3491792ebd
2
SHA256 (Test-Module-Used-0.1.8.tar.gz) = 91d31fa0cfa053f816f4ca49eee0ddfeff2ae98d86184e8717d1d9e887cbd0b2
2
SHA256 (Test-Module-Used-0.1.9.tar.gz) = 58d3926006f0b756a0f9ff3379a87f28cf2ed8988a8c0e944643623249e24487
3
SIZE (Test-Module-Used-0.1.8.tar.gz) = 20781
3
SIZE (Test-Module-Used-0.1.9.tar.gz) = 20867
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/.PLIST.flattened (-3 lines)
Lines 1-3 Link Here
1
/usr/local/lib/perl5/5.10.1/man/man3/Test::Module::Used.3.gz
2
/usr/local/lib/perl5/site_perl/5.10.1/Test/Module/Used.pm
3
/usr/local/lib/perl5/site_perl/5.10.1/mach/auto/Test/Module/Used/.packlist
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/.PLIST.mktmp (-7 lines)
Lines 1-7 Link Here
1
lib/perl5/5.10.1/man/man3/Test::Module::Used.3.gz
2
@unexec rm -f %D/lib/perl5/5.10.1/man/cat3/Test::Module::Used.3.gz %D/lib/perl5/5.10.1/man/cat3/Test::Module::Used.3 %D/lib/perl5/5.10.1/man/cat3/Test::Module::Used.3.gz %D/lib/perl5/5.10.1/man/cat3/Test::Module::Used.3.gz.gz %D/lib/perl5/5.10.1/man/cat3/Test::Module::Used.3.gz.bz2
3
lib/perl5/site_perl/5.10.1/Test/Module/Used.pm
4
lib/perl5/site_perl/5.10.1/mach/auto/Test/Module/Used/.packlist
5
@dirrm lib/perl5/site_perl/5.10.1/mach/auto/Test/Module/Used
6
@unexec rmdir %D/lib/perl5/site_perl/5.10.1/mach/auto/Test/Module 2>/dev/null || true
7
@unexec rmdir %D/lib/perl5/site_perl/5.10.1/Test/Module 2>/dev/null || true
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/ChangeLog (-106 lines)
Lines 1-106 Link Here
1
2010-01-12  Takuya Tsuchida  <tsucchi@cpan.org>
2
3
	* 0.1.8
4
	remove executable permission in Makefile.PL
5
6
2010-01-03  Takuya Tsuchida  <tsucchi@cpan.org>
7
	* 0.1.7
8
	add repository in Makefile.PL
9
	(merge from git://github.com/cpanservice/Test-Module-Used.git)
10
	
11
	* 0.1.6
12
	fix: add copyright information(for RT#53290)
13
14
2009-12-30  Takuya Tsuchida  <tsucchi@cpan.org>
15
16
	* 0.1.5
17
	fix: insufficient version of version.pm specified.
18
19
2009-12-25  Takuya Tsuchida  <tsucchi@cpan.org>
20
21
	* 0.1.4
22
	improve error messages when test fails.
23
24
2009-12-24  Takuya Tsuchida  <tsucchi@cpan.org>
25
26
	* 0.1.3_02
27
	fix: POD structure(chaptering) is insufficient.
28
29
30
2009-12-24  Takuya Tsuchida  <tsucchi@cpan.org>
31
32
	* 0.1.3_01
33
	deprecated parameters are deleted
34
	read perl version from META.yml and NOT from *.pm
35
36
2009-12-09  Takuya Tsuchida  <tsucchi@cpan.org>
37
38
	* 0.1.2
39
	add parameter 'test_lib_dir' in constructor
40
	and automatically push exclude_in_testdir to modules which are in
41
	test_lib_dir.
42
43
2009-12-07  Takuya Tsuchida  <tsucchi@cpan.org>
44
45
	* 0.1.1
46
	fix: failed if package statement doesn't exist in *.pm file.
47
48
2009-12-07  Takuya Tsuchida  <tsucchi@cpan.org>
49
50
	* 0.1.0
51
	fix: fix again test failed in windows environment
52
	remove all slash directory separator, and instead of using catfile().
53
54
2009-12-04  Takuya Tsuchida  <tsucchi@cpan.org>
55
56
	* 0.0.9
57
	fix: test failed in windows environment
58
59
2009-12-02  Takuya Tsuchida  <tsucchi@cpan.org>
60
61
	* 0.0.8
62
	implement push_exclude_in_{test,module}dir(), it enables
63
	set exclude_in_{test,module}dir after new()
64
65
2009-12-01  Takuya Tsuchida  <tsucchi@cpan.org>
66
67
	* 0.0.7
68
	fix: bugs in version fetching from file.
69
70
2009-11-29  Takuya Tsuchida  <tsucchi@cpan.org>
71
72
	* 0.0.6
73
	refactoring methods and some optimization
74
	find bug in handling core module
75
76
2009-11-28  Takuya Tsuchida  <tsucchi@cpan.org>
77
78
	* 0.0.5
79
	fix: test faild in windows environment
80
81
2009-11-27  Takuya Tsuchida  <tsucchi@cpan.org>
82
83
	* 0.0.4
84
	found bug in ok(module_requires exclude)
85
	add build_requires and requires exclusion in constructor
86
	
87
88
2009-11-24  Takuya Tsuchida  <tsucchi@cpan.org>
89
90
	* 0.0.3
91
	add ChangeLog and README
92
	describe about perl_version
93
	bug fix (failed when test is empty)
94
	parse perlversion using Perl::MinimumVersion
95
96
2009-11-23  Takuya Tsuchida  <tsucchi@cpan.org>
97
98
	* 0.0.2
99
	fix insufficient index(set no_index to testdata)
100
101
	
102
2009-11-22  Takuya Tsuchida  <tsucchi@cpan.org>
103
104
	* 0.0.1
105
	initial release
106
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/MANIFEST (-33 lines)
Lines 1-33 Link Here
1
ChangeLog
2
inc/Module/Install.pm
3
inc/Module/Install/AuthorTests.pm
4
inc/Module/Install/Base.pm
5
inc/Module/Install/Can.pm
6
inc/Module/Install/Fetch.pm
7
inc/Module/Install/Makefile.pm
8
inc/Module/Install/Metadata.pm
9
inc/Module/Install/Win32.pm
10
inc/Module/Install/WriteAll.pm
11
lib/Test/Module/Used.pm
12
Makefile.PL
13
MANIFEST			This list of files
14
META.yml
15
README
16
t/001_use_ok.t
17
t/002_default.t
18
t/003_option.t
19
t/004_used_ok.t
20
t/005_used_module.t
21
t/006_read_meta_yml.t
22
t/007_test_myself.t
23
t/008_test_is_empty.t
24
t/009_auto_get_exclude.t
25
t/010_test_myself2.t
26
testdata/lib/SampleModule.pm
27
testdata/lib2/My/Test.pm
28
testdata/META.yml
29
testdata/META.yml2
30
testdata/META.yml3
31
testdata/t/001_test.t
32
testdata/t2/001_use_ok.t
33
testdata/t2/lib/My/Test2.pm
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/META.yml (-34 lines)
Lines 1-34 Link Here
1
---
2
abstract: 'Test required module is really used and vice versa bitween lib/t and META.yml'
3
author:
4
  - 'Takuya Tsuchida tsucchi@cpan.org'
5
build_requires:
6
  ExtUtils::MakeMaker: 6.42
7
  Test::More: 0
8
configure_requires:
9
  ExtUtils::MakeMaker: 6.42
10
distribution_type: module
11
generated_by: 'Module::Install version 0.91'
12
license: perl
13
meta-spec:
14
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
15
  version: 1.4
16
name: Test-Module-Used
17
no_index:
18
  directory:
19
    - inc
20
    - t
21
    - testdata
22
    - xt
23
requires:
24
  List::MoreUtils: 0
25
  Module::CoreList: 0
26
  Module::Used: 0
27
  PPI::Document: 0
28
  YAML: 0
29
  perl: 5.8.0
30
  version: 0.77
31
resources:
32
  license: http://dev.perl.org/licenses/
33
  repository: http://github.com/tsucchi/Test-Module-Used
34
version: 0.1.8
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/Makefile (-809 lines)
Lines 1-809 Link Here
1
# This Makefile is for the Test::Module::Used extension to perl.
2
#
3
# It was generated automatically by MakeMaker version
4
# 6.55_02 (Revision: 65502) from the contents of
5
# Makefile.PL. Don't edit this file, edit Makefile.PL instead.
6
#
7
#       ANY CHANGES MADE HERE WILL BE LOST!
8
#
9
#   MakeMaker ARGV: (q[INSTALLDIRS=site], q[CC=cc], q[CCFLAGS=-O2 -pipe -fno-strict-aliasing], q[PREFIX=/usr/local], q[INSTALLPRIVLIB=/usr/local/lib], q[INSTALLARCHLIB=/usr/local/lib])
10
#
11
12
#   MakeMaker Parameters:
13
14
#     ABSTRACT => q[Test required module is really used and vice versa bitween lib/t and META.yml]
15
#     AUTHOR => q[Takuya Tsuchida tsucchi@cpan.org]
16
#     BUILD_REQUIRES => {  }
17
#     DIR => []
18
#     DISTNAME => q[Test-Module-Used]
19
#     NAME => q[Test::Module::Used]
20
#     NO_META => q[1]
21
#     PL_FILES => {  }
22
#     PREREQ_PM => { YAML=>q[0], Module::Used=>q[0], ExtUtils::MakeMaker=>q[6.42], version=>q[0.77], Test::More=>q[0], PPI::Document=>q[0], Module::CoreList=>q[0], List::MoreUtils=>q[0] }
23
#     VERSION => q[0.1.8]
24
#     dist => {  }
25
#     realclean => { FILES=>q[MYMETA.yml] }
26
27
# --- MakeMaker post_initialize section:
28
29
30
# --- MakeMaker const_config section:
31
32
# These definitions are from config.sh (via /usr/local/lib/perl5/5.10.1/mach/Config.pm).
33
# They may have been overridden via Makefile.PL or on the command line.
34
AR = ar
35
CC = cc
36
CCCDLFLAGS = -DPIC -fPIC
37
CCDLFLAGS =   -Wl,-R/usr/local/lib/perl5/5.10.1/mach/CORE
38
DLEXT = so
39
DLSRC = dl_dlopen.xs
40
EXE_EXT = 
41
FULL_AR = /usr/bin/ar
42
LD = cc
43
LDDLFLAGS = -shared  -L/usr/local/lib -fstack-protector
44
LDFLAGS =  -Wl,-E  -fstack-protector -L/usr/local/lib
45
LIBC = 
46
LIB_EXT = .a
47
OBJ_EXT = .o
48
OSNAME = freebsd
49
OSVERS = 8.0-release
50
RANLIB = :
51
SITELIBEXP = /usr/local/lib/perl5/site_perl/5.10.1
52
SITEARCHEXP = /usr/local/lib/perl5/site_perl/5.10.1/mach
53
SO = so
54
VENDORARCHEXP = $(VENDORPREFIX)/lib/perl5/5.10.1/i386-freebsd-64int
55
VENDORLIBEXP = $(VENDORPREFIX)/lib/perl5
56
57
58
# --- MakeMaker constants section:
59
AR_STATIC_ARGS = cr
60
DIRFILESEP = /
61
DFSEP = $(DIRFILESEP)
62
NAME = Test::Module::Used
63
NAME_SYM = Test_Module_Used
64
VERSION = 0.1.8
65
VERSION_MACRO = VERSION
66
VERSION_SYM = 0_1_8
67
DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\"
68
XS_VERSION = 0.1.8
69
XS_VERSION_MACRO = XS_VERSION
70
XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\"
71
INST_ARCHLIB = blib/arch
72
INST_SCRIPT = blib/script
73
INST_BIN = blib/bin
74
INST_LIB = blib/lib
75
INST_MAN1DIR = blib/man1
76
INST_MAN3DIR = blib/man3
77
MAN1EXT = 1
78
MAN3EXT = 3
79
INSTALLDIRS = site
80
DESTDIR = 
81
PREFIX = /usr/local
82
PERLPREFIX = $(PREFIX)
83
SITEPREFIX = $(PREFIX)
84
VENDORPREFIX = $(PREFIX)
85
INSTALLPRIVLIB = /usr/local/lib
86
DESTINSTALLPRIVLIB = $(DESTDIR)$(INSTALLPRIVLIB)
87
INSTALLSITELIB = $(SITEPREFIX)/lib/perl5/site_perl/5.10.1
88
DESTINSTALLSITELIB = $(DESTDIR)$(INSTALLSITELIB)
89
INSTALLVENDORLIB = $(VENDORPREFIX)/lib/perl5
90
DESTINSTALLVENDORLIB = $(DESTDIR)$(INSTALLVENDORLIB)
91
INSTALLARCHLIB = /usr/local/lib
92
DESTINSTALLARCHLIB = $(DESTDIR)$(INSTALLARCHLIB)
93
INSTALLSITEARCH = $(SITEPREFIX)/lib/perl5/site_perl/5.10.1/mach
94
DESTINSTALLSITEARCH = $(DESTDIR)$(INSTALLSITEARCH)
95
INSTALLVENDORARCH = $(VENDORPREFIX)/lib/perl5/5.10.1/i386-freebsd-64int
96
DESTINSTALLVENDORARCH = $(DESTDIR)$(INSTALLVENDORARCH)
97
INSTALLBIN = $(PERLPREFIX)/bin
98
DESTINSTALLBIN = $(DESTDIR)$(INSTALLBIN)
99
INSTALLSITEBIN = $(SITEPREFIX)/bin
100
DESTINSTALLSITEBIN = $(DESTDIR)$(INSTALLSITEBIN)
101
INSTALLVENDORBIN = $(VENDORPREFIX)/bin
102
DESTINSTALLVENDORBIN = $(DESTDIR)$(INSTALLVENDORBIN)
103
INSTALLSCRIPT = $(PERLPREFIX)/bin
104
DESTINSTALLSCRIPT = $(DESTDIR)$(INSTALLSCRIPT)
105
INSTALLSITESCRIPT = $(SITEPREFIX)/bin
106
DESTINSTALLSITESCRIPT = $(DESTDIR)$(INSTALLSITESCRIPT)
107
INSTALLVENDORSCRIPT = $(VENDORPREFIX)/bin
108
DESTINSTALLVENDORSCRIPT = $(DESTDIR)$(INSTALLVENDORSCRIPT)
109
INSTALLMAN1DIR = $(PERLPREFIX)/man/man1
110
DESTINSTALLMAN1DIR = $(DESTDIR)$(INSTALLMAN1DIR)
111
INSTALLSITEMAN1DIR = $(SITEPREFIX)/man/man1
112
DESTINSTALLSITEMAN1DIR = $(DESTDIR)$(INSTALLSITEMAN1DIR)
113
INSTALLVENDORMAN1DIR = $(VENDORPREFIX)/man/man1
114
DESTINSTALLVENDORMAN1DIR = $(DESTDIR)$(INSTALLVENDORMAN1DIR)
115
INSTALLMAN3DIR = $(PERLPREFIX)/lib/perl5/5.10.1/perl/man/man3
116
DESTINSTALLMAN3DIR = $(DESTDIR)$(INSTALLMAN3DIR)
117
INSTALLSITEMAN3DIR = $(SITEPREFIX)/lib/perl5/5.10.1/man/man3
118
DESTINSTALLSITEMAN3DIR = $(DESTDIR)$(INSTALLSITEMAN3DIR)
119
INSTALLVENDORMAN3DIR = $(VENDORPREFIX)/man/man3
120
DESTINSTALLVENDORMAN3DIR = $(DESTDIR)$(INSTALLVENDORMAN3DIR)
121
PERL_LIB =
122
PERL_ARCHLIB = /usr/local/lib/perl5/5.10.1/mach
123
LIBPERL_A = libperl.a
124
FIRST_MAKEFILE = Makefile
125
MAKEFILE_OLD = Makefile.old
126
MAKE_APERL_FILE = Makefile.aperl
127
PERLMAINCC = $(CC)
128
PERL_INC = /usr/local/lib/perl5/5.10.1/mach/CORE
129
PERL = /usr/local/bin/perl5.10.1 "-Iinc"
130
FULLPERL = /usr/local/bin/perl5.10.1 "-Iinc"
131
ABSPERL = $(PERL)
132
PERLRUN = $(PERL)
133
FULLPERLRUN = $(FULLPERL)
134
ABSPERLRUN = $(ABSPERL)
135
PERLRUNINST = $(PERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)"
136
FULLPERLRUNINST = $(FULLPERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)"
137
ABSPERLRUNINST = $(ABSPERLRUN) "-I$(INST_ARCHLIB)" "-Iinc" "-I$(INST_LIB)"
138
PERL_CORE = 0
139
PERM_DIR = 755
140
PERM_RW = 644
141
PERM_RWX = 755
142
143
MAKEMAKER   = /usr/local/lib/perl5/5.10.1/ExtUtils/MakeMaker.pm
144
MM_VERSION  = 6.55_02
145
MM_REVISION = 65502
146
147
# FULLEXT = Pathname for extension directory (eg Foo/Bar/Oracle).
148
# BASEEXT = Basename part of FULLEXT. May be just equal FULLEXT. (eg Oracle)
149
# PARENT_NAME = NAME without BASEEXT and no trailing :: (eg Foo::Bar)
150
# DLBASE  = Basename part of dynamic library. May be just equal BASEEXT.
151
MAKE = make
152
FULLEXT = Test/Module/Used
153
BASEEXT = Used
154
PARENT_NAME = Test::Module
155
DLBASE = $(BASEEXT)
156
VERSION_FROM = 
157
OBJECT = 
158
LDFROM = $(OBJECT)
159
LINKTYPE = dynamic
160
BOOTDEP = 
161
162
# Handy lists of source code files:
163
XS_FILES = 
164
C_FILES  = 
165
O_FILES  = 
166
H_FILES  = 
167
MAN1PODS = 
168
MAN3PODS = lib/Test/Module/Used.pm
169
170
# Where is the Config information that we are using/depend on
171
CONFIGDEP = $(PERL_ARCHLIB)$(DFSEP)Config.pm $(PERL_INC)$(DFSEP)config.h
172
173
# Where to build things
174
INST_LIBDIR      = $(INST_LIB)/Test/Module
175
INST_ARCHLIBDIR  = $(INST_ARCHLIB)/Test/Module
176
177
INST_AUTODIR     = $(INST_LIB)/auto/$(FULLEXT)
178
INST_ARCHAUTODIR = $(INST_ARCHLIB)/auto/$(FULLEXT)
179
180
INST_STATIC      = 
181
INST_DYNAMIC     = 
182
INST_BOOT        = 
183
184
# Extra linker info
185
EXPORT_LIST        = 
186
PERL_ARCHIVE       = 
187
PERL_ARCHIVE_AFTER = 
188
189
190
TO_INST_PM = lib/Test/Module/Used.pm
191
192
PM_TO_BLIB = lib/Test/Module/Used.pm \
193
	blib/lib/Test/Module/Used.pm
194
195
196
# --- MakeMaker platform_constants section:
197
MM_Unix_VERSION = 6.55_02
198
PERL_MALLOC_DEF = -DPERL_EXTMALLOC_DEF -Dmalloc=Perl_malloc -Dfree=Perl_mfree -Drealloc=Perl_realloc -Dcalloc=Perl_calloc
199
200
201
# --- MakeMaker tool_autosplit section:
202
# Usage: $(AUTOSPLITFILE) FileToSplit AutoDirToSplitInto
203
AUTOSPLITFILE = $(ABSPERLRUN)  -e 'use AutoSplit;  autosplit($$ARGV[0], $$ARGV[1], 0, 1, 1)' --
204
205
206
207
# --- MakeMaker tool_xsubpp section:
208
209
210
# --- MakeMaker tools_other section:
211
SHELL = /bin/sh
212
CHMOD = chmod
213
CP = cp
214
MV = mv
215
NOOP = $(TRUE)
216
NOECHO = @
217
RM_F = rm -f
218
RM_RF = rm -rf
219
TEST_F = test -f
220
TOUCH = touch
221
UMASK_NULL = umask 0
222
DEV_NULL = > /dev/null 2>&1
223
MKPATH = $(ABSPERLRUN) -MExtUtils::Command -e 'mkpath' --
224
EQUALIZE_TIMESTAMP = $(ABSPERLRUN) -MExtUtils::Command -e 'eqtime' --
225
FALSE = false
226
TRUE = true
227
ECHO = echo
228
ECHO_N = echo -n
229
UNINST = 0
230
VERBINST = 0
231
MOD_INSTALL = $(ABSPERLRUN) -MExtUtils::Install -e 'install([ from_to => {@ARGV}, verbose => '\''$(VERBINST)'\'', uninstall_shadows => '\''$(UNINST)'\'', dir_mode => '\''$(PERM_DIR)'\'' ]);' --
232
DOC_INSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'perllocal_install' --
233
UNINSTALL = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'uninstall' --
234
WARN_IF_OLD_PACKLIST = $(ABSPERLRUN) -MExtUtils::Command::MM -e 'warn_if_old_packlist' --
235
MACROSTART = 
236
MACROEND = 
237
USEMAKEFILE = -f
238
FIXIN = $(ABSPERLRUN) -MExtUtils::MY -e 'MY->fixin(shift)' --
239
240
241
# --- MakeMaker makemakerdflt section:
242
makemakerdflt : all
243
	$(NOECHO) $(NOOP)
244
245
246
# --- MakeMaker dist section:
247
TAR = tar
248
TARFLAGS = cvf
249
ZIP = zip
250
ZIPFLAGS = -r
251
COMPRESS = gzip --best
252
SUFFIX = .gz
253
SHAR = shar
254
PREOP = $(NOECHO) $(NOOP)
255
POSTOP = $(NOECHO) $(NOOP)
256
TO_UNIX = $(NOECHO) $(NOOP)
257
CI = ci -u
258
RCS_LABEL = rcs -Nv$(VERSION_SYM): -q
259
DIST_CP = best
260
DIST_DEFAULT = tardist
261
DISTNAME = Test-Module-Used
262
DISTVNAME = Test-Module-Used-0.1.8
263
264
265
# --- MakeMaker macro section:
266
267
268
# --- MakeMaker depend section:
269
270
271
# --- MakeMaker cflags section:
272
273
274
# --- MakeMaker const_loadlibs section:
275
276
277
# --- MakeMaker const_cccmd section:
278
279
280
# --- MakeMaker post_constants section:
281
282
283
# --- MakeMaker pasthru section:
284
285
PASTHRU = LIBPERL_A="$(LIBPERL_A)"\
286
	LINKTYPE="$(LINKTYPE)"\
287
	PREFIX="$(PREFIX)"
288
289
290
# --- MakeMaker special_targets section:
291
.SUFFIXES : .xs .c .C .cpp .i .s .cxx .cc $(OBJ_EXT)
292
293
.PHONY: all config static dynamic test linkext manifest blibdirs clean realclean disttest distdir
294
295
296
297
# --- MakeMaker c_o section:
298
299
300
# --- MakeMaker xs_c section:
301
302
303
# --- MakeMaker xs_o section:
304
305
306
# --- MakeMaker top_targets section:
307
all :: pure_all manifypods
308
	$(NOECHO) $(NOOP)
309
310
311
pure_all :: config pm_to_blib subdirs linkext
312
	$(NOECHO) $(NOOP)
313
314
subdirs :: $(MYEXTLIB)
315
	$(NOECHO) $(NOOP)
316
317
config :: $(FIRST_MAKEFILE) blibdirs
318
	$(NOECHO) $(NOOP)
319
320
help :
321
	perldoc ExtUtils::MakeMaker
322
323
324
# --- MakeMaker blibdirs section:
325
blibdirs : $(INST_LIBDIR)$(DFSEP).exists $(INST_ARCHLIB)$(DFSEP).exists $(INST_AUTODIR)$(DFSEP).exists $(INST_ARCHAUTODIR)$(DFSEP).exists $(INST_BIN)$(DFSEP).exists $(INST_SCRIPT)$(DFSEP).exists $(INST_MAN1DIR)$(DFSEP).exists $(INST_MAN3DIR)$(DFSEP).exists
326
	$(NOECHO) $(NOOP)
327
328
# Backwards compat with 6.18 through 6.25
329
blibdirs.ts : blibdirs
330
	$(NOECHO) $(NOOP)
331
332
$(INST_LIBDIR)$(DFSEP).exists :: Makefile.PL
333
	$(NOECHO) $(MKPATH) $(INST_LIBDIR)
334
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_LIBDIR)
335
	$(NOECHO) $(TOUCH) $(INST_LIBDIR)$(DFSEP).exists
336
337
$(INST_ARCHLIB)$(DFSEP).exists :: Makefile.PL
338
	$(NOECHO) $(MKPATH) $(INST_ARCHLIB)
339
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHLIB)
340
	$(NOECHO) $(TOUCH) $(INST_ARCHLIB)$(DFSEP).exists
341
342
$(INST_AUTODIR)$(DFSEP).exists :: Makefile.PL
343
	$(NOECHO) $(MKPATH) $(INST_AUTODIR)
344
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_AUTODIR)
345
	$(NOECHO) $(TOUCH) $(INST_AUTODIR)$(DFSEP).exists
346
347
$(INST_ARCHAUTODIR)$(DFSEP).exists :: Makefile.PL
348
	$(NOECHO) $(MKPATH) $(INST_ARCHAUTODIR)
349
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_ARCHAUTODIR)
350
	$(NOECHO) $(TOUCH) $(INST_ARCHAUTODIR)$(DFSEP).exists
351
352
$(INST_BIN)$(DFSEP).exists :: Makefile.PL
353
	$(NOECHO) $(MKPATH) $(INST_BIN)
354
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_BIN)
355
	$(NOECHO) $(TOUCH) $(INST_BIN)$(DFSEP).exists
356
357
$(INST_SCRIPT)$(DFSEP).exists :: Makefile.PL
358
	$(NOECHO) $(MKPATH) $(INST_SCRIPT)
359
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_SCRIPT)
360
	$(NOECHO) $(TOUCH) $(INST_SCRIPT)$(DFSEP).exists
361
362
$(INST_MAN1DIR)$(DFSEP).exists :: Makefile.PL
363
	$(NOECHO) $(MKPATH) $(INST_MAN1DIR)
364
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN1DIR)
365
	$(NOECHO) $(TOUCH) $(INST_MAN1DIR)$(DFSEP).exists
366
367
$(INST_MAN3DIR)$(DFSEP).exists :: Makefile.PL
368
	$(NOECHO) $(MKPATH) $(INST_MAN3DIR)
369
	$(NOECHO) $(CHMOD) $(PERM_DIR) $(INST_MAN3DIR)
370
	$(NOECHO) $(TOUCH) $(INST_MAN3DIR)$(DFSEP).exists
371
372
373
374
# --- MakeMaker linkext section:
375
376
linkext :: $(LINKTYPE)
377
	$(NOECHO) $(NOOP)
378
379
380
# --- MakeMaker dlsyms section:
381
382
383
# --- MakeMaker dynamic section:
384
385
dynamic :: $(FIRST_MAKEFILE) $(INST_DYNAMIC) $(INST_BOOT)
386
	$(NOECHO) $(NOOP)
387
388
389
# --- MakeMaker dynamic_bs section:
390
391
BOOTSTRAP =
392
393
394
# --- MakeMaker dynamic_lib section:
395
396
397
# --- MakeMaker static section:
398
399
## $(INST_PM) has been moved to the all: target.
400
## It remains here for awhile to allow for old usage: "make static"
401
static :: $(FIRST_MAKEFILE) $(INST_STATIC)
402
	$(NOECHO) $(NOOP)
403
404
405
# --- MakeMaker static_lib section:
406
407
408
# --- MakeMaker manifypods section:
409
410
POD2MAN_EXE = $(PERLRUN) "-MExtUtils::Command::MM" -e pod2man "--"
411
POD2MAN = $(POD2MAN_EXE)
412
413
414
manifypods : pure_all  \
415
	lib/Test/Module/Used.pm
416
	$(NOECHO) $(POD2MAN) --section=3 --perm_rw=$(PERM_RW) \
417
	  lib/Test/Module/Used.pm $(INST_MAN3DIR)/Test::Module::Used.$(MAN3EXT) 
418
419
420
421
422
# --- MakeMaker processPL section:
423
424
425
# --- MakeMaker installbin section:
426
427
428
# --- MakeMaker subdirs section:
429
430
# none
431
432
# --- MakeMaker clean_subdirs section:
433
clean_subdirs :
434
	$(NOECHO) $(NOOP)
435
436
437
# --- MakeMaker clean section:
438
439
# Delete temporary files but do not touch installed files. We don't delete
440
# the Makefile here so a later make realclean still has a makefile to use.
441
442
clean :: clean_subdirs
443
	- $(RM_F) \
444
	  *$(LIB_EXT) core \
445
	  core.[0-9] $(INST_ARCHAUTODIR)/extralibs.all \
446
	  core.[0-9][0-9] $(BASEEXT).bso \
447
	  pm_to_blib.ts core.[0-9][0-9][0-9][0-9] \
448
	  $(BASEEXT).x $(BOOTSTRAP) \
449
	  perl$(EXE_EXT) tmon.out \
450
	  *$(OBJ_EXT) pm_to_blib \
451
	  $(INST_ARCHAUTODIR)/extralibs.ld blibdirs.ts \
452
	  core.[0-9][0-9][0-9][0-9][0-9] *perl.core \
453
	  core.*perl.*.? $(MAKE_APERL_FILE) \
454
	  perl $(BASEEXT).def \
455
	  core.[0-9][0-9][0-9] mon.out \
456
	  lib$(BASEEXT).def perlmain.c \
457
	  perl.exe so_locations \
458
	  $(BASEEXT).exp 
459
	- $(RM_RF) \
460
	  blib 
461
	- $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL)
462
463
464
# --- MakeMaker realclean_subdirs section:
465
realclean_subdirs :
466
	$(NOECHO) $(NOOP)
467
468
469
# --- MakeMaker realclean section:
470
# Delete temporary files (via clean) and also delete dist files
471
realclean purge ::  clean realclean_subdirs
472
	- $(RM_F) \
473
	  $(MAKEFILE_OLD) $(FIRST_MAKEFILE) 
474
	- $(RM_RF) \
475
	  MYMETA.yml $(DISTVNAME) 
476
477
478
# --- MakeMaker metafile section:
479
metafile :
480
	$(NOECHO) $(NOOP)
481
482
483
# --- MakeMaker signature section:
484
signature :
485
	cpansign -s
486
487
488
# --- MakeMaker dist_basics section:
489
distclean :: realclean distcheck
490
	$(NOECHO) $(NOOP)
491
492
distcheck :
493
	$(PERLRUN) "-MExtUtils::Manifest=fullcheck" -e fullcheck
494
495
skipcheck :
496
	$(PERLRUN) "-MExtUtils::Manifest=skipcheck" -e skipcheck
497
498
manifest :
499
	$(PERLRUN) "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
500
501
veryclean : realclean
502
	$(RM_F) *~ */*~ *.orig */*.orig *.bak */*.bak *.old */*.old 
503
504
505
506
# --- MakeMaker dist_core section:
507
508
dist : $(DIST_DEFAULT) $(FIRST_MAKEFILE)
509
	$(NOECHO) $(ABSPERLRUN) -l -e 'print '\''Warning: Makefile possibly out of date with $(VERSION_FROM)'\''' \
510
	  -e '    if -e '\''$(VERSION_FROM)'\'' and -M '\''$(VERSION_FROM)'\'' < -M '\''$(FIRST_MAKEFILE)'\'';' --
511
512
tardist : $(DISTVNAME).tar$(SUFFIX)
513
	$(NOECHO) $(NOOP)
514
515
uutardist : $(DISTVNAME).tar$(SUFFIX)
516
	uuencode $(DISTVNAME).tar$(SUFFIX) $(DISTVNAME).tar$(SUFFIX) > $(DISTVNAME).tar$(SUFFIX)_uu
517
518
$(DISTVNAME).tar$(SUFFIX) : distdir
519
	$(PREOP)
520
	$(TO_UNIX)
521
	$(TAR) $(TARFLAGS) $(DISTVNAME).tar $(DISTVNAME)
522
	$(RM_RF) $(DISTVNAME)
523
	$(COMPRESS) $(DISTVNAME).tar
524
	$(POSTOP)
525
526
zipdist : $(DISTVNAME).zip
527
	$(NOECHO) $(NOOP)
528
529
$(DISTVNAME).zip : distdir
530
	$(PREOP)
531
	$(ZIP) $(ZIPFLAGS) $(DISTVNAME).zip $(DISTVNAME)
532
	$(RM_RF) $(DISTVNAME)
533
	$(POSTOP)
534
535
shdist : distdir
536
	$(PREOP)
537
	$(SHAR) $(DISTVNAME) > $(DISTVNAME).shar
538
	$(RM_RF) $(DISTVNAME)
539
	$(POSTOP)
540
541
542
# --- MakeMaker distdir section:
543
create_distdir :
544
	$(RM_RF) $(DISTVNAME)
545
	$(PERLRUN) "-MExtUtils::Manifest=manicopy,maniread" \
546
		-e "manicopy(maniread(),'$(DISTVNAME)', '$(DIST_CP)');"
547
548
distdir : create_distdir  
549
	$(NOECHO) $(NOOP)
550
551
552
553
# --- MakeMaker dist_test section:
554
disttest : distdir
555
	cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL "INSTALLDIRS=site" "CC=cc" "CCFLAGS=-O2 -pipe -fno-strict-aliasing" "PREFIX=/usr/local" "INSTALLPRIVLIB=/usr/local/lib" "INSTALLARCHLIB=/usr/local/lib"
556
	cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
557
	cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
558
559
560
561
# --- MakeMaker dist_ci section:
562
563
ci :
564
	$(PERLRUN) "-MExtUtils::Manifest=maniread" \
565
	  -e "@all = keys %{ maniread() };" \
566
	  -e "print(qq{Executing $(CI) @all\n}); system(qq{$(CI) @all});" \
567
	  -e "print(qq{Executing $(RCS_LABEL) ...\n}); system(qq{$(RCS_LABEL) @all});"
568
569
570
# --- MakeMaker distmeta section:
571
distmeta : create_distdir metafile
572
	$(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } ' \
573
	  -e '    or print "Could not add META.yml to MANIFEST: $${'\''@'\''}\n"' --
574
575
576
577
# --- MakeMaker distsignature section:
578
distsignature : create_distdir
579
	$(NOECHO) cd $(DISTVNAME) && $(ABSPERLRUN) -MExtUtils::Manifest=maniadd -e 'eval { maniadd({q{SIGNATURE} => q{Public-key signature (added by MakeMaker)}}) } ' \
580
	  -e '    or print "Could not add SIGNATURE to MANIFEST: $${'\''@'\''}\n"' --
581
	$(NOECHO) cd $(DISTVNAME) && $(TOUCH) SIGNATURE
582
	cd $(DISTVNAME) && cpansign -s
583
584
585
586
# --- MakeMaker install section:
587
588
install :: pure_install doc_install
589
	$(NOECHO) $(NOOP)
590
591
install_perl :: pure_perl_install
592
	$(NOECHO) $(NOOP)
593
594
install_site :: pure_site_install
595
	$(NOECHO) $(NOOP)
596
597
install_vendor :: pure_vendor_install doc_vendor_install
598
	$(NOECHO) $(NOOP)
599
600
pure_install :: pure_$(INSTALLDIRS)_install
601
	$(NOECHO) $(NOOP)
602
603
doc_install ::
604
	$(NOECHO) $(NOOP)
605
606
pure__install : pure_site_install
607
	$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
608
609
doc__install :
610
	$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
611
612
pure_perl_install :: all
613
	$(NOECHO) $(MOD_INSTALL) \
614
		read $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist \
615
		write $(DESTINSTALLARCHLIB)/auto/$(FULLEXT)/.packlist \
616
		$(INST_LIB) $(DESTINSTALLPRIVLIB) \
617
		$(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
618
		$(INST_BIN) $(DESTINSTALLBIN) \
619
		$(INST_SCRIPT) $(DESTINSTALLSCRIPT) \
620
		$(INST_MAN1DIR) $(DESTINSTALLMAN1DIR) \
621
		$(INST_MAN3DIR) $(DESTINSTALLMAN3DIR)
622
	$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
623
		$(SITEARCHEXP)/auto/$(FULLEXT)
624
625
626
pure_site_install :: all
627
	$(NOECHO) $(MOD_INSTALL) \
628
		read $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist \
629
		write $(DESTINSTALLSITEARCH)/auto/$(FULLEXT)/.packlist \
630
		$(INST_LIB) $(DESTINSTALLSITELIB) \
631
		$(INST_ARCHLIB) $(DESTINSTALLSITEARCH) \
632
		$(INST_BIN) $(DESTINSTALLSITEBIN) \
633
		$(INST_SCRIPT) $(DESTINSTALLSITESCRIPT) \
634
		$(INST_MAN1DIR) $(DESTINSTALLSITEMAN1DIR) \
635
		$(INST_MAN3DIR) $(DESTINSTALLSITEMAN3DIR)
636
	$(NOECHO) $(WARN_IF_OLD_PACKLIST) \
637
		$(PERL_ARCHLIB)/auto/$(FULLEXT)
638
639
pure_vendor_install :: all
640
	$(NOECHO) $(MOD_INSTALL) \
641
		read $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist \
642
		write $(DESTINSTALLVENDORARCH)/auto/$(FULLEXT)/.packlist \
643
		$(INST_LIB) $(DESTINSTALLVENDORLIB) \
644
		$(INST_ARCHLIB) $(DESTINSTALLVENDORARCH) \
645
		$(INST_BIN) $(DESTINSTALLVENDORBIN) \
646
		$(INST_SCRIPT) $(DESTINSTALLVENDORSCRIPT) \
647
		$(INST_MAN1DIR) $(DESTINSTALLVENDORMAN1DIR) \
648
		$(INST_MAN3DIR) $(DESTINSTALLVENDORMAN3DIR)
649
650
doc_perl_install :: all
651
	$(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
652
	-$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
653
	-$(NOECHO) $(DOC_INSTALL) \
654
		"Module" "$(NAME)" \
655
		"installed into" "$(INSTALLPRIVLIB)" \
656
		LINKTYPE "$(LINKTYPE)" \
657
		VERSION "$(VERSION)" \
658
		EXE_FILES "$(EXE_FILES)" \
659
		>> $(DESTINSTALLARCHLIB)/perllocal.pod
660
661
doc_site_install :: all
662
	$(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
663
	-$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
664
	-$(NOECHO) $(DOC_INSTALL) \
665
		"Module" "$(NAME)" \
666
		"installed into" "$(INSTALLSITELIB)" \
667
		LINKTYPE "$(LINKTYPE)" \
668
		VERSION "$(VERSION)" \
669
		EXE_FILES "$(EXE_FILES)" \
670
		>> $(DESTINSTALLARCHLIB)/perllocal.pod
671
672
doc_vendor_install :: all
673
	$(NOECHO) $(ECHO) Appending installation info to $(DESTINSTALLARCHLIB)/perllocal.pod
674
	-$(NOECHO) $(MKPATH) $(DESTINSTALLARCHLIB)
675
	-$(NOECHO) $(DOC_INSTALL) \
676
		"Module" "$(NAME)" \
677
		"installed into" "$(INSTALLVENDORLIB)" \
678
		LINKTYPE "$(LINKTYPE)" \
679
		VERSION "$(VERSION)" \
680
		EXE_FILES "$(EXE_FILES)" \
681
		>> $(DESTINSTALLARCHLIB)/perllocal.pod
682
683
684
uninstall :: uninstall_from_$(INSTALLDIRS)dirs
685
	$(NOECHO) $(NOOP)
686
687
uninstall_from_perldirs ::
688
	$(NOECHO) $(UNINSTALL) $(PERL_ARCHLIB)/auto/$(FULLEXT)/.packlist
689
690
uninstall_from_sitedirs ::
691
	$(NOECHO) $(UNINSTALL) $(SITEARCHEXP)/auto/$(FULLEXT)/.packlist
692
693
uninstall_from_vendordirs ::
694
	$(NOECHO) $(UNINSTALL) $(VENDORARCHEXP)/auto/$(FULLEXT)/.packlist
695
696
697
# --- MakeMaker force section:
698
# Phony target to force checking subdirectories.
699
FORCE :
700
	$(NOECHO) $(NOOP)
701
702
703
# --- MakeMaker perldepend section:
704
705
706
# --- MakeMaker makefile section:
707
# We take a very conservative approach here, but it's worth it.
708
# We move Makefile to Makefile.old here to avoid gnu make looping.
709
$(FIRST_MAKEFILE) : Makefile.PL $(CONFIGDEP)
710
	$(NOECHO) $(ECHO) "Makefile out-of-date with respect to $?"
711
	$(NOECHO) $(ECHO) "Cleaning current config before rebuilding Makefile..."
712
	-$(NOECHO) $(RM_F) $(MAKEFILE_OLD)
713
	-$(NOECHO) $(MV)   $(FIRST_MAKEFILE) $(MAKEFILE_OLD)
714
	- $(MAKE) $(USEMAKEFILE) $(MAKEFILE_OLD) clean $(DEV_NULL)
715
	$(PERLRUN) Makefile.PL "INSTALLDIRS=site" "CC=cc" "CCFLAGS=-O2 -pipe -fno-strict-aliasing" "PREFIX=/usr/local" "INSTALLPRIVLIB=/usr/local/lib" "INSTALLARCHLIB=/usr/local/lib"
716
	$(NOECHO) $(ECHO) "==> Your Makefile has been rebuilt. <=="
717
	$(NOECHO) $(ECHO) "==> Please rerun the $(MAKE) command.  <=="
718
	$(FALSE)
719
720
721
722
# --- MakeMaker staticmake section:
723
724
# --- MakeMaker makeaperl section ---
725
MAP_TARGET    = perl
726
FULLPERL      = /usr/local/bin/perl5.10.1
727
728
$(MAP_TARGET) :: static $(MAKE_APERL_FILE)
729
	$(MAKE) $(USEMAKEFILE) $(MAKE_APERL_FILE) $@
730
731
$(MAKE_APERL_FILE) : $(FIRST_MAKEFILE) pm_to_blib
732
	$(NOECHO) $(ECHO) Writing \"$(MAKE_APERL_FILE)\" for this $(MAP_TARGET)
733
	$(NOECHO) $(PERLRUNINST) \
734
		Makefile.PL DIR= \
735
		MAKEFILE=$(MAKE_APERL_FILE) LINKTYPE=static \
736
		MAKEAPERL=1 NORECURS=1 CCCDLFLAGS= \
737
		INSTALLDIRS=site \
738
		CC=cc \
739
		CCFLAGS='-O2 -pipe -fno-strict-aliasing' \
740
		PREFIX=/usr/local \
741
		INSTALLPRIVLIB=/usr/local/lib \
742
		INSTALLARCHLIB=/usr/local/lib
743
744
745
# --- MakeMaker test section:
746
747
TEST_VERBOSE=0
748
TEST_TYPE=test_$(LINKTYPE)
749
TEST_FILE = test.pl
750
TEST_FILES = t/*.t
751
TESTDB_SW = -d
752
753
testdb :: testdb_$(LINKTYPE)
754
755
test :: $(TEST_TYPE) subdirs-test
756
757
subdirs-test ::
758
	$(NOECHO) $(NOOP)
759
760
761
test_dynamic :: pure_all
762
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "test_harness($(TEST_VERBOSE), 'inc', '$(INST_LIB)', '$(INST_ARCHLIB)')" $(TEST_FILES)
763
764
testdb_dynamic :: pure_all
765
	PERL_DL_NONLAZY=1 $(FULLPERLRUN) $(TESTDB_SW) "-Iinc" "-I$(INST_LIB)" "-I$(INST_ARCHLIB)" $(TEST_FILE)
766
767
test_ : test_dynamic
768
769
test_static :: test_dynamic
770
testdb_static :: testdb_dynamic
771
772
773
# --- MakeMaker ppd section:
774
# Creates a PPD (Perl Package Description) for a binary distribution.
775
ppd :
776
	$(NOECHO) $(ECHO) '<SOFTPKG NAME="$(DISTNAME)" VERSION="0.1.8">' > $(DISTNAME).ppd
777
	$(NOECHO) $(ECHO) '    <ABSTRACT>Test required module is really used and vice versa bitween lib/t and META.yml</ABSTRACT>' >> $(DISTNAME).ppd
778
	$(NOECHO) $(ECHO) '    <AUTHOR>Takuya Tsuchida tsucchi@cpan.org</AUTHOR>' >> $(DISTNAME).ppd
779
	$(NOECHO) $(ECHO) '    <IMPLEMENTATION>' >> $(DISTNAME).ppd
780
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="ExtUtils::MakeMaker" VERSION="6.42" />' >> $(DISTNAME).ppd
781
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="List::MoreUtils" />' >> $(DISTNAME).ppd
782
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="Module::CoreList" />' >> $(DISTNAME).ppd
783
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="Module::Used" />' >> $(DISTNAME).ppd
784
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="PPI::Document" />' >> $(DISTNAME).ppd
785
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="Test::More" />' >> $(DISTNAME).ppd
786
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="YAML::" />' >> $(DISTNAME).ppd
787
	$(NOECHO) $(ECHO) '        <REQUIRE NAME="version::" VERSION="0.77" />' >> $(DISTNAME).ppd
788
	$(NOECHO) $(ECHO) '        <ARCHITECTURE NAME="i386-freebsd-64int-5.10" />' >> $(DISTNAME).ppd
789
	$(NOECHO) $(ECHO) '        <CODEBASE HREF="" />' >> $(DISTNAME).ppd
790
	$(NOECHO) $(ECHO) '    </IMPLEMENTATION>' >> $(DISTNAME).ppd
791
	$(NOECHO) $(ECHO) '</SOFTPKG>' >> $(DISTNAME).ppd
792
793
794
# --- MakeMaker pm_to_blib section:
795
796
pm_to_blib : $(FIRST_MAKEFILE) $(TO_INST_PM)
797
	$(NOECHO) $(ABSPERLRUN) -MExtUtils::Install -e 'pm_to_blib({@ARGV}, '\''$(INST_LIB)/auto'\'', q[$(PM_FILTER)], '\''$(PERM_DIR)'\'')' -- \
798
	  lib/Test/Module/Used.pm blib/lib/Test/Module/Used.pm 
799
	$(NOECHO) $(TOUCH) pm_to_blib
800
801
802
# --- MakeMaker selfdocument section:
803
804
805
# --- MakeMaker postamble section:
806
807
808
# End.
809
# Postamble by Module::Install 0.91
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/Makefile.PL (-18 lines)
Lines 1-18 Link Here
1
use inc::Module::Install;
2
name           'Test-Module-Used';
3
author         'Takuya Tsuchida tsucchi@cpan.org';
4
license        'perl';
5
all_from       'lib/Test/Module/Used.pm';
6
requires       'Module::Used';
7
requires       'YAML';
8
requires       'List::MoreUtils';
9
requires       'Module::CoreList';
10
requires       'PPI::Document';
11
requires       'version' => 0.77;
12
test_requires  'Test::More';
13
14
author_tests   'xt';
15
16
no_index       directory => 'testdata';
17
repository     'http://github.com/tsucchi/Test-Module-Used';
18
WriteAll;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/README (-10 lines)
Lines 1-10 Link Here
1
INSTALLATION
2
3
To install this module type the following:
4
5
   perl Makefile.PL
6
   make
7
   make test
8
   make install
9
10
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/blib/lib/Test/Module/Used.pm (-457 lines)
Lines 1-457 Link Here
1
package Test::Module::Used;
2
use base qw(Exporter);
3
use strict;
4
use warnings;
5
use File::Find;
6
use File::Spec::Functions qw(catfile);
7
use Module::Used qw(modules_used_in_document);
8
use Module::CoreList;
9
use YAML;
10
use Test::Builder;
11
use List::MoreUtils qw(any);
12
use PPI::Document;
13
use version;
14
15
use 5.008;
16
our $VERSION = '0.1.8';
17
18
=head1 NAME
19
20
Test::Module::Used - Test required module is really used and vice versa bitween lib/t and META.yml
21
22
=head1 SYNOPSIS
23
24
  #!/usr/bin/perl -w
25
  use strict;
26
  use warnings;
27
  use Test::Module::Used;
28
  my $used = Test::Module::Used->new();
29
  $used->ok;
30
31
32
=head1 DESCRIPTION
33
34
Test dependency between module and META.yml.
35
36
This module reads I<META.yml> and get I<build_requires> and I<requires>. It compares required module is really used and used module is really required.
37
38
=cut
39
40
=head1 Important changes
41
42
Some behavier changed since 0.1.3_01.
43
44
=over 4
45
46
=item * perl_version set in constructor is prior to use, and read version from META.yml(not read from use statement in *.pm)
47
48
=item * deprecated interfaces are deleted. (module_dir, test_module_dir, exclude_in_moduledir and push_exclude_in_moduledir)
49
50
=back
51
52
=cut
53
54
=head1 methods
55
56
=cut
57
58
=head2 new
59
60
create new instance
61
62
all parameters are passed by hash-style, and optional.
63
64
in ordinary use.
65
66
  my $used = Test::Module::Used->new();
67
  $used->ok();
68
69
all parameters are as follows.(specified values are default, except I<exclude_in_testdir>)
70
71
  my $used = Test::Module::Used->new(
72
    test_dir     => ['t'],            # directory(ies) which contains test scripts.
73
    lib_dir      => ['lib'],          # directory(ies) which contains module libs.
74
    test_lib_dir => ['t'],            # directory(ies) which contains libs used ONLY in test (ex. MockObject for test)
75
    meta_file    => 'META.yml',       # META.yml (contains module requirement information)
76
    perl_version => '5.008',          # expected perl version which is used for ignore core-modules in testing
77
    exclude_in_testdir => [],         # ignored module(s) for test even if it is used.
78
    exclude_in_libdir   => [],        # ignored module(s) for your lib even if it is used.
79
    exclude_in_build_requires => [],  # ignored module(s) even if it is written in build_requires of META.yml.
80
    exclude_in_requires => [],        # ignored module(s) even if it is written in requires of META.yml.
81
  );
82
83
if perl_version is not passed in constructor, this modules reads I<meta_file> and get perl version. 
84
85
I<exclude_in_testdir> is automatically set by default. This module reads I<lib_dir> and parse "pacakge" statement, then found "package" statements and myself(Test::Module::Used) is set.
86
I<exclude_in_libdir> is also automatically set by default. This module reads I<lib_dir> and parse "package" statement, found "package" statement are set.(Test::Module::Used isnt included)
87
88
=cut
89
90
sub new {
91
    my $class = shift;
92
    my (%opt) = @_;
93
    my $self = {
94
        test_dir     => $opt{test_dir}     || ['t'],
95
        lib_dir      => $opt{lib_dir}      || ['lib'],
96
        test_lib_dir => $opt{test_lib_dir} || ['t'],
97
        meta_file    => $opt{meta_file}    || 'META.yml',
98
        perl_version => $opt{perl_version},
99
        exclude_in_testdir        => $opt{exclude_in_testdir},
100
        exclude_in_libdir         => $opt{exclude_in_libdir},
101
        exclude_in_build_requires => $opt{exclude_in_build_requires} || [],
102
        exclude_in_requires       => $opt{exclude_in_requires}       || [],
103
    };
104
    bless $self, $class;
105
    $self->_get_packages();
106
    return $self;
107
}
108
109
110
sub _test_dir {
111
    return shift->{test_dir};
112
}
113
114
sub _lib_dir {
115
    return shift->{lib_dir};
116
}
117
118
sub _test_lib_dir {
119
    return shift->{test_lib_dir};
120
}
121
122
sub _meta_file {
123
    return shift->{meta_file};
124
}
125
126
sub _perl_version {
127
    return shift->{perl_version};
128
}
129
130
=head2 ok
131
132
check used module is ok.
133
134
  my $used = Test::Module::Used->new(
135
    exclude_in_testdir => ['Test::Module::Used', 'My::Module'],
136
  );
137
  $used->ok;
138
139
140
First, This module reads I<META.yml> and get I<build_requires> and I<requires>. Next, reads module directory (by default I<lib>) and test directory(by default I<t>), and compare required module is really used and used module is really required. If all these requirement information is OK, test will success.
141
142
=cut
143
144
sub ok {
145
    my $self = shift;
146
    my $test = Test::Builder->new();
147
148
149
    my $num_tests = $self->_num_tests();
150
    if ( $num_tests > 0 ) {
151
        $test->plan(tests => $num_tests);
152
        my $status_requires_ok       = $self->_requires_ok($test,
153
                                                           [$self->_remove_core($self->_used_modules)],
154
                                                           [$self->_remove_core($self->_requires)],
155
                                                           "lib");
156
        my $status_build_requires_ok = $self->_requires_ok($test,
157
                                                           [$self->_remove_core($self->_used_modules_in_test)],
158
                                                           [$self->_remove_core($self->_build_requires)],
159
                                                           "test");
160
        return $status_requires_ok && $status_build_requires_ok;
161
    }
162
    else {
163
        $test->plan(tests => 1);
164
        $test->ok(1, "no tests run");
165
        return 1;
166
    }
167
}
168
169
=head2 push_exclude_in_libdir( @exclude_module_names )
170
171
add ignored module(s) for your module(lib) even if it is used after new()'ed.
172
this is usable if you want to use auto set feature for I<exclude_in_libdir> but manually specify exclude modules.
173
174
For example,
175
176
 my $used = Test::Module::Used->new(); #automatically set exclude_in_libdir
177
 $used->push_exclude_in_libdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude
178
 $used->ok(); #do test
179
180
=cut
181
182
sub push_exclude_in_libdir {
183
    my $self = shift;
184
    my @exclude_module_names = @_;
185
    push @{$self->{exclude_in_libdir}},@exclude_module_names;
186
}
187
188
189
190
=head2 push_exclude_in_testdir( @exclude_module_names )
191
192
add ignored module(s) for test even if it is used after new()'ed.
193
this is usable if you want to use auto set feature for I<exclude_in_testdir> but manually specify exclude modules.
194
195
For example,
196
197
 my $used = Test::Module::Used->new(); #automatically set exclude_in_testdir
198
 $used->push_exclude_in_testdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude
199
 $used->ok(); #do test
200
201
=cut
202
203
sub push_exclude_in_testdir {
204
    my $self = shift;
205
    my @exclude_module_names = @_;
206
    push @{$self->{exclude_in_testdir}},@exclude_module_names;
207
}
208
209
sub _version {
210
    my $self = shift;
211
    if ( !defined $self->{version} ) {
212
        $self->{version} = $self->_perl_version || $self->_version_from_meta || "5.008000";
213
    }
214
    return $self->{version};
215
}
216
217
sub _num_tests {
218
    my $self = shift;
219
220
    return scalar($self->_remove_core($self->_used_modules,
221
                                      $self->_requires,
222
                                      $self->_used_modules_in_test,
223
                                      $self->_build_requires));
224
}
225
226
sub _requires_ok {
227
    my $self = shift;
228
    my ($test, $used_aref, $requires_aref, $place) = @_;
229
230
    my $status1 = $self->_check_required_but_not_used($test, $requires_aref, $used_aref, $place);
231
    my $status2 = $self->_check_used_but_not_required($test, $requires_aref, $used_aref, $place);
232
233
    return $status1 && $status2;
234
}
235
236
237
sub _check_required_but_not_used {
238
    my $self = shift;
239
    my ($test, $requires_aref, $used_aref, $place) = @_;
240
    my @requires = @{$requires_aref};
241
    my @used     = @{$used_aref};
242
243
    my $result = 1;
244
    for my $require ( @requires ) {
245
        my $status = any { $_ eq $require } @used;
246
        $test->ok( $status, "check required module: $require" );
247
        if ( !$status ) {
248
            $test->diag("module $require is required but not used in $place");
249
            $result = 0;
250
        }
251
    }
252
    return $result;
253
}
254
255
sub _check_used_but_not_required {
256
    my $self = shift;
257
    my ($test, $requires_aref, $used_aref, $place) = @_;
258
    my @requires = @{$requires_aref};
259
    my @used     = @{$used_aref};
260
261
    my $result = 1;
262
    for my $used ( @used ) {
263
        my $status = any { $_ eq $used } @requires;
264
        $test->ok( $status, "check used module: $used" );
265
        if ( !$status ) {
266
            $test->diag("module $used is used in $place but not required");
267
            $result = 0;
268
        }
269
    }
270
    return $result;
271
}
272
273
sub _pm_files {
274
    my $self = shift;
275
    if ( !defined $self->{pm_files} ) {
276
        my @files = $self->_find_files_by_ext($self->_lib_dir, qr/\.pm$/);
277
        $self->{pm_files} = \@files;
278
    }
279
    return @{$self->{pm_files}};
280
}
281
282
sub _pm_files_in_test {
283
    my $self = shift;
284
    if ( !defined $self->{pm_files_in_test} ) {
285
        my @files = $self->_find_files_by_ext($self->_test_lib_dir, qr/\.pm$/);
286
        $self->{pm_files_in_test} = \@files;
287
    }
288
    return @{$self->{pm_files_in_test}};
289
}
290
291
sub _test_files {
292
    my $self = shift;
293
    return $self->_find_files_by_ext($self->_test_dir, qr/\.t$/);
294
}
295
296
sub _find_files_by_ext {
297
    my $self = shift;
298
    my ($start_dirs_aref, $ext_qr) = @_;
299
    my @result;
300
    find( sub {
301
              push @result, catfile($File::Find::dir, $_) if ( $_ =~ $ext_qr );
302
          },
303
          @{$start_dirs_aref});
304
    return @result;
305
}
306
307
sub _used_modules {
308
    my $self = shift;
309
    if ( !defined $self->{used_modules} ) {
310
        my @used = map { modules_used_in_document($self->_ppi_for($_)) } $self->_pm_files;
311
        my @result = _array_difference(\@used, $self->{exclude_in_libdir});
312
        $self->{used_modules} = \@result;
313
    }
314
    return @{$self->{used_modules}};
315
}
316
317
sub _used_modules_in_test {
318
    my $self = shift;
319
    if ( !defined $self->{used_modules_in_test} ) {
320
        my @used = map { modules_used_in_document($self->_ppi_for($_)) } $self->_test_files;
321
        my @result = _array_difference(\@used, $self->{exclude_in_testdir});
322
        $self->{used_modules_in_test} = \@result;
323
    }
324
    return @{$self->{used_modules_in_test}};
325
}
326
327
sub _array_difference {
328
    my ( $aref1, $aref2 ) = @_;
329
    my @a1 = @{$aref1};
330
    my @a2 = @{$aref2};
331
332
    for my $a2 ( @a2 ) {
333
        @a1 = grep { $_ ne $a2 } @a1;
334
    }
335
    return @a1;
336
}
337
338
sub _version_from_meta {
339
    my $self = shift;
340
    return $self->{version_from_meta};
341
}
342
343
sub _remove_core {
344
    my $self = shift;
345
    my( @module_names ) = @_;
346
    my @result = grep {  !$self->_is_core_module($_) } @module_names;
347
    return @result;
348
}
349
350
sub _is_core_module {
351
    my $self = shift;
352
    my($module_name) = @_;
353
    my $first_release = Module::CoreList->first_release($module_name);
354
    return defined $first_release && $first_release <= $self->_version;
355
}
356
357
sub _read_meta_yml {
358
    my $self = shift;
359
    my $yaml = YAML::LoadFile( $self->_meta_file );
360
    $self->{build_requires} = $yaml->{build_requires};
361
    $self->{version_from_meta} = version->parse($yaml->{requires}->{perl})->numify() if defined $yaml->{requires}->{perl};
362
    delete $yaml->{requires}->{perl};
363
    $self->{requires} = $yaml->{requires};
364
}
365
366
sub _build_requires {
367
    my $self = shift;
368
369
    $self->_read_meta_yml if !defined $self->{build_requires};
370
    my @result = sort keys %{$self->{build_requires}};
371
    return _array_difference(\@result, $self->{exclude_in_build_requires});
372
}
373
374
sub _requires {
375
    my $self = shift;
376
377
    $self->_read_meta_yml if !defined $self->{requires};
378
    my @result = sort keys %{$self->{requires}};
379
    return _array_difference(\@result, $self->{exclude_in_requires});
380
}
381
382
# find package statements in lib
383
sub _get_packages {
384
    my $self = shift;
385
    my @packages = $self->_packages_in( $self->_pm_files );
386
    my @exclude_in_testdir = (__PACKAGE__, @packages, $self->_packages_in($self->_pm_files_in_test));
387
    $self->push_exclude_in_testdir(@exclude_in_testdir) if ( !defined $self->{exclude_in_testdir} );
388
    $self->push_exclude_in_libdir(@packages)            if ( !defined $self->{exclude_in_libdir} );
389
}
390
391
sub _packages_in {
392
    my $self = shift;
393
    my ( @filenames ) = @_;
394
395
    my @result;
396
    for my $filename ( @filenames ) {
397
        my @packages = $self->_packages_in_file($filename);
398
        push @result, @packages;
399
    }
400
    return @result;
401
}
402
403
sub _packages_in_file {
404
    my $self = shift;
405
    my ( $filename ) = @_;
406
407
    my $doc = $self->_ppi_for($filename);
408
    my $packages = $doc->find('PPI::Statement::Package');
409
    return if ( $packages eq '' );
410
411
    my @result;
412
    for my $item ( @{$packages} ) {
413
        for my $token ( @{$item->{children}} ) {
414
            next if ( !$token->isa('PPI::Token::Word') );
415
            next if ( $token->content eq 'package' );
416
            push @result, $token->content;
417
        }
418
    }
419
    return @result;
420
}
421
422
# PPI::Document object for $filename
423
sub _ppi_for {
424
    my $self = shift;
425
    my ($filename) = @_;
426
    if ( !defined $self->{ppi_for}->{$filename} ) {
427
        my $doc = PPI::Document->new($filename);
428
        $self->{ppi_for}->{$filename} = $doc;
429
    }
430
    return $self->{ppi_for}->{$filename};
431
}
432
433
434
1;
435
__END__
436
437
=head1 AUTHOR
438
439
Takuya Tsuchida E<lt>tsucchi@cpan.orgE<gt>
440
441
=head1 SEE ALSO
442
443
L<Test::Dependencies> has almost same feature.
444
445
=head1 REPOSITORY
446
447
L<http://github.com/tsucchi/Test-Module-Used>
448
449
450
=head1 COPYRIGHT AND LICENSE
451
452
Copyright (c) 2008-2010 Takuya Tsuchida
453
454
This library is free software; you can redistribute it and/or modify
455
it under the same terms as Perl itself.
456
457
=cut
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/blib/man3/Test::Module::Used.3 (-243 lines)
Lines 1-243 Link Here
1
.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
2
.\"
3
.\" Standard preamble:
4
.\" ========================================================================
5
.de Sp \" Vertical space (when we can't use .PP)
6
.if t .sp .5v
7
.if n .sp
8
..
9
.de Vb \" Begin verbatim text
10
.ft CW
11
.nf
12
.ne \\$1
13
..
14
.de Ve \" End verbatim text
15
.ft R
16
.fi
17
..
18
.\" Set up some character translations and predefined strings.  \*(-- will
19
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23
.\" nothing in troff, for use with C<>.
24
.tr \(*W-
25
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26
.ie n \{\
27
.    ds -- \(*W-
28
.    ds PI pi
29
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31
.    ds L" ""
32
.    ds R" ""
33
.    ds C` ""
34
.    ds C' ""
35
'br\}
36
.el\{\
37
.    ds -- \|\(em\|
38
.    ds PI \(*p
39
.    ds L" ``
40
.    ds R" ''
41
'br\}
42
.\"
43
.\" Escape single quotes in literal strings from groff's Unicode transform.
44
.ie \n(.g .ds Aq \(aq
45
.el       .ds Aq '
46
.\"
47
.\" If the F register is turned on, we'll generate index entries on stderr for
48
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
49
.\" entries marked with X<> in POD.  Of course, you'll have to process the
50
.\" output yourself in some meaningful fashion.
51
.ie \nF \{\
52
.    de IX
53
.    tm Index:\\$1\t\\n%\t"\\$2"
54
..
55
.    nr % 0
56
.    rr F
57
.\}
58
.el \{\
59
.    de IX
60
..
61
.\}
62
.\"
63
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
64
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
65
.    \" fudge factors for nroff and troff
66
.if n \{\
67
.    ds #H 0
68
.    ds #V .8m
69
.    ds #F .3m
70
.    ds #[ \f1
71
.    ds #] \fP
72
.\}
73
.if t \{\
74
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
75
.    ds #V .6m
76
.    ds #F 0
77
.    ds #[ \&
78
.    ds #] \&
79
.\}
80
.    \" simple accents for nroff and troff
81
.if n \{\
82
.    ds ' \&
83
.    ds ` \&
84
.    ds ^ \&
85
.    ds , \&
86
.    ds ~ ~
87
.    ds /
88
.\}
89
.if t \{\
90
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
91
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
92
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
93
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
94
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
95
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
96
.\}
97
.    \" troff and (daisy-wheel) nroff accents
98
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
99
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
100
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
101
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
102
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
103
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
104
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
105
.ds ae a\h'-(\w'a'u*4/10)'e
106
.ds Ae A\h'-(\w'A'u*4/10)'E
107
.    \" corrections for vroff
108
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
109
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
110
.    \" for low resolution devices (crt and lpr)
111
.if \n(.H>23 .if \n(.V>19 \
112
\{\
113
.    ds : e
114
.    ds 8 ss
115
.    ds o a
116
.    ds d- d\h'-1'\(ga
117
.    ds D- D\h'-1'\(hy
118
.    ds th \o'bp'
119
.    ds Th \o'LP'
120
.    ds ae ae
121
.    ds Ae AE
122
.\}
123
.rm #[ #] #H #V #F C
124
.\" ========================================================================
125
.\"
126
.IX Title "Test::Module::Used 3"
127
.TH Test::Module::Used 3 "2010-01-12" "perl v5.10.1" "User Contributed Perl Documentation"
128
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
129
.\" way too many mistakes in technical documents.
130
.if n .ad l
131
.nh
132
.SH "NAME"
133
Test::Module::Used \- Test required module is really used and vice versa bitween lib/t and META.yml
134
.SH "SYNOPSIS"
135
.IX Header "SYNOPSIS"
136
.Vb 6
137
\&  #!/usr/bin/perl \-w
138
\&  use strict;
139
\&  use warnings;
140
\&  use Test::Module::Used;
141
\&  my $used = Test::Module::Used\->new();
142
\&  $used\->ok;
143
.Ve
144
.SH "DESCRIPTION"
145
.IX Header "DESCRIPTION"
146
Test dependency between module and \s-1META\s0.yml.
147
.PP
148
This module reads \fI\s-1META\s0.yml\fR and get \fIbuild_requires\fR and \fIrequires\fR. It compares required module is really used and used module is really required.
149
.SH "Important changes"
150
.IX Header "Important changes"
151
Some behavier changed since 0.1.3_01.
152
.IP "\(bu" 4
153
perl_version set in constructor is prior to use, and read version from \s-1META\s0.yml(not read from use statement in *.pm)
154
.IP "\(bu" 4
155
deprecated interfaces are deleted. (module_dir, test_module_dir, exclude_in_moduledir and push_exclude_in_moduledir)
156
.SH "methods"
157
.IX Header "methods"
158
.SS "new"
159
.IX Subsection "new"
160
create new instance
161
.PP
162
all parameters are passed by hash-style, and optional.
163
.PP
164
in ordinary use.
165
.PP
166
.Vb 2
167
\&  my $used = Test::Module::Used\->new();
168
\&  $used\->ok();
169
.Ve
170
.PP
171
all parameters are as follows.(specified values are default, except \fIexclude_in_testdir\fR)
172
.PP
173
.Vb 11
174
\&  my $used = Test::Module::Used\->new(
175
\&    test_dir     => [\*(Aqt\*(Aq],            # directory(ies) which contains test scripts.
176
\&    lib_dir      => [\*(Aqlib\*(Aq],          # directory(ies) which contains module libs.
177
\&    test_lib_dir => [\*(Aqt\*(Aq],            # directory(ies) which contains libs used ONLY in test (ex. MockObject for test)
178
\&    meta_file    => \*(AqMETA.yml\*(Aq,       # META.yml (contains module requirement information)
179
\&    perl_version => \*(Aq5.008\*(Aq,          # expected perl version which is used for ignore core\-modules in testing
180
\&    exclude_in_testdir => [],         # ignored module(s) for test even if it is used.
181
\&    exclude_in_libdir   => [],        # ignored module(s) for your lib even if it is used.
182
\&    exclude_in_build_requires => [],  # ignored module(s) even if it is written in build_requires of META.yml.
183
\&    exclude_in_requires => [],        # ignored module(s) even if it is written in requires of META.yml.
184
\&  );
185
.Ve
186
.PP
187
if perl_version is not passed in constructor, this modules reads \fImeta_file\fR and get perl version.
188
.PP
189
\&\fIexclude_in_testdir\fR is automatically set by default. This module reads \fIlib_dir\fR and parse \*(L"pacakge\*(R" statement, then found \*(L"package\*(R" statements and myself(Test::Module::Used) is set.
190
\&\fIexclude_in_libdir\fR is also automatically set by default. This module reads \fIlib_dir\fR and parse \*(L"package\*(R" statement, found \*(L"package\*(R" statement are set.(Test::Module::Used isnt included)
191
.SS "ok"
192
.IX Subsection "ok"
193
check used module is ok.
194
.PP
195
.Vb 4
196
\&  my $used = Test::Module::Used\->new(
197
\&    exclude_in_testdir => [\*(AqTest::Module::Used\*(Aq, \*(AqMy::Module\*(Aq],
198
\&  );
199
\&  $used\->ok;
200
.Ve
201
.PP
202
First, This module reads \fI\s-1META\s0.yml\fR and get \fIbuild_requires\fR and \fIrequires\fR. Next, reads module directory (by default \fIlib\fR) and test directory(by default \fIt\fR), and compare required module is really used and used module is really required. If all these requirement information is \s-1OK\s0, test will success.
203
.ie n .SS "push_exclude_in_libdir( @exclude_module_names )"
204
.el .SS "push_exclude_in_libdir( \f(CW@exclude_module_names\fP )"
205
.IX Subsection "push_exclude_in_libdir( @exclude_module_names )"
206
add ignored module(s) for your module(lib) even if it is used after \fInew()\fR'ed.
207
this is usable if you want to use auto set feature for \fIexclude_in_libdir\fR but manually specify exclude modules.
208
.PP
209
For example,
210
.PP
211
.Vb 3
212
\& my $used = Test::Module::Used\->new(); #automatically set exclude_in_libdir
213
\& $used\->push_exclude_in_libdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude
214
\& $used\->ok(); #do test
215
.Ve
216
.ie n .SS "push_exclude_in_testdir( @exclude_module_names )"
217
.el .SS "push_exclude_in_testdir( \f(CW@exclude_module_names\fP )"
218
.IX Subsection "push_exclude_in_testdir( @exclude_module_names )"
219
add ignored module(s) for test even if it is used after \fInew()\fR'ed.
220
this is usable if you want to use auto set feature for \fIexclude_in_testdir\fR but manually specify exclude modules.
221
.PP
222
For example,
223
.PP
224
.Vb 3
225
\& my $used = Test::Module::Used\->new(); #automatically set exclude_in_testdir
226
\& $used\->push_exclude_in_testdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude
227
\& $used\->ok(); #do test
228
.Ve
229
.SH "AUTHOR"
230
.IX Header "AUTHOR"
231
Takuya Tsuchida <tsucchi@cpan.org>
232
.SH "SEE ALSO"
233
.IX Header "SEE ALSO"
234
Test::Dependencies has almost same feature.
235
.SH "REPOSITORY"
236
.IX Header "REPOSITORY"
237
<http://github.com/tsucchi/Test\-Module\-Used>
238
.SH "COPYRIGHT AND LICENSE"
239
.IX Header "COPYRIGHT AND LICENSE"
240
Copyright (c) 2008\-2010 Takuya Tsuchida
241
.PP
242
This library is free software; you can redistribute it and/or modify
243
it under the same terms as Perl itself.
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/AuthorTests.pm (-59 lines)
Lines 1-59 Link Here
1
#line 1
2
package Module::Install::AuthorTests;
3
4
use 5.005;
5
use strict;
6
use Module::Install::Base;
7
use Carp ();
8
9
#line 16
10
11
use vars qw{$VERSION $ISCORE @ISA};
12
BEGIN {
13
  $VERSION = '0.002';
14
  $ISCORE  = 1;
15
  @ISA     = qw{Module::Install::Base};
16
}
17
18
#line 42
19
20
sub author_tests {
21
  my ($self, @dirs) = @_;
22
  _add_author_tests($self, \@dirs, 0);
23
}
24
25
#line 56
26
27
sub recursive_author_tests {
28
  my ($self, @dirs) = @_;
29
  _add_author_tests($self, \@dirs, 1);
30
}
31
32
sub _wanted {
33
  my $href = shift;
34
  sub { /\.t$/ and -f $_ and $href->{$File::Find::dir} = 1 }
35
}
36
37
sub _add_author_tests {
38
  my ($self, $dirs, $recurse) = @_;
39
  return unless $Module::Install::AUTHOR;
40
41
  my @tests = $self->tests ? (split / /, $self->tests) : 't/*.t';
42
43
  # XXX: pick a default, later -- rjbs, 2008-02-24
44
  my @dirs = @$dirs ? @$dirs : Carp::confess "no dirs given to author_tests";
45
     @dirs = grep { -d } @dirs;
46
47
  if ($recurse) {
48
    require File::Find;
49
    my %test_dir;
50
    File::Find::find(_wanted(\%test_dir), @dirs);
51
    $self->tests( join ' ', @tests, map { "$_/*.t" } sort keys %test_dir );
52
  } else {
53
    $self->tests( join ' ', @tests, map { "$_/*.t" } sort @dirs );
54
  }
55
}
56
57
#line 107
58
59
1;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/Base.pm (-78 lines)
Lines 1-78 Link Here
1
#line 1
2
package Module::Install::Base;
3
4
use strict 'vars';
5
use vars qw{$VERSION};
6
BEGIN {
7
	$VERSION = '0.91';
8
}
9
10
# Suspend handler for "redefined" warnings
11
BEGIN {
12
	my $w = $SIG{__WARN__};
13
	$SIG{__WARN__} = sub { $w };
14
}
15
16
#line 42
17
18
sub new {
19
	my $class = shift;
20
	unless ( defined &{"${class}::call"} ) {
21
		*{"${class}::call"} = sub { shift->_top->call(@_) };
22
	}
23
	unless ( defined &{"${class}::load"} ) {
24
		*{"${class}::load"} = sub { shift->_top->load(@_) };
25
	}
26
	bless { @_ }, $class;
27
}
28
29
#line 61
30
31
sub AUTOLOAD {
32
	local $@;
33
	my $func = eval { shift->_top->autoload } or return;
34
	goto &$func;
35
}
36
37
#line 75
38
39
sub _top {
40
	$_[0]->{_top};
41
}
42
43
#line 90
44
45
sub admin {
46
	$_[0]->_top->{admin}
47
	or
48
	Module::Install::Base::FakeAdmin->new;
49
}
50
51
#line 106
52
53
sub is_admin {
54
	$_[0]->admin->VERSION;
55
}
56
57
sub DESTROY {}
58
59
package Module::Install::Base::FakeAdmin;
60
61
my $fake;
62
63
sub new {
64
	$fake ||= bless(\@_, $_[0]);
65
}
66
67
sub AUTOLOAD {}
68
69
sub DESTROY {}
70
71
# Restore warning handler
72
BEGIN {
73
	$SIG{__WARN__} = $SIG{__WARN__}->();
74
}
75
76
1;
77
78
#line 154
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/Can.pm (-81 lines)
Lines 1-81 Link Here
1
#line 1
2
package Module::Install::Can;
3
4
use strict;
5
use Config                ();
6
use File::Spec            ();
7
use ExtUtils::MakeMaker   ();
8
use Module::Install::Base ();
9
10
use vars qw{$VERSION @ISA $ISCORE};
11
BEGIN {
12
	$VERSION = '0.91';
13
	@ISA     = 'Module::Install::Base';
14
	$ISCORE  = 1;
15
}
16
17
# check if we can load some module
18
### Upgrade this to not have to load the module if possible
19
sub can_use {
20
	my ($self, $mod, $ver) = @_;
21
	$mod =~ s{::|\\}{/}g;
22
	$mod .= '.pm' unless $mod =~ /\.pm$/i;
23
24
	my $pkg = $mod;
25
	$pkg =~ s{/}{::}g;
26
	$pkg =~ s{\.pm$}{}i;
27
28
	local $@;
29
	eval { require $mod; $pkg->VERSION($ver || 0); 1 };
30
}
31
32
# check if we can run some command
33
sub can_run {
34
	my ($self, $cmd) = @_;
35
36
	my $_cmd = $cmd;
37
	return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
38
39
	for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
40
		next if $dir eq '';
41
		my $abs = File::Spec->catfile($dir, $_[1]);
42
		return $abs if (-x $abs or $abs = MM->maybe_command($abs));
43
	}
44
45
	return;
46
}
47
48
# can we locate a (the) C compiler
49
sub can_cc {
50
	my $self   = shift;
51
	my @chunks = split(/ /, $Config::Config{cc}) or return;
52
53
	# $Config{cc} may contain args; try to find out the program part
54
	while (@chunks) {
55
		return $self->can_run("@chunks") || (pop(@chunks), next);
56
	}
57
58
	return;
59
}
60
61
# Fix Cygwin bug on maybe_command();
62
if ( $^O eq 'cygwin' ) {
63
	require ExtUtils::MM_Cygwin;
64
	require ExtUtils::MM_Win32;
65
	if ( ! defined(&ExtUtils::MM_Cygwin::maybe_command) ) {
66
		*ExtUtils::MM_Cygwin::maybe_command = sub {
67
			my ($self, $file) = @_;
68
			if ($file =~ m{^/cygdrive/}i and ExtUtils::MM_Win32->can('maybe_command')) {
69
				ExtUtils::MM_Win32->maybe_command($file);
70
			} else {
71
				ExtUtils::MM_Unix->maybe_command($file);
72
			}
73
		}
74
	}
75
}
76
77
1;
78
79
__END__
80
81
#line 156
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/Fetch.pm (-93 lines)
Lines 1-93 Link Here
1
#line 1
2
package Module::Install::Fetch;
3
4
use strict;
5
use Module::Install::Base ();
6
7
use vars qw{$VERSION @ISA $ISCORE};
8
BEGIN {
9
	$VERSION = '0.91';
10
	@ISA     = 'Module::Install::Base';
11
	$ISCORE  = 1;
12
}
13
14
sub get_file {
15
    my ($self, %args) = @_;
16
    my ($scheme, $host, $path, $file) =
17
        $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
18
19
    if ( $scheme eq 'http' and ! eval { require LWP::Simple; 1 } ) {
20
        $args{url} = $args{ftp_url}
21
            or (warn("LWP support unavailable!\n"), return);
22
        ($scheme, $host, $path, $file) =
23
            $args{url} =~ m|^(\w+)://([^/]+)(.+)/(.+)| or return;
24
    }
25
26
    $|++;
27
    print "Fetching '$file' from $host... ";
28
29
    unless (eval { require Socket; Socket::inet_aton($host) }) {
30
        warn "'$host' resolve failed!\n";
31
        return;
32
    }
33
34
    return unless $scheme eq 'ftp' or $scheme eq 'http';
35
36
    require Cwd;
37
    my $dir = Cwd::getcwd();
38
    chdir $args{local_dir} or return if exists $args{local_dir};
39
40
    if (eval { require LWP::Simple; 1 }) {
41
        LWP::Simple::mirror($args{url}, $file);
42
    }
43
    elsif (eval { require Net::FTP; 1 }) { eval {
44
        # use Net::FTP to get past firewall
45
        my $ftp = Net::FTP->new($host, Passive => 1, Timeout => 600);
46
        $ftp->login("anonymous", 'anonymous@example.com');
47
        $ftp->cwd($path);
48
        $ftp->binary;
49
        $ftp->get($file) or (warn("$!\n"), return);
50
        $ftp->quit;
51
    } }
52
    elsif (my $ftp = $self->can_run('ftp')) { eval {
53
        # no Net::FTP, fallback to ftp.exe
54
        require FileHandle;
55
        my $fh = FileHandle->new;
56
57
        local $SIG{CHLD} = 'IGNORE';
58
        unless ($fh->open("|$ftp -n")) {
59
            warn "Couldn't open ftp: $!\n";
60
            chdir $dir; return;
61
        }
62
63
        my @dialog = split(/\n/, <<"END_FTP");
64
open $host
65
user anonymous anonymous\@example.com
66
cd $path
67
binary
68
get $file $file
69
quit
70
END_FTP
71
        foreach (@dialog) { $fh->print("$_\n") }
72
        $fh->close;
73
    } }
74
    else {
75
        warn "No working 'ftp' program available!\n";
76
        chdir $dir; return;
77
    }
78
79
    unless (-f $file) {
80
        warn "Fetching failed: $@\n";
81
        chdir $dir; return;
82
    }
83
84
    return if exists $args{size} and -s $file != $args{size};
85
    system($args{run}) if exists $args{run};
86
    unlink($file) if $args{remove};
87
88
    print(((!exists $args{check_for} or -e $args{check_for})
89
        ? "done!" : "failed! ($!)"), "\n");
90
    chdir $dir; return !$?;
91
}
92
93
1;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/Makefile.pm (-268 lines)
Lines 1-268 Link Here
1
#line 1
2
package Module::Install::Makefile;
3
4
use strict 'vars';
5
use ExtUtils::MakeMaker   ();
6
use Module::Install::Base ();
7
8
use vars qw{$VERSION @ISA $ISCORE};
9
BEGIN {
10
	$VERSION = '0.91';
11
	@ISA     = 'Module::Install::Base';
12
	$ISCORE  = 1;
13
}
14
15
sub Makefile { $_[0] }
16
17
my %seen = ();
18
19
sub prompt {
20
	shift;
21
22
	# Infinite loop protection
23
	my @c = caller();
24
	if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
25
		die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
26
	}
27
28
	# In automated testing, always use defaults
29
	if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
30
		local $ENV{PERL_MM_USE_DEFAULT} = 1;
31
		goto &ExtUtils::MakeMaker::prompt;
32
	} else {
33
		goto &ExtUtils::MakeMaker::prompt;
34
	}
35
}
36
37
sub makemaker_args {
38
	my $self = shift;
39
	my $args = ( $self->{makemaker_args} ||= {} );
40
	%$args = ( %$args, @_ );
41
	return $args;
42
}
43
44
# For mm args that take multiple space-seperated args,
45
# append an argument to the current list.
46
sub makemaker_append {
47
	my $self = sShift;
48
	my $name = shift;
49
	my $args = $self->makemaker_args;
50
	$args->{name} = defined $args->{$name}
51
		? join( ' ', $args->{name}, @_ )
52
		: join( ' ', @_ );
53
}
54
55
sub build_subdirs {
56
	my $self    = shift;
57
	my $subdirs = $self->makemaker_args->{DIR} ||= [];
58
	for my $subdir (@_) {
59
		push @$subdirs, $subdir;
60
	}
61
}
62
63
sub clean_files {
64
	my $self  = shift;
65
	my $clean = $self->makemaker_args->{clean} ||= {};
66
	  %$clean = (
67
		%$clean,
68
		FILES => join ' ', grep { length $_ } ($clean->{FILES} || (), @_),
69
	);
70
}
71
72
sub realclean_files {
73
	my $self      = shift;
74
	my $realclean = $self->makemaker_args->{realclean} ||= {};
75
	  %$realclean = (
76
		%$realclean,
77
		FILES => join ' ', grep { length $_ } ($realclean->{FILES} || (), @_),
78
	);
79
}
80
81
sub libs {
82
	my $self = shift;
83
	my $libs = ref $_[0] ? shift : [ shift ];
84
	$self->makemaker_args( LIBS => $libs );
85
}
86
87
sub inc {
88
	my $self = shift;
89
	$self->makemaker_args( INC => shift );
90
}
91
92
my %test_dir = ();
93
94
sub _wanted_t {
95
	/\.t$/ and -f $_ and $test_dir{$File::Find::dir} = 1;
96
}
97
98
sub tests_recursive {
99
	my $self = shift;
100
	if ( $self->tests ) {
101
		die "tests_recursive will not work if tests are already defined";
102
	}
103
	my $dir = shift || 't';
104
	unless ( -d $dir ) {
105
		die "tests_recursive dir '$dir' does not exist";
106
	}
107
	%test_dir = ();
108
	require File::Find;
109
	File::Find::find( \&_wanted_t, $dir );
110
	$self->tests( join ' ', map { "$_/*.t" } sort keys %test_dir );
111
}
112
113
sub write {
114
	my $self = shift;
115
	die "&Makefile->write() takes no arguments\n" if @_;
116
117
	# Check the current Perl version
118
	my $perl_version = $self->perl_version;
119
	if ( $perl_version ) {
120
		eval "use $perl_version; 1"
121
			or die "ERROR: perl: Version $] is installed, "
122
			. "but we need version >= $perl_version";
123
	}
124
125
	# Make sure we have a new enough MakeMaker
126
	require ExtUtils::MakeMaker;
127
128
	if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
129
		# MakeMaker can complain about module versions that include
130
		# an underscore, even though its own version may contain one!
131
		# Hence the funny regexp to get rid of it.  See RT #35800
132
		# for details.
133
		$self->build_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
134
		$self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
135
	} else {
136
		# Allow legacy-compatibility with 5.005 by depending on the
137
		# most recent EU:MM that supported 5.005.
138
		$self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
139
		$self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
140
	}
141
142
	# Generate the MakeMaker params
143
	my $args = $self->makemaker_args;
144
	$args->{DISTNAME} = $self->name;
145
	$args->{NAME}     = $self->module_name || $self->name;
146
	$args->{VERSION}  = $self->version;
147
	$args->{NAME}     =~ s/-/::/g;
148
	if ( $self->tests ) {
149
		$args->{test} = { TESTS => $self->tests };
150
	}
151
	if ( $] >= 5.005 ) {
152
		$args->{ABSTRACT} = $self->abstract;
153
		$args->{AUTHOR}   = $self->author;
154
	}
155
	if ( eval($ExtUtils::MakeMaker::VERSION) >= 6.10 ) {
156
		$args->{NO_META} = 1;
157
	}
158
	if ( eval($ExtUtils::MakeMaker::VERSION) > 6.17 and $self->sign ) {
159
		$args->{SIGN} = 1;
160
	}
161
	unless ( $self->is_admin ) {
162
		delete $args->{SIGN};
163
	}
164
165
	# Merge both kinds of requires into prereq_pm
166
	my $prereq = ($args->{PREREQ_PM} ||= {});
167
	%$prereq = ( %$prereq,
168
		map { @$_ }
169
		map { @$_ }
170
		grep $_,
171
		($self->configure_requires, $self->build_requires, $self->requires)
172
	);
173
174
	# Remove any reference to perl, PREREQ_PM doesn't support it
175
	delete $args->{PREREQ_PM}->{perl};
176
177
	# merge both kinds of requires into prereq_pm
178
	my $subdirs = ($args->{DIR} ||= []);
179
	if ($self->bundles) {
180
		foreach my $bundle (@{ $self->bundles }) {
181
			my ($file, $dir) = @$bundle;
182
			push @$subdirs, $dir if -d $dir;
183
			delete $prereq->{$file};
184
		}
185
	}
186
187
	if ( my $perl_version = $self->perl_version ) {
188
		eval "use $perl_version; 1"
189
			or die "ERROR: perl: Version $] is installed, "
190
			. "but we need version >= $perl_version";
191
	}
192
193
	$args->{INSTALLDIRS} = $self->installdirs;
194
195
	my %args = map { ( $_ => $args->{$_} ) } grep {defined($args->{$_})} keys %$args;
196
197
	my $user_preop = delete $args{dist}->{PREOP};
198
	if (my $preop = $self->admin->preop($user_preop)) {
199
		foreach my $key ( keys %$preop ) {
200
			$args{dist}->{$key} = $preop->{$key};
201
		}
202
	}
203
204
	my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
205
	$self->fix_up_makefile($mm->{FIRST_MAKEFILE} || 'Makefile');
206
}
207
208
sub fix_up_makefile {
209
	my $self          = shift;
210
	my $makefile_name = shift;
211
	my $top_class     = ref($self->_top) || '';
212
	my $top_version   = $self->_top->VERSION || '';
213
214
	my $preamble = $self->preamble
215
		? "# Preamble by $top_class $top_version\n"
216
			. $self->preamble
217
		: '';
218
	my $postamble = "# Postamble by $top_class $top_version\n"
219
		. ($self->postamble || '');
220
221
	local *MAKEFILE;
222
	open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
223
	my $makefile = do { local $/; <MAKEFILE> };
224
	close MAKEFILE or die $!;
225
226
	$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
227
	$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
228
	$makefile =~ s/( "-I\$\(INST_LIB\)")/ "-Iinc"$1/g;
229
	$makefile =~ s/^(FULLPERL = .*)/$1 "-Iinc"/m;
230
	$makefile =~ s/^(PERL = .*)/$1 "-Iinc"/m;
231
232
	# Module::Install will never be used to build the Core Perl
233
	# Sometimes PERL_LIB and PERL_ARCHLIB get written anyway, which breaks
234
	# PREFIX/PERL5LIB, and thus, install_share. Blank them if they exist
235
	$makefile =~ s/^PERL_LIB = .+/PERL_LIB =/m;
236
	#$makefile =~ s/^PERL_ARCHLIB = .+/PERL_ARCHLIB =/m;
237
238
	# Perl 5.005 mentions PERL_LIB explicitly, so we have to remove that as well.
239
	$makefile =~ s/(\"?)-I\$\(PERL_LIB\)\1//g;
240
241
	# XXX - This is currently unused; not sure if it breaks other MM-users
242
	# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
243
244
	open  MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
245
	print MAKEFILE  "$preamble$makefile$postamble" or die $!;
246
	close MAKEFILE  or die $!;
247
248
	1;
249
}
250
251
sub preamble {
252
	my ($self, $text) = @_;
253
	$self->{preamble} = $text . $self->{preamble} if defined $text;
254
	$self->{preamble};
255
}
256
257
sub postamble {
258
	my ($self, $text) = @_;
259
	$self->{postamble} ||= $self->admin->postamble;
260
	$self->{postamble} .= $text if defined $text;
261
	$self->{postamble}
262
}
263
264
1;
265
266
__END__
267
268
#line 394
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/Metadata.pm (-624 lines)
Lines 1-624 Link Here
1
#line 1
2
package Module::Install::Metadata;
3
4
use strict 'vars';
5
use Module::Install::Base ();
6
7
use vars qw{$VERSION @ISA $ISCORE};
8
BEGIN {
9
	$VERSION = '0.91';
10
	@ISA     = 'Module::Install::Base';
11
	$ISCORE  = 1;
12
}
13
14
my @boolean_keys = qw{
15
	sign
16
};
17
18
my @scalar_keys = qw{
19
	name
20
	module_name
21
	abstract
22
	author
23
	version
24
	distribution_type
25
	tests
26
	installdirs
27
};
28
29
my @tuple_keys = qw{
30
	configure_requires
31
	build_requires
32
	requires
33
	recommends
34
	bundles
35
	resources
36
};
37
38
my @resource_keys = qw{
39
	homepage
40
	bugtracker
41
	repository
42
};
43
44
my @array_keys = qw{
45
	keywords
46
};
47
48
sub Meta              { shift          }
49
sub Meta_BooleanKeys  { @boolean_keys  }
50
sub Meta_ScalarKeys   { @scalar_keys   }
51
sub Meta_TupleKeys    { @tuple_keys    }
52
sub Meta_ResourceKeys { @resource_keys }
53
sub Meta_ArrayKeys    { @array_keys    }
54
55
foreach my $key ( @boolean_keys ) {
56
	*$key = sub {
57
		my $self = shift;
58
		if ( defined wantarray and not @_ ) {
59
			return $self->{values}->{$key};
60
		}
61
		$self->{values}->{$key} = ( @_ ? $_[0] : 1 );
62
		return $self;
63
	};
64
}
65
66
foreach my $key ( @scalar_keys ) {
67
	*$key = sub {
68
		my $self = shift;
69
		return $self->{values}->{$key} if defined wantarray and !@_;
70
		$self->{values}->{$key} = shift;
71
		return $self;
72
	};
73
}
74
75
foreach my $key ( @array_keys ) {
76
	*$key = sub {
77
		my $self = shift;
78
		return $self->{values}->{$key} if defined wantarray and !@_;
79
		$self->{values}->{$key} ||= [];
80
		push @{$self->{values}->{$key}}, @_;
81
		return $self;
82
	};
83
}
84
85
foreach my $key ( @resource_keys ) {
86
	*$key = sub {
87
		my $self = shift;
88
		unless ( @_ ) {
89
			return () unless $self->{values}->{resources};
90
			return map  { $_->[1] }
91
			       grep { $_->[0] eq $key }
92
			       @{ $self->{values}->{resources} };
93
		}
94
		return $self->{values}->{resources}->{$key} unless @_;
95
		my $uri = shift or die(
96
			"Did not provide a value to $key()"
97
		);
98
		$self->resources( $key => $uri );
99
		return 1;
100
	};
101
}
102
103
foreach my $key ( grep { $_ ne "resources" } @tuple_keys) {
104
	*$key = sub {
105
		my $self = shift;
106
		return $self->{values}->{$key} unless @_;
107
		my @added;
108
		while ( @_ ) {
109
			my $module  = shift or last;
110
			my $version = shift || 0;
111
			push @added, [ $module, $version ];
112
		}
113
		push @{ $self->{values}->{$key} }, @added;
114
		return map {@$_} @added;
115
	};
116
}
117
118
# Resource handling
119
my %lc_resource = map { $_ => 1 } qw{
120
	homepage
121
	license
122
	bugtracker
123
	repository
124
};
125
126
sub resources {
127
	my $self = shift;
128
	while ( @_ ) {
129
		my $name  = shift or last;
130
		my $value = shift or next;
131
		if ( $name eq lc $name and ! $lc_resource{$name} ) {
132
			die("Unsupported reserved lowercase resource '$name'");
133
		}
134
		$self->{values}->{resources} ||= [];
135
		push @{ $self->{values}->{resources} }, [ $name, $value ];
136
	}
137
	$self->{values}->{resources};
138
}
139
140
# Aliases for build_requires that will have alternative
141
# meanings in some future version of META.yml.
142
sub test_requires     { shift->build_requires(@_) }
143
sub install_requires  { shift->build_requires(@_) }
144
145
# Aliases for installdirs options
146
sub install_as_core   { $_[0]->installdirs('perl')   }
147
sub install_as_cpan   { $_[0]->installdirs('site')   }
148
sub install_as_site   { $_[0]->installdirs('site')   }
149
sub install_as_vendor { $_[0]->installdirs('vendor') }
150
151
sub dynamic_config {
152
	my $self = shift;
153
	unless ( @_ ) {
154
		warn "You MUST provide an explicit true/false value to dynamic_config\n";
155
		return $self;
156
	}
157
	$self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
158
	return 1;
159
}
160
161
sub perl_version {
162
	my $self = shift;
163
	return $self->{values}->{perl_version} unless @_;
164
	my $version = shift or die(
165
		"Did not provide a value to perl_version()"
166
	);
167
168
	# Normalize the version
169
	$version = $self->_perl_version($version);
170
171
	# We don't support the reall old versions
172
	unless ( $version >= 5.005 ) {
173
		die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
174
	}
175
176
	$self->{values}->{perl_version} = $version;
177
}
178
179
#Stolen from M::B
180
my %license_urls = (
181
    perl         => 'http://dev.perl.org/licenses/',
182
    apache       => 'http://apache.org/licenses/LICENSE-2.0',
183
    artistic     => 'http://opensource.org/licenses/artistic-license.php',
184
    artistic_2   => 'http://opensource.org/licenses/artistic-license-2.0.php',
185
    lgpl         => 'http://opensource.org/licenses/lgpl-license.php',
186
    lgpl2        => 'http://opensource.org/licenses/lgpl-2.1.php',
187
    lgpl3        => 'http://opensource.org/licenses/lgpl-3.0.html',
188
    bsd          => 'http://opensource.org/licenses/bsd-license.php',
189
    gpl          => 'http://opensource.org/licenses/gpl-license.php',
190
    gpl2         => 'http://opensource.org/licenses/gpl-2.0.php',
191
    gpl3         => 'http://opensource.org/licenses/gpl-3.0.html',
192
    mit          => 'http://opensource.org/licenses/mit-license.php',
193
    mozilla      => 'http://opensource.org/licenses/mozilla1.1.php',
194
    open_source  => undef,
195
    unrestricted => undef,
196
    restrictive  => undef,
197
    unknown      => undef,
198
);
199
200
sub license {
201
	my $self = shift;
202
	return $self->{values}->{license} unless @_;
203
	my $license = shift or die(
204
		'Did not provide a value to license()'
205
	);
206
	$self->{values}->{license} = $license;
207
208
	# Automatically fill in license URLs
209
	if ( $license_urls{$license} ) {
210
		$self->resources( license => $license_urls{$license} );
211
	}
212
213
	return 1;
214
}
215
216
sub all_from {
217
	my ( $self, $file ) = @_;
218
219
	unless ( defined($file) ) {
220
		my $name = $self->name or die(
221
			"all_from called with no args without setting name() first"
222
		);
223
		$file = join('/', 'lib', split(/-/, $name)) . '.pm';
224
		$file =~ s{.*/}{} unless -e $file;
225
		unless ( -e $file ) {
226
			die("all_from cannot find $file from $name");
227
		}
228
	}
229
	unless ( -f $file ) {
230
		die("The path '$file' does not exist, or is not a file");
231
	}
232
233
	# Some methods pull from POD instead of code.
234
	# If there is a matching .pod, use that instead
235
	my $pod = $file;
236
	$pod =~ s/\.pm$/.pod/i;
237
	$pod = $file unless -e $pod;
238
239
	# Pull the different values
240
	$self->name_from($file)         unless $self->name;
241
	$self->version_from($file)      unless $self->version;
242
	$self->perl_version_from($file) unless $self->perl_version;
243
	$self->author_from($pod)        unless $self->author;
244
	$self->license_from($pod)       unless $self->license;
245
	$self->abstract_from($pod)      unless $self->abstract;
246
247
	return 1;
248
}
249
250
sub provides {
251
	my $self     = shift;
252
	my $provides = ( $self->{values}->{provides} ||= {} );
253
	%$provides = (%$provides, @_) if @_;
254
	return $provides;
255
}
256
257
sub auto_provides {
258
	my $self = shift;
259
	return $self unless $self->is_admin;
260
	unless (-e 'MANIFEST') {
261
		warn "Cannot deduce auto_provides without a MANIFEST, skipping\n";
262
		return $self;
263
	}
264
	# Avoid spurious warnings as we are not checking manifest here.
265
	local $SIG{__WARN__} = sub {1};
266
	require ExtUtils::Manifest;
267
	local *ExtUtils::Manifest::manicheck = sub { return };
268
269
	require Module::Build;
270
	my $build = Module::Build->new(
271
		dist_name    => $self->name,
272
		dist_version => $self->version,
273
		license      => $self->license,
274
	);
275
	$self->provides( %{ $build->find_dist_packages || {} } );
276
}
277
278
sub feature {
279
	my $self     = shift;
280
	my $name     = shift;
281
	my $features = ( $self->{values}->{features} ||= [] );
282
	my $mods;
283
284
	if ( @_ == 1 and ref( $_[0] ) ) {
285
		# The user used ->feature like ->features by passing in the second
286
		# argument as a reference.  Accomodate for that.
287
		$mods = $_[0];
288
	} else {
289
		$mods = \@_;
290
	}
291
292
	my $count = 0;
293
	push @$features, (
294
		$name => [
295
			map {
296
				ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_
297
			} @$mods
298
		]
299
	);
300
301
	return @$features;
302
}
303
304
sub features {
305
	my $self = shift;
306
	while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
307
		$self->feature( $name, @$mods );
308
	}
309
	return $self->{values}->{features}
310
		? @{ $self->{values}->{features} }
311
		: ();
312
}
313
314
sub no_index {
315
	my $self = shift;
316
	my $type = shift;
317
	push @{ $self->{values}->{no_index}->{$type} }, @_ if $type;
318
	return $self->{values}->{no_index};
319
}
320
321
sub read {
322
	my $self = shift;
323
	$self->include_deps( 'YAML::Tiny', 0 );
324
325
	require YAML::Tiny;
326
	my $data = YAML::Tiny::LoadFile('META.yml');
327
328
	# Call methods explicitly in case user has already set some values.
329
	while ( my ( $key, $value ) = each %$data ) {
330
		next unless $self->can($key);
331
		if ( ref $value eq 'HASH' ) {
332
			while ( my ( $module, $version ) = each %$value ) {
333
				$self->can($key)->($self, $module => $version );
334
			}
335
		} else {
336
			$self->can($key)->($self, $value);
337
		}
338
	}
339
	return $self;
340
}
341
342
sub write {
343
	my $self = shift;
344
	return $self unless $self->is_admin;
345
	$self->admin->write_meta;
346
	return $self;
347
}
348
349
sub version_from {
350
	require ExtUtils::MM_Unix;
351
	my ( $self, $file ) = @_;
352
	$self->version( ExtUtils::MM_Unix->parse_version($file) );
353
}
354
355
sub abstract_from {
356
	require ExtUtils::MM_Unix;
357
	my ( $self, $file ) = @_;
358
	$self->abstract(
359
		bless(
360
			{ DISTNAME => $self->name },
361
			'ExtUtils::MM_Unix'
362
		)->parse_abstract($file)
363
	 );
364
}
365
366
# Add both distribution and module name
367
sub name_from {
368
	my ($self, $file) = @_;
369
	if (
370
		Module::Install::_read($file) =~ m/
371
		^ \s*
372
		package \s*
373
		([\w:]+)
374
		\s* ;
375
		/ixms
376
	) {
377
		my ($name, $module_name) = ($1, $1);
378
		$name =~ s{::}{-}g;
379
		$self->name($name);
380
		unless ( $self->module_name ) {
381
			$self->module_name($module_name);
382
		}
383
	} else {
384
		die("Cannot determine name from $file\n");
385
	}
386
}
387
388
sub perl_version_from {
389
	my $self = shift;
390
	if (
391
		Module::Install::_read($_[0]) =~ m/
392
		^
393
		(?:use|require) \s*
394
		v?
395
		([\d_\.]+)
396
		\s* ;
397
		/ixms
398
	) {
399
		my $perl_version = $1;
400
		$perl_version =~ s{_}{}g;
401
		$self->perl_version($perl_version);
402
	} else {
403
		warn "Cannot determine perl version info from $_[0]\n";
404
		return;
405
	}
406
}
407
408
sub author_from {
409
	my $self    = shift;
410
	my $content = Module::Install::_read($_[0]);
411
	if ($content =~ m/
412
		=head \d \s+ (?:authors?)\b \s*
413
		([^\n]*)
414
		|
415
		=head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s*
416
		.*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s*
417
		([^\n]*)
418
	/ixms) {
419
		my $author = $1 || $2;
420
		$author =~ s{E<lt>}{<}g;
421
		$author =~ s{E<gt>}{>}g;
422
		$self->author($author);
423
	} else {
424
		warn "Cannot determine author info from $_[0]\n";
425
	}
426
}
427
428
sub license_from {
429
	my $self = shift;
430
	if (
431
		Module::Install::_read($_[0]) =~ m/
432
		(
433
			=head \d \s+
434
			(?:licen[cs]e|licensing|copyright|legal)\b
435
			.*?
436
		)
437
		(=head\\d.*|=cut.*|)
438
		\z
439
	/ixms ) {
440
		my $license_text = $1;
441
		my @phrases      = (
442
			'under the same (?:terms|license) as (?:perl|the perl programming language) itself' => 'perl', 1,
443
			'GNU general public license'         => 'gpl',         1,
444
			'GNU public license'                 => 'gpl',         1,
445
			'GNU lesser general public license'  => 'lgpl',        1,
446
			'GNU lesser public license'          => 'lgpl',        1,
447
			'GNU library general public license' => 'lgpl',        1,
448
			'GNU library public license'         => 'lgpl',        1,
449
			'BSD license'                        => 'bsd',         1,
450
			'Artistic license'                   => 'artistic',    1,
451
			'GPL'                                => 'gpl',         1,
452
			'LGPL'                               => 'lgpl',        1,
453
			'BSD'                                => 'bsd',         1,
454
			'Artistic'                           => 'artistic',    1,
455
			'MIT'                                => 'mit',         1,
456
			'proprietary'                        => 'proprietary', 0,
457
		);
458
		while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
459
			$pattern =~ s{\s+}{\\s+}g;
460
			if ( $license_text =~ /\b$pattern\b/i ) {
461
				$self->license($license);
462
				return 1;
463
			}
464
		}
465
	}
466
467
	warn "Cannot determine license info from $_[0]\n";
468
	return 'unknown';
469
}
470
471
sub _extract_bugtracker {
472
	my @links   = $_[0] =~ m#L<(\Qhttp://rt.cpan.org/\E[^>]+)>#g;
473
	my %links;
474
	@links{@links}=();
475
	@links=keys %links;
476
	return @links;
477
}
478
479
sub bugtracker_from {
480
	my $self    = shift;
481
	my $content = Module::Install::_read($_[0]);
482
	my @links   = _extract_bugtracker($content);
483
	unless ( @links ) {
484
		warn "Cannot determine bugtracker info from $_[0]\n";
485
		return 0;
486
	}
487
	if ( @links > 1 ) {
488
		warn "Found more than on rt.cpan.org link in $_[0]\n";
489
		return 0;
490
	}
491
492
	# Set the bugtracker
493
	bugtracker( $links[0] );
494
	return 1;
495
}
496
497
sub requires_from {
498
	my $self     = shift;
499
	my $content  = Module::Install::_readperl($_[0]);
500
	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
501
	while ( @requires ) {
502
		my $module  = shift @requires;
503
		my $version = shift @requires;
504
		$self->requires( $module => $version );
505
	}
506
}
507
508
sub test_requires_from {
509
	my $self     = shift;
510
	my $content  = Module::Install::_readperl($_[0]);
511
	my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
512
	while ( @requires ) {
513
		my $module  = shift @requires;
514
		my $version = shift @requires;
515
		$self->test_requires( $module => $version );
516
	}
517
}
518
519
# Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
520
# numbers (eg, 5.006001 or 5.008009).
521
# Also, convert double-part versions (eg, 5.8)
522
sub _perl_version {
523
	my $v = $_[-1];
524
	$v =~ s/^([1-9])\.([1-9]\d?\d?)$/sprintf("%d.%03d",$1,$2)/e;
525
	$v =~ s/^([1-9])\.([1-9]\d?\d?)\.(0|[1-9]\d?\d?)$/sprintf("%d.%03d%03d",$1,$2,$3 || 0)/e;
526
	$v =~ s/(\.\d\d\d)000$/$1/;
527
	$v =~ s/_.+$//;
528
	if ( ref($v) ) {
529
		# Numify
530
		$v = $v + 0;
531
	}
532
	return $v;
533
}
534
535
536
537
538
539
######################################################################
540
# MYMETA Support
541
542
sub WriteMyMeta {
543
	die "WriteMyMeta has been deprecated";
544
}
545
546
sub write_mymeta_yaml {
547
	my $self = shift;
548
549
	# We need YAML::Tiny to write the MYMETA.yml file
550
	unless ( eval { require YAML::Tiny; 1; } ) {
551
		return 1;
552
	}
553
554
	# Generate the data
555
	my $meta = $self->_write_mymeta_data or return 1;
556
557
	# Save as the MYMETA.yml file
558
	print "Writing MYMETA.yml\n";
559
	YAML::Tiny::DumpFile('MYMETA.yml', $meta);
560
}
561
562
sub write_mymeta_json {
563
	my $self = shift;
564
565
	# We need JSON to write the MYMETA.json file
566
	unless ( eval { require JSON; 1; } ) {
567
		return 1;
568
	}
569
570
	# Generate the data
571
	my $meta = $self->_write_mymeta_data or return 1;
572
573
	# Save as the MYMETA.yml file
574
	print "Writing MYMETA.json\n";
575
	Module::Install::_write(
576
		'MYMETA.json',
577
		JSON->new->pretty(1)->canonical->encode($meta),
578
	);
579
}
580
581
sub _write_mymeta_data {
582
	my $self = shift;
583
584
	# If there's no existing META.yml there is nothing we can do
585
	return undef unless -f 'META.yml';
586
587
	# We need Parse::CPAN::Meta to load the file
588
	unless ( eval { require Parse::CPAN::Meta; 1; } ) {
589
		return undef;
590
	}
591
592
	# Merge the perl version into the dependencies
593
	my $val  = $self->Meta->{values};
594
	my $perl = delete $val->{perl_version};
595
	if ( $perl ) {
596
		$val->{requires} ||= [];
597
		my $requires = $val->{requires};
598
599
		# Canonize to three-dot version after Perl 5.6
600
		if ( $perl >= 5.006 ) {
601
			$perl =~ s{^(\d+)\.(\d\d\d)(\d*)}{join('.', $1, int($2||0), int($3||0))}e
602
		}
603
		unshift @$requires, [ perl => $perl ];
604
	}
605
606
	# Load the advisory META.yml file
607
	my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
608
	my $meta = $yaml[0];
609
610
	# Overwrite the non-configure dependency hashs
611
	delete $meta->{requires};
612
	delete $meta->{build_requires};
613
	delete $meta->{recommends};
614
	if ( exists $val->{requires} ) {
615
		$meta->{requires} = { map { @$_ } @{ $val->{requires} } };
616
	}
617
	if ( exists $val->{build_requires} ) {
618
		$meta->{build_requires} = { map { @$_ } @{ $val->{build_requires} } };
619
	}
620
621
	return $meta;
622
}
623
624
1;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/Win32.pm (-64 lines)
Lines 1-64 Link Here
1
#line 1
2
package Module::Install::Win32;
3
4
use strict;
5
use Module::Install::Base ();
6
7
use vars qw{$VERSION @ISA $ISCORE};
8
BEGIN {
9
	$VERSION = '0.91';
10
	@ISA     = 'Module::Install::Base';
11
	$ISCORE  = 1;
12
}
13
14
# determine if the user needs nmake, and download it if needed
15
sub check_nmake {
16
	my $self = shift;
17
	$self->load('can_run');
18
	$self->load('get_file');
19
20
	require Config;
21
	return unless (
22
		$^O eq 'MSWin32'                     and
23
		$Config::Config{make}                and
24
		$Config::Config{make} =~ /^nmake\b/i and
25
		! $self->can_run('nmake')
26
	);
27
28
	print "The required 'nmake' executable not found, fetching it...\n";
29
30
	require File::Basename;
31
	my $rv = $self->get_file(
32
		url       => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe',
33
		ftp_url   => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe',
34
		local_dir => File::Basename::dirname($^X),
35
		size      => 51928,
36
		run       => 'Nmake15.exe /o > nul',
37
		check_for => 'Nmake.exe',
38
		remove    => 1,
39
	);
40
41
	die <<'END_MESSAGE' unless $rv;
42
43
-------------------------------------------------------------------------------
44
45
Since you are using Microsoft Windows, you will need the 'nmake' utility
46
before installation. It's available at:
47
48
  http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
49
      or
50
  ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe
51
52
Please download the file manually, save it to a directory in %PATH% (e.g.
53
C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to
54
that directory, and run "Nmake15.exe" from there; that will create the
55
'nmake.exe' file needed by this module.
56
57
You may then resume the installation process described in README.
58
59
-------------------------------------------------------------------------------
60
END_MESSAGE
61
62
}
63
64
1;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install/WriteAll.pm (-60 lines)
Lines 1-60 Link Here
1
#line 1
2
package Module::Install::WriteAll;
3
4
use strict;
5
use Module::Install::Base ();
6
7
use vars qw{$VERSION @ISA $ISCORE};
8
BEGIN {
9
	$VERSION = '0.91';;
10
	@ISA     = qw{Module::Install::Base};
11
	$ISCORE  = 1;
12
}
13
14
sub WriteAll {
15
	my $self = shift;
16
	my %args = (
17
		meta        => 1,
18
		sign        => 0,
19
		inline      => 0,
20
		check_nmake => 1,
21
		@_,
22
	);
23
24
	$self->sign(1)                if $args{sign};
25
	$self->admin->WriteAll(%args) if $self->is_admin;
26
27
	$self->check_nmake if $args{check_nmake};
28
	unless ( $self->makemaker_args->{PL_FILES} ) {
29
		$self->makemaker_args( PL_FILES => {} );
30
	}
31
32
	# Until ExtUtils::MakeMaker support MYMETA.yml, make sure
33
	# we clean it up properly ourself.
34
	$self->realclean_files('MYMETA.yml');
35
36
	if ( $args{inline} ) {
37
		$self->Inline->write;
38
	} else {
39
		$self->Makefile->write;
40
	}
41
42
	# The Makefile write process adds a couple of dependencies,
43
	# so write the META.yml files after the Makefile.
44
	if ( $args{meta} ) {
45
		$self->Meta->write;
46
	}
47
48
	# Experimental support for MYMETA
49
	if ( $ENV{X_MYMETA} ) {
50
		if ( $ENV{X_MYMETA} eq 'JSON' ) {
51
			$self->Meta->write_mymeta_json;
52
		} else {
53
			$self->Meta->write_mymeta_yaml;
54
		}
55
	}
56
57
	return 1;
58
}
59
60
1;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/inc/Module/Install.pm (-430 lines)
Lines 1-430 Link Here
1
#line 1
2
package Module::Install;
3
4
# For any maintainers:
5
# The load order for Module::Install is a bit magic.
6
# It goes something like this...
7
#
8
# IF ( host has Module::Install installed, creating author mode ) {
9
#     1. Makefile.PL calls "use inc::Module::Install"
10
#     2. $INC{inc/Module/Install.pm} set to installed version of inc::Module::Install
11
#     3. The installed version of inc::Module::Install loads
12
#     4. inc::Module::Install calls "require Module::Install"
13
#     5. The ./inc/ version of Module::Install loads
14
# } ELSE {
15
#     1. Makefile.PL calls "use inc::Module::Install"
16
#     2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
17
#     3. The ./inc/ version of Module::Install loads
18
# }
19
20
use 5.005;
21
use strict 'vars';
22
23
use vars qw{$VERSION $MAIN};
24
BEGIN {
25
	# All Module::Install core packages now require synchronised versions.
26
	# This will be used to ensure we don't accidentally load old or
27
	# different versions of modules.
28
	# This is not enforced yet, but will be some time in the next few
29
	# releases once we can make sure it won't clash with custom
30
	# Module::Install extensions.
31
	$VERSION = '0.91';
32
33
	# Storage for the pseudo-singleton
34
	$MAIN    = undef;
35
36
	*inc::Module::Install::VERSION = *VERSION;
37
	@inc::Module::Install::ISA     = __PACKAGE__;
38
39
}
40
41
42
43
44
45
# Whether or not inc::Module::Install is actually loaded, the
46
# $INC{inc/Module/Install.pm} is what will still get set as long as
47
# the caller loaded module this in the documented manner.
48
# If not set, the caller may NOT have loaded the bundled version, and thus
49
# they may not have a MI version that works with the Makefile.PL. This would
50
# result in false errors or unexpected behaviour. And we don't want that.
51
my $file = join( '/', 'inc', split /::/, __PACKAGE__ ) . '.pm';
52
unless ( $INC{$file} ) { die <<"END_DIE" }
53
54
Please invoke ${\__PACKAGE__} with:
55
56
	use inc::${\__PACKAGE__};
57
58
not:
59
60
	use ${\__PACKAGE__};
61
62
END_DIE
63
64
65
66
67
68
# If the script that is loading Module::Install is from the future,
69
# then make will detect this and cause it to re-run over and over
70
# again. This is bad. Rather than taking action to touch it (which
71
# is unreliable on some platforms and requires write permissions)
72
# for now we should catch this and refuse to run.
73
if ( -f $0 ) {
74
	my $s = (stat($0))[9];
75
76
	# If the modification time is only slightly in the future,
77
	# sleep briefly to remove the problem.
78
	my $a = $s - time;
79
	if ( $a > 0 and $a < 5 ) { sleep 5 }
80
81
	# Too far in the future, throw an error.
82
	my $t = time;
83
	if ( $s > $t ) { die <<"END_DIE" }
84
85
Your installer $0 has a modification time in the future ($s > $t).
86
87
This is known to create infinite loops in make.
88
89
Please correct this, then run $0 again.
90
91
END_DIE
92
}
93
94
95
96
97
98
# Build.PL was formerly supported, but no longer is due to excessive
99
# difficulty in implementing every single feature twice.
100
if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" }
101
102
Module::Install no longer supports Build.PL.
103
104
It was impossible to maintain duel backends, and has been deprecated.
105
106
Please remove all Build.PL files and only use the Makefile.PL installer.
107
108
END_DIE
109
110
111
112
113
114
# To save some more typing in Module::Install installers, every...
115
# use inc::Module::Install
116
# ...also acts as an implicit use strict.
117
$^H |= strict::bits(qw(refs subs vars));
118
119
120
121
122
123
use Cwd        ();
124
use File::Find ();
125
use File::Path ();
126
use FindBin;
127
128
sub autoload {
129
	my $self = shift;
130
	my $who  = $self->_caller;
131
	my $cwd  = Cwd::cwd();
132
	my $sym  = "${who}::AUTOLOAD";
133
	$sym->{$cwd} = sub {
134
		my $pwd = Cwd::cwd();
135
		if ( my $code = $sym->{$pwd} ) {
136
			# Delegate back to parent dirs
137
			goto &$code unless $cwd eq $pwd;
138
		}
139
		$$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
140
		my $method = $1;
141
		if ( uc($method) eq $method ) {
142
			# Do nothing
143
			return;
144
		} elsif ( $method =~ /^_/ and $self->can($method) ) {
145
			# Dispatch to the root M:I class
146
			return $self->$method(@_);
147
		}
148
149
		# Dispatch to the appropriate plugin
150
		unshift @_, ( $self, $1 );
151
		goto &{$self->can('call')};
152
	};
153
}
154
155
sub import {
156
	my $class = shift;
157
	my $self  = $class->new(@_);
158
	my $who   = $self->_caller;
159
160
	unless ( -f $self->{file} ) {
161
		require "$self->{path}/$self->{dispatch}.pm";
162
		File::Path::mkpath("$self->{prefix}/$self->{author}");
163
		$self->{admin} = "$self->{name}::$self->{dispatch}"->new( _top => $self );
164
		$self->{admin}->init;
165
		@_ = ($class, _self => $self);
166
		goto &{"$self->{name}::import"};
167
	}
168
169
	*{"${who}::AUTOLOAD"} = $self->autoload;
170
	$self->preload;
171
172
	# Unregister loader and worker packages so subdirs can use them again
173
	delete $INC{"$self->{file}"};
174
	delete $INC{"$self->{path}.pm"};
175
176
	# Save to the singleton
177
	$MAIN = $self;
178
179
	return 1;
180
}
181
182
sub preload {
183
	my $self = shift;
184
	unless ( $self->{extensions} ) {
185
		$self->load_extensions(
186
			"$self->{prefix}/$self->{path}", $self
187
		);
188
	}
189
190
	my @exts = @{$self->{extensions}};
191
	unless ( @exts ) {
192
		@exts = $self->{admin}->load_all_extensions;
193
	}
194
195
	my %seen;
196
	foreach my $obj ( @exts ) {
197
		while (my ($method, $glob) = each %{ref($obj) . '::'}) {
198
			next unless $obj->can($method);
199
			next if $method =~ /^_/;
200
			next if $method eq uc($method);
201
			$seen{$method}++;
202
		}
203
	}
204
205
	my $who = $self->_caller;
206
	foreach my $name ( sort keys %seen ) {
207
		*{"${who}::$name"} = sub {
208
			${"${who}::AUTOLOAD"} = "${who}::$name";
209
			goto &{"${who}::AUTOLOAD"};
210
		};
211
	}
212
}
213
214
sub new {
215
	my ($class, %args) = @_;
216
217
	# ignore the prefix on extension modules built from top level.
218
	my $base_path = Cwd::abs_path($FindBin::Bin);
219
	unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
220
		delete $args{prefix};
221
	}
222
223
	return $args{_self} if $args{_self};
224
225
	$args{dispatch} ||= 'Admin';
226
	$args{prefix}   ||= 'inc';
227
	$args{author}   ||= ($^O eq 'VMS' ? '_author' : '.author');
228
	$args{bundle}   ||= 'inc/BUNDLES';
229
	$args{base}     ||= $base_path;
230
	$class =~ s/^\Q$args{prefix}\E:://;
231
	$args{name}     ||= $class;
232
	$args{version}  ||= $class->VERSION;
233
	unless ( $args{path} ) {
234
		$args{path}  = $args{name};
235
		$args{path}  =~ s!::!/!g;
236
	}
237
	$args{file}     ||= "$args{base}/$args{prefix}/$args{path}.pm";
238
	$args{wrote}      = 0;
239
240
	bless( \%args, $class );
241
}
242
243
sub call {
244
	my ($self, $method) = @_;
245
	my $obj = $self->load($method) or return;
246
        splice(@_, 0, 2, $obj);
247
	goto &{$obj->can($method)};
248
}
249
250
sub load {
251
	my ($self, $method) = @_;
252
253
	$self->load_extensions(
254
		"$self->{prefix}/$self->{path}", $self
255
	) unless $self->{extensions};
256
257
	foreach my $obj (@{$self->{extensions}}) {
258
		return $obj if $obj->can($method);
259
	}
260
261
	my $admin = $self->{admin} or die <<"END_DIE";
262
The '$method' method does not exist in the '$self->{prefix}' path!
263
Please remove the '$self->{prefix}' directory and run $0 again to load it.
264
END_DIE
265
266
	my $obj = $admin->load($method, 1);
267
	push @{$self->{extensions}}, $obj;
268
269
	$obj;
270
}
271
272
sub load_extensions {
273
	my ($self, $path, $top) = @_;
274
275
	unless ( grep { ! ref $_ and lc $_ eq lc $self->{prefix} } @INC ) {
276
		unshift @INC, $self->{prefix};
277
	}
278
279
	foreach my $rv ( $self->find_extensions($path) ) {
280
		my ($file, $pkg) = @{$rv};
281
		next if $self->{pathnames}{$pkg};
282
283
		local $@;
284
		my $new = eval { require $file; $pkg->can('new') };
285
		unless ( $new ) {
286
			warn $@ if $@;
287
			next;
288
		}
289
		$self->{pathnames}{$pkg} = delete $INC{$file};
290
		push @{$self->{extensions}}, &{$new}($pkg, _top => $top );
291
	}
292
293
	$self->{extensions} ||= [];
294
}
295
296
sub find_extensions {
297
	my ($self, $path) = @_;
298
299
	my @found;
300
	File::Find::find( sub {
301
		my $file = $File::Find::name;
302
		return unless $file =~ m!^\Q$path\E/(.+)\.pm\Z!is;
303
		my $subpath = $1;
304
		return if lc($subpath) eq lc($self->{dispatch});
305
306
		$file = "$self->{path}/$subpath.pm";
307
		my $pkg = "$self->{name}::$subpath";
308
		$pkg =~ s!/!::!g;
309
310
		# If we have a mixed-case package name, assume case has been preserved
311
		# correctly.  Otherwise, root through the file to locate the case-preserved
312
		# version of the package name.
313
		if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
314
			my $content = Module::Install::_read($subpath . '.pm');
315
			my $in_pod  = 0;
316
			foreach ( split //, $content ) {
317
				$in_pod = 1 if /^=\w/;
318
				$in_pod = 0 if /^=cut/;
319
				next if ($in_pod || /^=cut/);  # skip pod text
320
				next if /^\s*#/;               # and comments
321
				if ( m/^\s*package\s+($pkg)\s*;/i ) {
322
					$pkg = $1;
323
					last;
324
				}
325
			}
326
		}
327
328
		push @found, [ $file, $pkg ];
329
	}, $path ) if -d $path;
330
331
	@found;
332
}
333
334
335
336
337
338
#####################################################################
339
# Common Utility Functions
340
341
sub _caller {
342
	my $depth = 0;
343
	my $call  = caller($depth);
344
	while ( $call eq __PACKAGE__ ) {
345
		$depth++;
346
		$call = caller($depth);
347
	}
348
	return $call;
349
}
350
351
sub _read {
352
	local *FH;
353
	if ( $] >= 5.006 ) {
354
		open( FH, '<', $_[0] ) or die "open($_[0]): $!";
355
	} else {
356
		open( FH, "< $_[0]"  ) or die "open($_[0]): $!";
357
	}
358
	my $string = do { local $/; <FH> };
359
	close FH or die "close($_[0]): $!";
360
	return $string;
361
}
362
363
sub _readperl {
364
	my $string = Module::Install::_read($_[0]);
365
	$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
366
	$string =~ s/(\n)\n*__(?:DATA|END)__\b.*\z/$1/s;
367
	$string =~ s/\n\n=\w+.+?\n\n=cut\b.+?\n+/\n\n/sg;
368
	return $string;
369
}
370
371
sub _readpod {
372
	my $string = Module::Install::_read($_[0]);
373
	$string =~ s/(?:\015{1,2}\012|\015|\012)/\n/sg;
374
	return $string if $_[0] =~ /\.pod\z/;
375
	$string =~ s/(^|\n=cut\b.+?\n+)[^=\s].+?\n(\n=\w+|\z)/$1$2/sg;
376
	$string =~ s/\n*=pod\b[^\n]*\n+/\n\n/sg;
377
	$string =~ s/\n*=cut\b[^\n]*\n+/\n\n/sg;
378
	$string =~ s/^\n+//s;
379
	return $string;
380
}
381
382
sub _write {
383
	local *FH;
384
	if ( $] >= 5.006 ) {
385
		open( FH, '>', $_[0] ) or die "open($_[0]): $!";
386
	} else {
387
		open( FH, "> $_[0]"  ) or die "open($_[0]): $!";
388
	}
389
	foreach ( 1 .. $#_ ) {
390
		print FH $_[$_] or die "print($_[0]): $!";
391
	}
392
	close FH or die "close($_[0]): $!";
393
}
394
395
# _version is for processing module versions (eg, 1.03_05) not
396
# Perl versions (eg, 5.8.1).
397
sub _version ($) {
398
	my $s = shift || 0;
399
	my $d =()= $s =~ /(\.)/g;
400
	if ( $d >= 2 ) {
401
		# Normalise multipart versions
402
		$s =~ s/(\.)(\d{1,3})/sprintf("$1%03d",$2)/eg;
403
	}
404
	$s =~ s/^(\d+)\.?//;
405
	my $l = $1 || 0;
406
	my @v = map {
407
		$_ . '0' x (3 - length $_)
408
	} $s =~ /(\d{1,3})\D?/g;
409
	$l = $l . '.' . join '', @v if @v;
410
	return $l + 0;
411
}
412
413
sub _cmp ($$) {
414
	_version($_[0]) <=> _version($_[1]);
415
}
416
417
# Cloned from Params::Util::_CLASS
418
sub _CLASS ($) {
419
	(
420
		defined $_[0]
421
		and
422
		! ref $_[0]
423
		and
424
		$_[0] =~ m/^[^\W\d]\w*(?:::\w+)*\z/s
425
	) ? $_[0] : undef;
426
}
427
428
1;
429
430
# Copyright 2008 - 2009 Adam Kennedy.
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/lib/Test/Module/Used.pm (-457 lines)
Lines 1-457 Link Here
1
package Test::Module::Used;
2
use base qw(Exporter);
3
use strict;
4
use warnings;
5
use File::Find;
6
use File::Spec::Functions qw(catfile);
7
use Module::Used qw(modules_used_in_document);
8
use Module::CoreList;
9
use YAML;
10
use Test::Builder;
11
use List::MoreUtils qw(any);
12
use PPI::Document;
13
use version;
14
15
use 5.008;
16
our $VERSION = '0.1.8';
17
18
=head1 NAME
19
20
Test::Module::Used - Test required module is really used and vice versa bitween lib/t and META.yml
21
22
=head1 SYNOPSIS
23
24
  #!/usr/bin/perl -w
25
  use strict;
26
  use warnings;
27
  use Test::Module::Used;
28
  my $used = Test::Module::Used->new();
29
  $used->ok;
30
31
32
=head1 DESCRIPTION
33
34
Test dependency between module and META.yml.
35
36
This module reads I<META.yml> and get I<build_requires> and I<requires>. It compares required module is really used and used module is really required.
37
38
=cut
39
40
=head1 Important changes
41
42
Some behavier changed since 0.1.3_01.
43
44
=over 4
45
46
=item * perl_version set in constructor is prior to use, and read version from META.yml(not read from use statement in *.pm)
47
48
=item * deprecated interfaces are deleted. (module_dir, test_module_dir, exclude_in_moduledir and push_exclude_in_moduledir)
49
50
=back
51
52
=cut
53
54
=head1 methods
55
56
=cut
57
58
=head2 new
59
60
create new instance
61
62
all parameters are passed by hash-style, and optional.
63
64
in ordinary use.
65
66
  my $used = Test::Module::Used->new();
67
  $used->ok();
68
69
all parameters are as follows.(specified values are default, except I<exclude_in_testdir>)
70
71
  my $used = Test::Module::Used->new(
72
    test_dir     => ['t'],            # directory(ies) which contains test scripts.
73
    lib_dir      => ['lib'],          # directory(ies) which contains module libs.
74
    test_lib_dir => ['t'],            # directory(ies) which contains libs used ONLY in test (ex. MockObject for test)
75
    meta_file    => 'META.yml',       # META.yml (contains module requirement information)
76
    perl_version => '5.008',          # expected perl version which is used for ignore core-modules in testing
77
    exclude_in_testdir => [],         # ignored module(s) for test even if it is used.
78
    exclude_in_libdir   => [],        # ignored module(s) for your lib even if it is used.
79
    exclude_in_build_requires => [],  # ignored module(s) even if it is written in build_requires of META.yml.
80
    exclude_in_requires => [],        # ignored module(s) even if it is written in requires of META.yml.
81
  );
82
83
if perl_version is not passed in constructor, this modules reads I<meta_file> and get perl version. 
84
85
I<exclude_in_testdir> is automatically set by default. This module reads I<lib_dir> and parse "pacakge" statement, then found "package" statements and myself(Test::Module::Used) is set.
86
I<exclude_in_libdir> is also automatically set by default. This module reads I<lib_dir> and parse "package" statement, found "package" statement are set.(Test::Module::Used isnt included)
87
88
=cut
89
90
sub new {
91
    my $class = shift;
92
    my (%opt) = @_;
93
    my $self = {
94
        test_dir     => $opt{test_dir}     || ['t'],
95
        lib_dir      => $opt{lib_dir}      || ['lib'],
96
        test_lib_dir => $opt{test_lib_dir} || ['t'],
97
        meta_file    => $opt{meta_file}    || 'META.yml',
98
        perl_version => $opt{perl_version},
99
        exclude_in_testdir        => $opt{exclude_in_testdir},
100
        exclude_in_libdir         => $opt{exclude_in_libdir},
101
        exclude_in_build_requires => $opt{exclude_in_build_requires} || [],
102
        exclude_in_requires       => $opt{exclude_in_requires}       || [],
103
    };
104
    bless $self, $class;
105
    $self->_get_packages();
106
    return $self;
107
}
108
109
110
sub _test_dir {
111
    return shift->{test_dir};
112
}
113
114
sub _lib_dir {
115
    return shift->{lib_dir};
116
}
117
118
sub _test_lib_dir {
119
    return shift->{test_lib_dir};
120
}
121
122
sub _meta_file {
123
    return shift->{meta_file};
124
}
125
126
sub _perl_version {
127
    return shift->{perl_version};
128
}
129
130
=head2 ok
131
132
check used module is ok.
133
134
  my $used = Test::Module::Used->new(
135
    exclude_in_testdir => ['Test::Module::Used', 'My::Module'],
136
  );
137
  $used->ok;
138
139
140
First, This module reads I<META.yml> and get I<build_requires> and I<requires>. Next, reads module directory (by default I<lib>) and test directory(by default I<t>), and compare required module is really used and used module is really required. If all these requirement information is OK, test will success.
141
142
=cut
143
144
sub ok {
145
    my $self = shift;
146
    my $test = Test::Builder->new();
147
148
149
    my $num_tests = $self->_num_tests();
150
    if ( $num_tests > 0 ) {
151
        $test->plan(tests => $num_tests);
152
        my $status_requires_ok       = $self->_requires_ok($test,
153
                                                           [$self->_remove_core($self->_used_modules)],
154
                                                           [$self->_remove_core($self->_requires)],
155
                                                           "lib");
156
        my $status_build_requires_ok = $self->_requires_ok($test,
157
                                                           [$self->_remove_core($self->_used_modules_in_test)],
158
                                                           [$self->_remove_core($self->_build_requires)],
159
                                                           "test");
160
        return $status_requires_ok && $status_build_requires_ok;
161
    }
162
    else {
163
        $test->plan(tests => 1);
164
        $test->ok(1, "no tests run");
165
        return 1;
166
    }
167
}
168
169
=head2 push_exclude_in_libdir( @exclude_module_names )
170
171
add ignored module(s) for your module(lib) even if it is used after new()'ed.
172
this is usable if you want to use auto set feature for I<exclude_in_libdir> but manually specify exclude modules.
173
174
For example,
175
176
 my $used = Test::Module::Used->new(); #automatically set exclude_in_libdir
177
 $used->push_exclude_in_libdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude
178
 $used->ok(); #do test
179
180
=cut
181
182
sub push_exclude_in_libdir {
183
    my $self = shift;
184
    my @exclude_module_names = @_;
185
    push @{$self->{exclude_in_libdir}},@exclude_module_names;
186
}
187
188
189
190
=head2 push_exclude_in_testdir( @exclude_module_names )
191
192
add ignored module(s) for test even if it is used after new()'ed.
193
this is usable if you want to use auto set feature for I<exclude_in_testdir> but manually specify exclude modules.
194
195
For example,
196
197
 my $used = Test::Module::Used->new(); #automatically set exclude_in_testdir
198
 $used->push_exclude_in_testdir( qw(Some::Module::Which::You::Want::To::Exclude) );#module(s) which you want to exclude
199
 $used->ok(); #do test
200
201
=cut
202
203
sub push_exclude_in_testdir {
204
    my $self = shift;
205
    my @exclude_module_names = @_;
206
    push @{$self->{exclude_in_testdir}},@exclude_module_names;
207
}
208
209
sub _version {
210
    my $self = shift;
211
    if ( !defined $self->{version} ) {
212
        $self->{version} = $self->_perl_version || $self->_version_from_meta || "5.008000";
213
    }
214
    return $self->{version};
215
}
216
217
sub _num_tests {
218
    my $self = shift;
219
220
    return scalar($self->_remove_core($self->_used_modules,
221
                                      $self->_requires,
222
                                      $self->_used_modules_in_test,
223
                                      $self->_build_requires));
224
}
225
226
sub _requires_ok {
227
    my $self = shift;
228
    my ($test, $used_aref, $requires_aref, $place) = @_;
229
230
    my $status1 = $self->_check_required_but_not_used($test, $requires_aref, $used_aref, $place);
231
    my $status2 = $self->_check_used_but_not_required($test, $requires_aref, $used_aref, $place);
232
233
    return $status1 && $status2;
234
}
235
236
237
sub _check_required_but_not_used {
238
    my $self = shift;
239
    my ($test, $requires_aref, $used_aref, $place) = @_;
240
    my @requires = @{$requires_aref};
241
    my @used     = @{$used_aref};
242
243
    my $result = 1;
244
    for my $require ( @requires ) {
245
        my $status = any { $_ eq $require } @used;
246
        $test->ok( $status, "check required module: $require" );
247
        if ( !$status ) {
248
            $test->diag("module $require is required but not used in $place");
249
            $result = 0;
250
        }
251
    }
252
    return $result;
253
}
254
255
sub _check_used_but_not_required {
256
    my $self = shift;
257
    my ($test, $requires_aref, $used_aref, $place) = @_;
258
    my @requires = @{$requires_aref};
259
    my @used     = @{$used_aref};
260
261
    my $result = 1;
262
    for my $used ( @used ) {
263
        my $status = any { $_ eq $used } @requires;
264
        $test->ok( $status, "check used module: $used" );
265
        if ( !$status ) {
266
            $test->diag("module $used is used in $place but not required");
267
            $result = 0;
268
        }
269
    }
270
    return $result;
271
}
272
273
sub _pm_files {
274
    my $self = shift;
275
    if ( !defined $self->{pm_files} ) {
276
        my @files = $self->_find_files_by_ext($self->_lib_dir, qr/\.pm$/);
277
        $self->{pm_files} = \@files;
278
    }
279
    return @{$self->{pm_files}};
280
}
281
282
sub _pm_files_in_test {
283
    my $self = shift;
284
    if ( !defined $self->{pm_files_in_test} ) {
285
        my @files = $self->_find_files_by_ext($self->_test_lib_dir, qr/\.pm$/);
286
        $self->{pm_files_in_test} = \@files;
287
    }
288
    return @{$self->{pm_files_in_test}};
289
}
290
291
sub _test_files {
292
    my $self = shift;
293
    return $self->_find_files_by_ext($self->_test_dir, qr/\.t$/);
294
}
295
296
sub _find_files_by_ext {
297
    my $self = shift;
298
    my ($start_dirs_aref, $ext_qr) = @_;
299
    my @result;
300
    find( sub {
301
              push @result, catfile($File::Find::dir, $_) if ( $_ =~ $ext_qr );
302
          },
303
          @{$start_dirs_aref});
304
    return @result;
305
}
306
307
sub _used_modules {
308
    my $self = shift;
309
    if ( !defined $self->{used_modules} ) {
310
        my @used = map { modules_used_in_document($self->_ppi_for($_)) } $self->_pm_files;
311
        my @result = _array_difference(\@used, $self->{exclude_in_libdir});
312
        $self->{used_modules} = \@result;
313
    }
314
    return @{$self->{used_modules}};
315
}
316
317
sub _used_modules_in_test {
318
    my $self = shift;
319
    if ( !defined $self->{used_modules_in_test} ) {
320
        my @used = map { modules_used_in_document($self->_ppi_for($_)) } $self->_test_files;
321
        my @result = _array_difference(\@used, $self->{exclude_in_testdir});
322
        $self->{used_modules_in_test} = \@result;
323
    }
324
    return @{$self->{used_modules_in_test}};
325
}
326
327
sub _array_difference {
328
    my ( $aref1, $aref2 ) = @_;
329
    my @a1 = @{$aref1};
330
    my @a2 = @{$aref2};
331
332
    for my $a2 ( @a2 ) {
333
        @a1 = grep { $_ ne $a2 } @a1;
334
    }
335
    return @a1;
336
}
337
338
sub _version_from_meta {
339
    my $self = shift;
340
    return $self->{version_from_meta};
341
}
342
343
sub _remove_core {
344
    my $self = shift;
345
    my( @module_names ) = @_;
346
    my @result = grep {  !$self->_is_core_module($_) } @module_names;
347
    return @result;
348
}
349
350
sub _is_core_module {
351
    my $self = shift;
352
    my($module_name) = @_;
353
    my $first_release = Module::CoreList->first_release($module_name);
354
    return defined $first_release && $first_release <= $self->_version;
355
}
356
357
sub _read_meta_yml {
358
    my $self = shift;
359
    my $yaml = YAML::LoadFile( $self->_meta_file );
360
    $self->{build_requires} = $yaml->{build_requires};
361
    $self->{version_from_meta} = version->parse($yaml->{requires}->{perl})->numify() if defined $yaml->{requires}->{perl};
362
    delete $yaml->{requires}->{perl};
363
    $self->{requires} = $yaml->{requires};
364
}
365
366
sub _build_requires {
367
    my $self = shift;
368
369
    $self->_read_meta_yml if !defined $self->{build_requires};
370
    my @result = sort keys %{$self->{build_requires}};
371
    return _array_difference(\@result, $self->{exclude_in_build_requires});
372
}
373
374
sub _requires {
375
    my $self = shift;
376
377
    $self->_read_meta_yml if !defined $self->{requires};
378
    my @result = sort keys %{$self->{requires}};
379
    return _array_difference(\@result, $self->{exclude_in_requires});
380
}
381
382
# find package statements in lib
383
sub _get_packages {
384
    my $self = shift;
385
    my @packages = $self->_packages_in( $self->_pm_files );
386
    my @exclude_in_testdir = (__PACKAGE__, @packages, $self->_packages_in($self->_pm_files_in_test));
387
    $self->push_exclude_in_testdir(@exclude_in_testdir) if ( !defined $self->{exclude_in_testdir} );
388
    $self->push_exclude_in_libdir(@packages)            if ( !defined $self->{exclude_in_libdir} );
389
}
390
391
sub _packages_in {
392
    my $self = shift;
393
    my ( @filenames ) = @_;
394
395
    my @result;
396
    for my $filename ( @filenames ) {
397
        my @packages = $self->_packages_in_file($filename);
398
        push @result, @packages;
399
    }
400
    return @result;
401
}
402
403
sub _packages_in_file {
404
    my $self = shift;
405
    my ( $filename ) = @_;
406
407
    my $doc = $self->_ppi_for($filename);
408
    my $packages = $doc->find('PPI::Statement::Package');
409
    return if ( $packages eq '' );
410
411
    my @result;
412
    for my $item ( @{$packages} ) {
413
        for my $token ( @{$item->{children}} ) {
414
            next if ( !$token->isa('PPI::Token::Word') );
415
            next if ( $token->content eq 'package' );
416
            push @result, $token->content;
417
        }
418
    }
419
    return @result;
420
}
421
422
# PPI::Document object for $filename
423
sub _ppi_for {
424
    my $self = shift;
425
    my ($filename) = @_;
426
    if ( !defined $self->{ppi_for}->{$filename} ) {
427
        my $doc = PPI::Document->new($filename);
428
        $self->{ppi_for}->{$filename} = $doc;
429
    }
430
    return $self->{ppi_for}->{$filename};
431
}
432
433
434
1;
435
__END__
436
437
=head1 AUTHOR
438
439
Takuya Tsuchida E<lt>tsucchi@cpan.orgE<gt>
440
441
=head1 SEE ALSO
442
443
L<Test::Dependencies> has almost same feature.
444
445
=head1 REPOSITORY
446
447
L<http://github.com/tsucchi/Test-Module-Used>
448
449
450
=head1 COPYRIGHT AND LICENSE
451
452
Copyright (c) 2008-2010 Takuya Tsuchida
453
454
This library is free software; you can redistribute it and/or modify
455
it under the same terms as Perl itself.
456
457
=cut
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/001_use_ok.t (-7 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
2
use strict;
3
use warnings;
4
use Test::More tests=>1;
5
6
BEGIN { use_ok('Test::Module::Used') };
7
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/002_default.t (-12 lines)
Lines 1-12 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::More tests => 4;
5
use Test::Module::Used;
6
7
my $used = Test::Module::Used->new();
8
9
is_deeply($used->_test_dir, ['t']);#default directory for test
10
is_deeply($used->_lib_dir, ['lib']);
11
is($used->_meta_file, 'META.yml');
12
is($used->_version, '5.008000');
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/003_option.t (-20 lines)
Lines 1-20 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::More tests=> 5;
5
use Test::Module::Used;
6
use File::Spec::Functions qw(catfile);
7
8
my $used = Test::Module::Used->new(
9
    test_dir     => ['t', 'xt'],
10
    lib_dir      => ['lib', catfile('testdata', 'lib')],
11
    meta_file    => 'Meta.yml',
12
    perl_version => '5.010',
13
);
14
15
is_deeply($used->_test_dir, ['t', 'xt']);
16
is_deeply($used->_lib_dir, ['lib', catfile('testdata', 'lib')]);
17
is($used->_meta_file, 'Meta.yml');
18
is($used->_perl_version, '5.010');
19
is($used->_version, '5.010');
20
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/004_used_ok.t (-14 lines)
Lines 1-14 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::Module::Used;
5
use File::Spec::Functions qw(catfile);
6
7
my $used = Test::Module::Used->new(
8
    lib_dir    => [catfile('testdata', 'lib')],
9
    test_dir   => [catfile('testdata', 't')],
10
    meta_file  => catfile('testdata', 'META.yml2'),
11
    exclude_in_testdir => ['SampleModule'],
12
);
13
14
$used->ok;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/005_used_module.t (-42 lines)
Lines 1-42 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::More tests=>10;
5
use File::Spec::Functions qw(catfile);
6
use Test::Module::Used;
7
8
my $used = Test::Module::Used->new(
9
    lib_dir    => [catfile('testdata', 'lib')],
10
    test_dir   => [catfile('testdata', 't')],
11
    perl_version => '5.008',
12
);
13
is_deeply([$used->_pm_files], [catfile('testdata', 'lib', 'SampleModule.pm')]);
14
is_deeply([$used->_test_files],   [catfile('testdata', 't', '001_test.t')]);
15
is_deeply([$used->_used_modules()], [qw(Net::FTP Module::Used Test::Module::Used)]);
16
is_deeply([$used->_used_modules_in_test()], [qw(Test::More Test::Class)]);# SampleModule is ignored
17
is($used->_version, '5.008');# used version
18
19
is_deeply( [$used->_remove_core(qw(Module::Used Net::FTP Test::Module::Used))],
20
           ['Module::Used', 'Test::Module::Used'] );
21
22
23
24
# exclude
25
my $used2 = Test::Module::Used->new(
26
    lib_dir    => [catfile('testdata', 'lib')],
27
    test_dir   => [catfile('testdata', 't')],
28
    exclude_in_libdir => ['Module::Used'],
29
    exclude_in_testdir   => ['Test::Class'],
30
);
31
is_deeply([$used2->_used_modules()], [qw(Net::FTP Test::Module::Used)]);
32
is_deeply([$used2->_used_modules_in_test()], [qw(Test::More SampleModule)]);
33
34
# exclude after constructed
35
my $used3 = Test::Module::Used->new(
36
    lib_dir  => [catfile('testdata', 'lib')],
37
    test_dir => [catfile('testdata', 't')],
38
);
39
$used3->push_exclude_in_libdir(qw(Module::Used Net::FTP));
40
is_deeply([$used3->_used_modules()], [qw(Test::Module::Used)]);
41
$used3->push_exclude_in_testdir( qw(Test::More Test::Class) );
42
is_deeply([$used3->_used_modules_in_test()], []);
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/006_read_meta_yml.t (-44 lines)
Lines 1-44 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::More tests=>8;
5
use Test::Module::Used;
6
use File::Spec::Functions qw(catfile);
7
8
my $used = Test::Module::Used->new(
9
    meta_file => catfile('testdata', 'META.yml'),
10
);
11
$used->_read_meta_yml();
12
is_deeply( [$used->_build_requires()],
13
           ['ExtUtils::MakeMaker', 'Test::More'] );
14
15
is_deeply( [$used->_requires()],
16
           ['Module::Used', 'PPI::Document'] );#perl 5.8.0 isn't return
17
is($used->_version_from_meta(), "5.008000");
18
is($used->_version, "5.008000");
19
20
my $used2 = Test::Module::Used->new(
21
    meta_file => catfile('testdata', 'META.yml2'),
22
);
23
$used2->_read_meta_yml();
24
is_deeply( [$used2->_build_requires()],
25
           ['ExtUtils::MakeMaker', 'Test::Class', 'Test::More' ] );
26
27
is_deeply( [$used2->_requires()],
28
           ['Module::Used', 'Test::Module::Used'] );#perl 5.8.0 isn't return
29
30
31
# exclude
32
my $used3 = Test::Module::Used->new(
33
    meta_file => catfile('testdata', 'META.yml2'),
34
    exclude_in_build_requires => ['Test::Class'],
35
    exclude_in_requires       => ['Module::Used'],
36
);
37
$used3->_read_meta_yml();
38
is_deeply( [$used3->_build_requires()],
39
           ['ExtUtils::MakeMaker', 'Test::More' ] );
40
41
is_deeply( [$used3->_requires()],
42
           ['Test::Module::Used'] );#perl 5.8.0 isn't return
43
44
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/007_test_myself.t (-10 lines)
Lines 1-10 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
5
use Test::Module::Used;
6
7
my $used = Test::Module::Used->new(
8
    exclude_in_testdir => ['Test::Module::Used'],
9
);
10
$used->ok;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/008_test_is_empty.t (-14 lines)
Lines 1-14 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::Module::Used;
5
use File::Spec::Functions qw(catfile);
6
7
my $used = Test::Module::Used->new(
8
    test_dir  => [catfile('testdata', 't2')],
9
    lib_dir   => [catfile('testdata', 'lib2')],
10
    meta_file => catfile('testdata', 'META.yml3'),
11
    exclude_in_testdir => ['Test::Module::Used'],
12
);
13
14
$used->ok;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/009_auto_get_exclude.t (-33 lines)
Lines 1-33 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
use Test::More tests => 7;
5
use Test::Module::Used;
6
use File::Spec::Functions qw(catfile);
7
8
my $used = Test::Module::Used->new(
9
    test_dir  => [catfile('testdata', 't2')],
10
    lib_dir   => [catfile('testdata', 'lib2')],
11
    meta_file => catfile('testdata', 'META.yml3'),
12
);
13
14
15
is_deeply([$used->_packages_in($used->_pm_files)], ['My::Test']);
16
$used->_get_packages;
17
is_deeply($used->{exclude_in_testdir}, ['Test::Module::Used', 'My::Test']);
18
is_deeply($used->{exclude_in_libdir}, ['My::Test']);
19
20
my $used1 = Test::Module::Used->new(
21
    test_dir  => [catfile('testdata', 't2')],
22
    lib_dir   => [catfile('testdata', 'lib2')],
23
    test_lib_dir => [catfile('testdata', 't2', 'lib')],
24
    meta_file => catfile('testdata', 'META.yml3'),
25
);
26
27
is_deeply([$used1->_packages_in($used1->_pm_files)], ['My::Test']);
28
is_deeply([$used1->_packages_in($used1->_pm_files_in_test)], ['My::Test2']);
29
$used1->_get_packages;
30
is_deeply($used1->{exclude_in_testdir}, ['Test::Module::Used', 'My::Test', 'My::Test2']);
31
is_deeply($used1->{exclude_in_libdir}, ['My::Test']);
32
33
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/t/010_test_myself2.t (-8 lines)
Lines 1-8 Link Here
1
#!/usr/bin/perl -w
2
use strict;
3
use warnings;
4
5
use Test::Module::Used;
6
7
my $used = Test::Module::Used->new();
8
$used->ok;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/META.yml (-28 lines)
Lines 1-28 Link Here
1
---
2
abstract: 'Test dependency between module and META.yml'
3
author:
4
  - 'Takuya Tsuchida tsucchi@cpan.org'
5
build_requires:
6
  ExtUtils::MakeMaker: 6.42
7
  Test::More: 0.88
8
configure_requires:
9
  ExtUtils::MakeMaker: 6.42
10
distribution_type: module
11
generated_by: 'Module::Install version 0.91'
12
license: perl
13
meta-spec:
14
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
15
  version: 1.4
16
name: Test-Module-Used
17
no_index:
18
  directory:
19
    - inc
20
    - t
21
    - xt
22
requires:
23
  Module::Used: 0
24
  PPI::Document: 0
25
  perl: 5.8.0
26
resources:
27
  license: http://dev.perl.org/licenses/
28
version: 0.0.1
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/META.yml2 (-29 lines)
Lines 1-29 Link Here
1
---
2
abstract: 'Test dependency between module and META.yml'
3
author:
4
  - 'Takuya Tsuchida tsucchi@cpan.org'
5
build_requires:
6
  ExtUtils::MakeMaker: 6.42
7
  Test::More: 0.88
8
  Test::Class: 0
9
configure_requires:
10
  ExtUtils::MakeMaker: 6.42
11
distribution_type: module
12
generated_by: 'Module::Install version 0.91'
13
license: perl
14
meta-spec:
15
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
16
  version: 1.4
17
name: Test-Module-Used
18
no_index:
19
  directory:
20
    - inc
21
    - t
22
    - xt
23
requires:
24
  Module::Used: 0
25
  Test::Module::Used: 0
26
  perl: 5.8.0
27
resources:
28
  license: http://dev.perl.org/licenses/
29
version: 0.0.1
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/META.yml3 (-26 lines)
Lines 1-26 Link Here
1
---
2
abstract: 'write description here'
3
author:
4
  - 'Takuya Tsuchida E<lt>takuya.tsuchida@gmail.com<gt>'
5
build_requires:
6
  ExtUtils::MakeMaker: 6.42
7
  Test::More: 0.88
8
configure_requires:
9
  ExtUtils::MakeMaker: 6.42
10
distribution_type: module
11
generated_by: 'Module::Install version 0.91'
12
license: perl
13
meta-spec:
14
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
15
  version: 1.4
16
name: My-Test
17
no_index:
18
  directory:
19
    - inc
20
    - t
21
    - xt
22
requires:
23
  perl: 5.8.0
24
resources:
25
  license: http://dev.perl.org/licenses/
26
version: 0.0.1
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/lib/SampleModule.pm (-10 lines)
Lines 1-10 Link Here
1
package SampleModule;
2
use Net::FTP; #core
3
use Module::Used;#not core
4
use Test::Module::Used;#not core
5
6
use 5.00803;# perl version
7
8
sub do_nothing {}
9
10
1;
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/lib2/My/Test.pm (-42 lines)
Lines 1-42 Link Here
1
package My::Test;
2
use strict;
3
use warnings;
4
5
our $VERSION = "0.0.1";
6
#use 5.008;
7
8
=head1 NAME
9
10
My::Test - write description here
11
12
=head1 SYNOPSIS
13
14
write synopsis here
15
16
=head1 DESCRIPTION
17
18
write description here
19
=cut
20
21
22
1;
23
__END__
24
25
=head1 AUTHOR
26
27
Takuya Tsuchida E<lt>takuya.tsuchida@gmail.com<gt>
28
29
=head1 SEE ALSO
30
31
write here if related module exists
32
33
=head1 REPOSITORY
34
35
write source code repository
36
37
=head1 LICENSE
38
39
This library is free software; you can redistribute it and/or modify
40
it under the same terms as Perl itself.
41
42
=cut
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/t/001_test.t (-6 lines)
Lines 1-6 Link Here
1
#!/usr/bin/perl -w
2
use Test::More;
3
use Test::Class;
4
use SampleModule;
5
6
ok(1);
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/t2/001_use_ok.t (-7 lines)
Lines 1-7 Link Here
1
#!/usr/bin/perl
2
use strict;
3
use warnings;
4
use Test::More;
5
6
BEGIN { use_ok('My::Test') };
7
done_testing();
(-)/usr/home/tsucchi/ports/work/devel/p5-Test-Module-Used/work/Test-Module-Used-0.1.8/testdata/t2/lib/My/Test2.pm (-2 lines)
Lines 1-2 Link Here
1
package My::Test2;
2
1;

Return to bug 143527