/[maps]/Maps.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /Maps.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 14 - (show annotations)
Mon Dec 3 14:25:40 2007 UTC (11 years, 11 months ago) by dpavlin
File size: 1324 byte(s)
- refactored NMEA parsing into own package from web interface
- script which converts NMEA dump to KML for GoogleMaps
1 package Net::Analysis::Listener::Maps;
2
3 use strict;
4 use warnings;
5 use base qw(Net::Analysis::Listener::Base);
6 use File::Slurp;
7
8 my $i = 0;
9
10 sub http_transaction {
11 my ($self, $args) = @_;
12 my ($req) = $args->{req}; # isa HTTP::Request
13 my ($resp) = $args->{resp}; # isa HTTP::Response
14 my ($req_mono) = $args->{req_mono}; # isa Net::Analysis::TCPMonologue
15 my ($resp_mono) = $args->{resp_mono}; # isa Net::Analysis::TCPMonologue
16
17 my $file;
18
19 if ( $req->uri() =~ m!/GElin/MapSrv\.aspx\?lwM=(\d+)&twM=(\d+)&zf=(\d+)! ) {
20 # Mireo
21 $file = "$3/$1-$2.gif";
22 } elsif ( $req->uri() =~ m!/mt\?.*x=(\d+)&y=(\d+)&zoom=(\d+)! ) {
23 # Google maps
24 $file = "$3/$1-$2.png";
25 } elsif ( $req->uri() =~ m!/aerial.maps.yimg.com/img.*&x=(\d+)&y=(\d+)&z=(\d+)&v=1\.7! ) {
26 # Yahoo maps
27 $file = "$3/$1-$2.jpg";
28 } elsif ( $req->uri() =~ m!/GElin/mireo.NET.MapSearchWeb! ) {
29 $file = "foo$i";
30 $i++;
31 }
32
33 if ( $file ) {
34 mkdir "dump" unless -e "dump";
35 mkdir "dump/$3" unless -e "dump/$3";
36 write_file( "dump/$file", $resp->content );
37 print "$1x$2 zoom: $3 -> $file ", -s "dump/$file", " bytes\n";
38 } else {
39 print ">> ",$req->uri, "\n";
40 }
41
42
43 }
44
45 1;
46
47 =head1 NAME
48
49 Net::Analysis::Listener::Maps - looking at HTTP transactions
50
51 $ perl -MNet::Analysis -e main HTTP Maps maps_dump.tcp
52

  ViewVC Help
Powered by ViewVC 1.1.26