Geo-Raster
view release on metacpan or search on metacpan
my($gd,$i0,$j0,$k) = @_;
$k = 1 if !$k;
my($i,$j);
for $i ($i0-$k..$i0+$k) {
for $j ($j0-$k..$j0+$k) {
print $gd->get($i,$j),' ';
}
print("\n");
}
}
=pod
=head1 vars
Command C<vars> lists all variables, and if they are references, the
type of data which they refer to.
=cut
sub vars {
my @scalars;
my @arrays;
my @hashes;
foreach (sort keys %main::) {
next if /^_/;
# next if /^[A-Z]/;
next if /^$/;
next if /^scalars$/;
next if /^[^a-z]/;
next if /::/;
local *sym = $main::{$_};
my $scalar = ref($sym);
$scalar = 'scalar' unless $scalar;
push @scalars, "$scalar \$$_ is defined\n" if defined($sym);
push @arrays, "array \@$_ is defined\n" if defined(@sym);
push @hashes, "hash \%$_ is defined\n" if defined(%sym);
}
foreach (@scalars) {
print;
}
foreach (@arrays) {
print;
}
foreach (@hashes) {
print;
}
}
=pod
=head1 SIGINT
rash installs a SIGINT handler which may used to cancel lengthy raster
operations.
=cut
sub cntrlc {
my($sig) = @_;
&Raster::gdsigint(1);
}
=pod
=head1 HELP
Commands C<?> and C<help> run C<perldoc rash> thus showing this
manual page.
Command C<? Raster> and C<help Raster> run C<man Raster> thus showing the
manual page of the Raster module.
=head1 EXECUTING SYSTEM COMMANDS
A command line which begins with '!' is interpreted as a system
command.
=cut
sub a2xy {
my $a = shift;
my @xy;
my $i = 0;
foreach (@{$a}) {
push @xy,[$i,$_];
$i++;
}
return [@xy];
}
options(@ARGV);
$SIG{INT} = 'cntrlc';
$_term = new Term::ReadLine 'rash';
my $_hfile = "$ENV{HOME}/.rash_history";
$_term->ReadHistory($_hfile);
while ( defined ($_ = $_term->readline('>')) ) {
chomp;
$_input = $_;
if (/^\?$/ or /^help$/i) {
system "perldoc $0";
} elsif (/^\? Raster$/ or /^help Raster$/i) {
system "man Raster";
} elsif (/^\!(.*)/) {
system $1;
} else {
eval;
print $@;
}
# $_term->addhistory($_input) if $_input =~ /\S/;
}
$_term->WriteHistory($_hfile);
db_close() if $_options{db_connection};
if ($_options{gnuplot}) {
close(GNUPLOT);
unlink $_plot_file;
}
print "\n";
##### cellular automatons a'la new kind of science
( run in 0.768 second using v1.01-cache-2.11-cpan-71847e10f99 )