Server IP : 103.119.228.120 / Your IP : 18.118.137.96 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/ssl/local/share/perl5/Archive/Tar/ |
Upload File : |
package Archive::Tar::Streamed; use strict; BEGIN { use vars qw ($VERSION @ISA); $VERSION = 0.03; } use Archive::Tar; use Archive::Tar::Constant; use Carp; sub new { my ($pkg,$arch) = @_; bless {file => $arch}, $pkg; } sub add { my $self = shift; my $arch = Archive::Tar->new; $arch->add_files(@_) or croak "add: $!"; my $tf = $arch->write; syswrite $self->{file}, $tf, length($tf) - (BLOCK * 2); } sub next { my $self = shift; $self->{pending} ||= []; return shift @{$self->{pending}} if @{$self->{pending}}; my $arch = Archive::Tar->new; my ($fil,@pend) = $arch->read( $self->{file}, 0, {limit => 1}); $self->{pending} = \@pend; $fil; } sub writeeof { my $self = shift; syswrite $self->{file},TAR_END; } 1; __END__ =head1 NAME Archive::Tar::Streamed - Tar archives, non memory resident =head1 SYNOPSIS use Archive::Tar::Streamed; my $fh; open $fh,'>','/home/myarch.tar' or die "Couldn't create archive"; binmode $fh; my $tar = Archive::Tar::Streamed->new($fh); $tar->add('file1'); $tar->add(@files); my $fh2l open $fh2,'<','prevarch.tar' or die "Couldn't open archive"; binmode $fh; my $tar2 = Archive::Tar::Streamed->new($fh2); my $fil = $tar2->next; =head1 DESCRIPTION The L<Archive::Tar> module is a powerfull tool for manipulating archives from perl. However, most of the time, this module needs the entire archive to be resident in memory. This renders the module per se, not to be directly usable for very large archive (of the order of gigabytes). Archive::Tar::Streamed provides a wrapper, which allows working with tar archives on disk, with no need for the archive to be memory resident. This module provides an alternative answer to the FAQ "Isn't Archive::Tar heavier on memory than /bin/tar?". It also aims to be portable, and available on platforms without a native tar. =head2 add This is a method call to add one or more files to an archive. These are written to disk before the method returns. =head2 next This method is an iterator, which returns an L<Archive::Tar::File> object for the next file, or undef. undef indicates the end of the archive; any unexpected conditions result in throwing an exception. =head1 BUGS Please use http://rt.cpan.org to report any bugs in this module =head1 AUTHOR I. Williams bitumen@xemaps.com =head1 COPYRIGHT This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. =head1 SEE ALSO L<Archive::Tar>