The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
use strict;
use warnings;
use lib qw( ./lib ../lib );

use Cwd;
use CSS::Inliner;

my $url = shift || 'http://www.cpan.org/index.html';

my $inliner = CSS::Inliner->new({ post_fetch_filter => \&post_fetch_filter });
$inliner->fetch_file({ url => $url });
my $inlined = $inliner->inlinify();

warn "================ FINAL HTML ===============";

print $inlined;

warn "================ ERRORS ===============";
foreach my $warning (@{$inliner->content_warnings}) {
  warn $warning;
}

sub post_fetch_filter { 
  my ($params) = @_;

  warn "execute filter";

  return $$params{html};
};