Group
Extension

Matches 4

Map-Tube ( M/MA/MANWAR/Map-Tube-4.10.tar.gz, MANWAR, 2025; MetaCPAN )
Map-Tube/lib/Map/Tube.pm ( view source; MetaCPAN )
;
    unless ((grep /^xml$/, @attributes) || (grep /^json$/, @attributes)) {
        die "ERROR: Can't apply Map::Tube role, missing 'xml' or 'json'.";
    }

    $self->_init_map;
    $self->_load_pl
_number => $caller->[2] });
    }
    else {
        my $json = $self->json;
        if ($json ne '') {
            eval { $data = to_perl($json) };
            unless ($@) {
                $self->_v
              method      => $method,
                message     => "ERROR: Malformed Map Data ($json): $@",
                filename    => $caller->[1],
                line_number => $caller->[2] }
Map-Tube ( M/MA/MANWAR/Map-Tube-4.10.tar.gz, MANWAR, 2025; MetaCPAN )
Map-Tube/lib/Test/Map/Tube.pm ( view source; MetaCPAN )
 data (XML or JSON) and store it
  # surreptitiously in the Map::Tube object for later use.
  my $map = shift;
  return _prepare_xml_map($map ) if $map->can('xml');
  return _prepare_json_map($map) if
n_served_by_lines,
                     };
  return $map;
}


sub _prepare_json_map {
  # analyse the original map data (JSON format) and store them
  # surreptitiously in the Map::Tube object for lat
ion_served_by_lines,
      %station_line_count,
    );

  my $json = Map::Tube::Utils::to_perl( $map->json( ) );

  for my $line ( @{ $json->{lines}{line} } ) {
    my $id_case = $line->{id};
    my $
Map-Tube ( M/MA/MANWAR/Map-Tube-4.10.tar.gz, MANWAR, 2025; MetaCPAN )
Map-Tube/lib/Map/Tube/Cookbook.pm ( view source; MetaCPAN )
Tube> library.

=head1 CREATE A MAP

C<Map::Tube v3.22> or above now supports map data in XML and JSON format. Here is
the structure of a map in XML format:

    <?xml version="1.0" encoding="UTF-8"?>
         .....
           .....
           .....
        </stations>
    </tube>

And the same in JSON format:

   {
       "name"  : "Your-Map-Name",
       "lines" : {
           "line" : [
        
 line="L1:8" link="L07"             />
        </stations>
    </tube>

Next is the JSON representation C<sample.json> of the above map:

   {
       "name"     : "Sample",
       "lines"    : { "line
Map-Tube ( M/MA/MANWAR/Map-Tube-4.10.tar.gz, MANWAR, 2025; MetaCPAN )
Map-Tube/lib/Map/Tube/Utils.pm ( view source; MetaCPAN )
1 VERSION

Version 4.10

=cut

use utf8;
use v5.14;
use strict;
use warnings;

use Try::Tiny;
use JSON::MaybeXS;
use Scalar::Util ();
use File::ShareDir ':ALL';
use Unicode::Normalize 'NFC';

use pare
e) = @_;

    my $json_text = do {
        open(my $json_fh, "<", $file) or die("ERROR: Can't open $file: $!\n");
        local $/;
        my $text = <$json_fh>;
        close($json_fh);
        $tex
t;
    };

    try {
        return JSON::MaybeXS->new->allow_nonref->utf8(1)->decode($json_text);
    }
    catch {
        die $@;
    };
}

sub trim {
    my ($data) = @_;

    return unless define

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.