This is woof-perl, the Perl edition of Simon Buding's woof. It is a complete rewriting of the tool in Perl 5, with strict dependencies on standard packages and a few well-maintained main others. It mimics the behavior of the original tool, but for a few details. As in the case of the original tool it is thought to work under *nix systems, but could work also under Windows.
This version should be stable enough for use and forever, due to longevity and stability of Perl 5 and its APIs.
Usage: woof.pl [-i <ip_addr>] [-p <port>] [-c <count>] <file>
woof.pl [-i <ip_addr>] [-p <port>] [-c <count>] [-z|-j|-Z|-u] <dir>
woof.pl [-i <ip_addr>] [-p <port>] [-c <count>] -s
woof.pl [-i <ip_addr>] [-p <port>] [-c <count>] -U
woof.pl <url>
Serves a single file <count> times via http on port <port> on IP
address <ip_addr>.
When a directory is specified, an tar archive gets served. By default
it is gzip compressed. You can specify -z for gzip compression,
-j for bzip2 compression, -Z for ZIP compression or -u for no compression.
You can configure your default compression method in the configuration
file described below.
When -s is specified instead of a filename, woof.pl distributes itself.
When -U is specified, woof provides an upload form, allowing file uploads.
defaults: count = 1, port = 8080
If started with an url as an argument, woof acts as a client,
downloading the file and saving it in the current directory.
You can specify different defaults in two locations: /etc/woofrc
and ~/.woofrc can be INI-style config files containing the default
port and the default count. The file in the home directory takes
precedence. The compression methods are "off", "gz", "bz2" or "zip".
Sample file:
[main]
port = 8008
count = 2
ip = 127.0.0.1
compressed = gz
Can only serve single files/directories.
On a Debian/Ubuntu GNU/Linux system the minimal dependecies currently required are the following packages, but for core Perl packages:
libany-uri-escape-perl
libarchive-zip-perl
libconfig-inifiles-perl
libhttp-message-perl
liburi-perl
libwww-perl
Several methods can be used to install and distribute woof-perl using standard Perl distribution tools as alternative.
All methods require Perl 5.10 or higher, plus some basic tools:
# Debian/Ubuntu
sudo apt-get install build-essential cpanminus
# RHEL/CentOS/Fedora
sudo dnf install perl-core cpanminus gcc make
# macOS (with Homebrew)
brew install perl cpanminus
This method uses Carton to manage dependencies locally:
-
Install Carton if you don't have it:
cpanm Carton
-
Run the installation script:
./install.sh
This will:
- Install all dependencies locally in a
local
directory - Create wrapper scripts to properly set the environment
- Make the command available as
woof
- Install all dependencies locally in a
-
Add the installation bin directory to your PATH:
echo 'export PATH="$HOME/.local/woof-perl/bin:$PATH"' >> ~/.bashrc source ~/.bashrc
-
Test your installation:
woof --help
This creates a single-file executable that includes all dependencies:
-
Install required tools:
cpanm App::FatPacker Carton
-
Run the fatpacking script:
./fatpack.pl
-
The standalone executable will be created as
woof-packed.pl
-
Distribute this single file to users who can run it directly:
chmod +x woof-packed.pl ./woof-packed.pl --help
For enterprise environments where you need a private CPAN mirror:
-
Install Pinto:
cpanm Pinto
-
Set up your Pinto repository:
./pinto-setup.sh
-
Install woof-perl from your repository:
cpanm --mirror file://$HOME/.local/woof-perl-repo/stacks/woof-perl --mirror-only woof-perl
For completely isolated deployment:
-
Build the Docker image:
docker build -t woof-perl .
-
Run woof-perl in a container:
# To serve a file: docker run -p 8080:8080 -u $(id -u):$(id -g) -v $(pwd):/data woof-perl myfile.txt # To enable uploads: docker run -p 8080:8080 -u $(id -u):$(id -g) -v $(pwd):/data woof-perl -U
If you encounter missing dependencies:
# For Carton installation
cd ~/.local/woof-perl
carton install
# For standalone installations
cpanm --installdeps .
# Fix permissions on the executable
chmod +x ~/.local/woof-perl/bin/woof.pl
# Run directly with the full path
~/.local/woof-perl/bin/woof
# Or check your PATH configuration
echo $PATH