write('file.tar',$compressed)
Will write the in-memory archive to disk. If no filename is given, returns the entire formatted archive as a
string, which should be useful if you'd like to stuff the archive into a socket or a pipe to gzip or
something. If the second argument is true, the module will try to write the file compressed.
So simply use the multistage set of commands like it says in the docs with a slight change:
Note: I have not tested this but if the docs are correct this should work without mucking around with references to STDOUT. If it still doesn't work it is probably a problem with your copy of the module.use Archive::Tar; $tar = Archive::Tar->new(); $tar->read("origin.tar.gz",1); # you don't seem to want this line thou +gh $tar->add_files("file/foo.c", "file/bar.c"); $tar->add_data("file/baz.c","This is the file contents"); # $tar->write("files.tar"); print STDOUT $tar->write(); # make sure http headers are already print +ed before running this line
In reply to Re: Tar File To Web Browser
by repson
in thread Tar File To Web Browser
by Hrunting
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |