WWW-StreetMap

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

use strict;
use Module::Build;

Module::Build->new(
	module_name        => 'WWW::StreetMap',
	license            => 'perl',
	requires           => {
		'File::Temp'        => 0,
		'Image::Magick'     => 0,
        'IO::All'           => '0.38',
        'IO::All::LWP'      => '0.14',
		'OpenOffice::OODoc' => 0,
	},
    build_requires     => {
        'Test::Distribution' => '1.29',
        'Devel::CheckOS'     => '1.42',
    },
	create_readme      => 1,
	scripts            => [ 'script/get_streetmap' ],

META.yml  view on Meta::CPAN

version: 0.18
author: []
abstract: Interface to http://www.streetmap.co.uk/
license: perl
resources:
  license: http://dev.perl.org/licenses/
requires:
  File::Temp: 0
  IO::All: 0.38
  IO::All::LWP: 0.14
  Image::Magick: 0
  OpenOffice::OODoc: 0
build_requires:
  Devel::CheckOS: 1.42
  Test::Distribution: 1.29
provides:
  WWW::StreetMap:
    file: lib/WWW/StreetMap.pm
    version: 0.18
generated_by: Module::Build version 0.2808
meta-spec:

lib/WWW/StreetMap.pm  view on Meta::CPAN

package WWW::StreetMap;



# pragmata
use strict;
use vars qw($VERSION);

# Standard Perl Library and CPAN modules
use File::Temp qw(tempfile);
use Image::Magick;
use IO::All;
use IO::All::LWP;
use OpenOffice::OODoc;


$VERSION = '0.18';

=head1 CLASS METHODS

=head2 new

lib/WWW/StreetMap.pm  view on Meta::CPAN


	# I guess could use WWW::Mechanize and its get_all_links instead of this....
	my @lines = io($self->{url})->slurp;

	my @image_urls = grep (/image.dll/, @lines);
	

	map {  s!  ^.*SRC="([^"]+)".*$ !$1!x } @image_urls;
	
	my @filenames = ();
	my $image = Image::Magick->new;
	foreach my $url (@image_urls) {
		my ($fh, $filename) = tempfile(SUFFIX=>'gif');
		chomp $url;
		io($url) > io($filename);
		$image->Read($filename);
		close $fh;  # auto deletes
	}
	
	my $map = $image->Montage(geometry=>'200x200', tile => '3x3');
	$map->Write($filename);



( run in 1.234 second using v1.01-cache-2.11-cpan-beeb90c9504 )