Commit 47ccb73 1 parent 1393c25 commit 47ccb73 Copy full SHA for 47ccb73
File tree 3 files changed +50
-4
lines changed
3 files changed +50
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"perl" : " 6.*" ,
3
3
"name" : " Archive::SimpleZip" ,
4
- "version" : " 0.3 .0" ,
4
+ "version" : " 0.4 .0" ,
5
5
"description" : " Write Zip Files." ,
6
6
"authors" : [ " Paul Marquess <pmqs@cpan.org>" ],
7
7
"tags" : [ " archive" , " compression" ],
Original file line number Diff line number Diff line change 1
1
2
- unit module Archive::SimpleZip : ver<0.3 .0 >: auth<Paul Marquess (pmqs@cpan.org) >;
2
+ unit module Archive::SimpleZip : ver<0.4 .0 >: auth<Paul Marquess (pmqs@cpan.org) >;
3
3
4
4
need Compress::Zlib;
5
5
# need Compress::Bzip2; # disable for now
@@ -17,7 +17,7 @@ use CompUnit::Util :re-export;
17
17
BEGIN re-export(' Archive::SimpleZip::Headers' );
18
18
19
19
20
- class SimpleZip is export
20
+ class SimpleZip does Callable is export
21
21
{
22
22
has IO ::Handle $ ! zip-filehandle ;
23
23
has IO ::Path $ . filename ;
@@ -54,6 +54,16 @@ class SimpleZip is export
54
54
if $ ! zip64 ;
55
55
}
56
56
57
+ method CALL-ME (IO () $ path , | c --> IO )
58
+ {
59
+ return $ path
60
+ unless $ path ;
61
+
62
+ self . add($ path , | c);
63
+
64
+ $ path ;
65
+ }
66
+
57
67
multi method add (Str : D $ string , | c --> Int : D )
58
68
{
59
69
# say "ADDING String [{$string.^name}][$string]";
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ use lib 't';
6
6
7
7
use Test ;
8
8
9
- plan 10 ;
9
+ plan 11 ;
10
10
11
11
use ZipTest;
12
12
@@ -289,6 +289,42 @@ subtest # List
289
289
290
290
}, " list" ;
291
291
292
+ subtest # List
293
+ {
294
+ use IO ::Glob;
295
+ unlink $ zipfile ;
296
+
297
+ my $ dir2 = ' dir2' ;
298
+ ok mkdir $ dir2 , 0o777 ;
299
+
300
+ my $ datafile = " $ dir2 /gdata123" ;
301
+ my $ datafile1 = " gdata124" ;
302
+ my $ datafile2 = " gdata125" ;
303
+
304
+ spurt $ datafile , " some data" ;
305
+ spurt $ datafile1 , " more data" ;
306
+ spurt $ datafile2 , " even more data" ;
307
+
308
+ ok $ datafile . IO . e , " $ datafile does exists" ;
309
+ nok $ zipfile . IO . e , " $ zipfile does not exists" ;
310
+
311
+ my $ zip = SimpleZip. new ($ zipfile );
312
+ isa-ok $ zip , SimpleZip;
313
+
314
+ my @ got = glob(" gdata*" )>>. grep (/5 /). $ zip (). subst (/"gdata" /, " fred" );
315
+
316
+ ok $ zip . close (), " closed" ;
317
+
318
+ is @ got , ' fred125' ;
319
+ is get-filenames-in-zip($ zipfile ), $ datafile2 , " filename OK" ;
320
+
321
+ unlink $ zipfile ;
322
+
323
+ # @got = glob("gdata*").dir.$zip().subst(/"gdata"/, "fred");
324
+
325
+
326
+ }, " CALL-ME" ;
327
+
292
328
subtest
293
329
{
294
330
# Add file that doesn't exist
You can’t perform that action at this time.
0 commit comments