aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/uzbl/scripts/uzblcat
blob: 82341c7e74559dc29a72475074db2a6c5707978e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env perl
# uzblcat - safely push html to uzbl
# See http://www.uzbl.org/wiki/html-mode
use strict; use warnings;
 
my $html;
local $/;      # slurp files
# automagically choose to read from stdin/files/...
$html .= $_ for <>;
 
my $endmarker = rand;
$endmarker .= rand() while $html =~ /^\Q$endmarker\E$/m;
 
print "set base_url = $ENV{BASE_URL}\n" if $ENV{BASE_URL};
print << "EOS";
set html_endmarker = $endmarker
set mode = 1
$html
$endmarker
EOS