CGP-CLI
view release on metacpan or search on metacpan
lib/CGP/CLI.pm view on Meta::CPAN
} else {
last;
}
$result .= $ch;
++$this->{'span'};
}
return $result;
}
sub readKey() {
my $this = shift;
return $this->readWord();
}
sub readValue() {
my $this = shift;
$this->skipSpaces();
my $ch=substr($this->{'data'},$this->{'span'},1);
if($ch eq '{') {
++$this->{'span'};
return $this->readDictionary();
} elsif($ch eq '(') {
++$this->{'span'};
return $this->readArray();
} else {
return $this->readWord();
}
}
sub readArray() {
my $this = shift;
my $result=[];
while($this->{'span'}<$this->{'len'}) {
$this->skipSpaces();
if(substr($this->{'data'},$this->{'span'},1) eq ')') {
++$this->{'span'};
last;
} else {
my $theValue=$this->readValue();
$this->skipSpaces();
( run in 0.766 second using v1.01-cache-2.11-cpan-65fba6d93b7 )