This is a simple perl script showing how you can use perl to communicate with a running instance of uzbl.
For instance, to get a dump of the current html document, you can do this:
uzblctrl.pl <socket> 'print @<document.all[0].innerHTML>@'
#!/usr/bin/env perl # simple perl implementation of uzblctrl, which can be used to query uzbl for stuff. # usage: uzblctrl.pl <socket> <command> # use strict; use IO::Socket::UNIX; use Digest::MD5 qw(md5_hex); my $path = shift; my @cmd = @ARGV; # simple Uzbl socket object sub Uzbl{ my $path = shift; # connect the socket my $socket = IO::Socket::UNIX->new(Type => SOCK_STREAM, Peer => $path) or die $@; return sub { my $line = shift; # generate a end marker my $mark = md5_hex(rand()); # send the command and request endmarker print $socket "$line\nprint $mark\n"; my $str; while(my $line = <$socket>){ #read until end marker if($line =~ m/^$mark$/){ chomp($str); return $str; } else { $str .= $line; } } } } # create object my $query = Uzbl($path); # send command print $query->("@cmd");