Map::Tube v3.62 - UPDATE
One thing about Map::Tube that kept annoying me for long time, is not able to format the result of search without bending the back. Let me share the details what I am talking about. Earlier, before v3.62, this is what you would had to do to format the result.
use strict; use warnings;
use Map::Tube::London;
my $map = Map::Tube::London->new;
my $route = $map->get_shortest_route('Baker Street', 'Wembley Park');
print $map->to_json($route);
We have a plugin Map::Tube::Plugin::Formatter that provides the functionalities. It currently supports the following formats.
1. XML
2. JSON
3. YAML
4. STRING
If you noticed the line "print $map->to_json($route);", this is plain ugly, in my opinion and I always wanted to clean up. Yesterday, I finally got that done. Now the above code can be simplified as below:
use strict; use warnings;
use Map::Tube::London;
my $map = Map::Tube::London->new;
my $route = $map->get_shortest_route('Baker Street', 'Wembley Park');
print $route->to_json;
Or even one-liner like below:
use strict; use warnings;
use Map::Tube::London;
print Map::Tube::London->new->get_shortest_route('Baker Street', 'Wembley Park')->to_json;
I am sure, there is still scope for improvements but for now, I am happy.
Any suggestions?
Leave a comment