| 1 | package Archive::Unzip::Burst; | ||||||||||
| 2 | |||||||||||
| 3 | # The license of this Perl code is the same as that of perl itself. | ||||||||||
| 4 | # The documentation which should be embedded at the end of this file | ||||||||||
| 5 | # should contain more details. | ||||||||||
| 6 | # | ||||||||||
| 7 | # The license of the InfoZip library which is used by this module is | ||||||||||
| 8 | # reproduced in full in the following paragraphs: | ||||||||||
| 9 | # | ||||||||||
| 10 | # This is version 2005-Feb-10 of the Info-ZIP copyright and license. | ||||||||||
| 11 | # The definitive version of this document should be available at | ||||||||||
| 12 | # ftp://ftp.info-zip.org/pub/infozip/license.html indefinitely. | ||||||||||
| 13 | # | ||||||||||
| 14 | # | ||||||||||
| 15 | # Copyright (c) 1990-2005 Info-ZIP. All rights reserved. | ||||||||||
| 16 | # | ||||||||||
| 17 | # For the purposes of this copyright and license, "Info-ZIP" is defined as | ||||||||||
| 18 | # the following set of individuals: | ||||||||||
| 19 | # | ||||||||||
| 20 | # Mark Adler, John Bush, Karl Davis, Harald Denker, Jean-Michel Dubois, | ||||||||||
| 21 | # Jean-loup Gailly, Hunter Goatley, Ed Gordon, Ian Gorman, Chris Herborth, | ||||||||||
| 22 | # Dirk Haase, Greg Hartwig, Robert Heath, Jonathan Hudson, Paul Kienitz, | ||||||||||
| 23 | # David Kirschbaum, Johnny Lee, Onno van der Linden, Igor Mandrichenko, | ||||||||||
| 24 | # Steve P. Miller, Sergio Monesi, Keith Owens, George Petrov, Greg Roelofs, | ||||||||||
| 25 | # Kai Uwe Rommel, Steve Salisbury, Dave Smith, Steven M. Schweda, | ||||||||||
| 26 | # Christian Spieler, Cosmin Truta, Antoine Verheijen, Paul von Behren, | ||||||||||
| 27 | # Rich Wales, Mike White | ||||||||||
| 28 | # | ||||||||||
| 29 | # This software is provided "as is," without warranty of any kind, express | ||||||||||
| 30 | # or implied. In no event shall Info-ZIP or its contributors be held liable | ||||||||||
| 31 | # for any direct, indirect, incidental, special or consequential damages | ||||||||||
| 32 | # arising out of the use of or inability to use this software. | ||||||||||
| 33 | # | ||||||||||
| 34 | # Permission is granted to anyone to use this software for any purpose, | ||||||||||
| 35 | # including commercial applications, and to alter it and redistribute it | ||||||||||
| 36 | # freely, subject to the following restrictions: | ||||||||||
| 37 | # | ||||||||||
| 38 | # 1. Redistributions of source code must retain the above copyright notice, | ||||||||||
| 39 | # definition, disclaimer, and this list of conditions. | ||||||||||
| 40 | # | ||||||||||
| 41 | # 2. Redistributions in binary form (compiled executables) must reproduce | ||||||||||
| 42 | # the above copyright notice, definition, disclaimer, and this list of | ||||||||||
| 43 | # conditions in documentation and/or other materials provided with the | ||||||||||
| 44 | # distribution. The sole exception to this condition is redistribution | ||||||||||
| 45 | # of a standard UnZipSFX binary (including SFXWiz) as part of a | ||||||||||
| 46 | # self-extracting archive; that is permitted without inclusion of this | ||||||||||
| 47 | # license, as long as the normal SFX banner has not been removed from | ||||||||||
| 48 | # the binary or disabled. | ||||||||||
| 49 | # | ||||||||||
| 50 | # 3. Altered versions--including, but not limited to, ports to new operating | ||||||||||
| 51 | # systems, existing ports with new graphical interfaces, and dynamic, | ||||||||||
| 52 | # shared, or static library versions--must be plainly marked as such | ||||||||||
| 53 | # and must not be misrepresented as being the original source. Such | ||||||||||
| 54 | # altered versions also must not be misrepresented as being Info-ZIP | ||||||||||
| 55 | # releases--including, but not limited to, labeling of the altered | ||||||||||
| 56 | # versions with the names "Info-ZIP" (or any variation thereof, including, | ||||||||||
| 57 | # but not limited to, different capitalizations), "Pocket UnZip," "WiZ" | ||||||||||
| 58 | # or "MacZip" without the explicit permission of Info-ZIP. Such altered | ||||||||||
| 59 | # versions are further prohibited from misrepresentative use of the | ||||||||||
| 60 | # Zip-Bugs or Info-ZIP e-mail addresses or of the Info-ZIP URL(s). | ||||||||||
| 61 | # | ||||||||||
| 62 | # 4. Info-ZIP retains the right to use the names "Info-ZIP," "Zip," "UnZip," | ||||||||||
| 63 | # "UnZipSFX," "WiZ," "Pocket UnZip," "Pocket Zip," and "MacZip" for its | ||||||||||
| 64 | # own source and binary releases. | ||||||||||
| 65 | |||||||||||
| 66 | |||||||||||
| 67 | 2 | ▶ | use 5.006; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 68 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 69 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 70 | |||||||||||
| 71 | 2 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=9.2
| |||||||||||
| 72 | 2 | ▶ | if (eval "require prefork;") { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 73 | 0 | eval "prefork->import(qw/Cwd File::Spec/)"; | |||||||||
| 74 | } | ||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | 2 | require Exporter; | |||||||||
| 78 | |||||||||||
| 79 | 2 | our @ISA = qw(Exporter); | |||||||||
| 80 | |||||||||||
| 81 | 2 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||
| 82 | unzip | ||||||||||
| 83 | ) ] ); | ||||||||||
| 84 | |||||||||||
| 85 | 2 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 86 | |||||||||||
| 87 | 2 | our @EXPORT = qw(); | |||||||||
| 88 | |||||||||||
| 89 | 2 | our $VERSION = '0.09'; | |||||||||
| 90 | |||||||||||
| 91 | 2 | require XSLoader; | |||||||||
| 92 | 2 | XSLoader::load('Archive::Unzip::Burst', $VERSION); | |||||||||
| 93 | |||||||||||
| 94 | 2 | ▶ | sub unzip { | ||||||||
|
Subroutine
unzip: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||
| 95 | 2 | my $filename = shift; | |||||||||
| 96 | 2 | my $dir = shift; | |||||||||
| 97 | 2 | require Cwd; | |||||||||
| 98 | 2 | require File::Spec; | |||||||||
| 99 | 2 | ▶ | if (not -f $filename) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | 0 | die "ZIP file not found: $filename"; | |||||||||
| 101 | } | ||||||||||
| 102 | 2 | my $file_is_abs = File::Spec->file_name_is_absolute($filename); | |||||||||
| 103 | 2 | ▶ | if (not $file_is_abs) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 104 | 1 | $filename = File::Spec->rel2abs($filename); | |||||||||
| 105 | } | ||||||||||
| 106 | 2 | my $olddir = Cwd::cwd(); | |||||||||
| 107 | 2 | mkdir($dir); | |||||||||
| 108 | 2 | ▶ | chdir($dir) or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 109 | 2 | my $ret = _unzip($filename); | |||||||||
| 110 | 2 | ▶ | chdir($olddir) or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 111 | 2 | return $ret; | |||||||||
| 112 | } | ||||||||||
| 113 | |||||||||||
| 114 | 2 | 1; | |||||||||
| 115 | __END__ | ||||||||||