Geo-Constants-0.06/0000755000076400007640000000000010552630156014726 5ustar mdavismdavis00000000000000Geo-Constants-0.06/README0000644000076400007640000000014710534402344015604 0ustar mdavismdavis00000000000000If you have any comments I'd love to hear from you. Thanks, Mike (mrdvt92) qw/perl michaelrdavis com/ Geo-Constants-0.06/lib/0000755000076400007640000000000010552630156015474 5ustar mdavismdavis00000000000000Geo-Constants-0.06/lib/Geo/0000755000076400007640000000000010552630156016206 5ustar mdavismdavis00000000000000Geo-Constants-0.06/lib/Geo/Constants.pm0000644000076400007640000000431510552623423020522 0ustar mdavismdavis00000000000000require Exporter; package Geo::Constants; =head1 NAME Geo::Constants - Package for standard Geo:: constants. =head1 SYNOPSIS use Geo::Constants qw{PI DEG RAD}; #import into namespace print "PI: ", PI(), "\n"; print "d/r: ", DEG(), "\n"; print "r/d: ", RAD(), "\n"; use Geo::Constants; #Perl OO my $obj = Geo::Constants->new(); print "PI: ", $obj->PI, "\n"; print "d/r: ", $obj->DEG, "\n"; print "r/d: ", $obj->RAD, "\n"; =head1 DESCRIPTION =cut use strict; #use vars qw($VERSION $PACKAGE @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); use vars qw($VERSION @ISA @EXPORT_OK); @ISA = qw(Exporter); @EXPORT_OK = (qw{PI DEG RAD KNOTS}); $VERSION = sprintf("%d.%02d", q{Revision: 0.06} =~ /(\d+)\.(\d+)/); =head1 CONSTRUCTOR =head2 new The new() constructor my $obj = Geo::Constants->new(); =cut sub new { my $this = shift(); my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->initialize(@_); return $self; } =head1 METHODS =cut sub initialize { my $self = shift(); } =head2 PI my $pi = $obj->PI; use Geo::Constants qw{PI}; my $pi = PI(); =cut sub PI { return 4 * atan2(1,1); #Perl should complile this as a constant } =head2 DEG my $degrees_per_radian = $obj->DEG; use Geo::Constants qw{DEG}; my $degrees_per_radian = DEG(); =cut sub DEG { return 180 / PI(); #Degrees per radian } =head2 RAD my $radians_per_degree = $obj->RAD; use Geo::Constants qw{DEG}; my $radians_per_degree = RAD(); =cut sub RAD { return PI() / 180; #Radians per degree } =head2 KNOTS 1 nautical mile per hour = (1852/3600) m/s - United States Department of Commerce, National Institute of Standards and Technology, NIST Special Publication 330, 2001 Edition Returns 1852/3600 =cut sub KNOTS { return 1852/3600; #1 nautical mile per hour = (1852/3600) m/s } 1; __END__ =head1 TODO Add more constants =head1 BUGS Please send to the geo-perl email list. =head1 LIMITS =head1 AUTHOR Michael R. Davis qw/perl michaelrdavis com/ =head1 LICENSE Copyright (c) 2006 Michael R. Davis (mrdvt92) This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO Geo::Functions Geo::Ellipsoids Geo-Constants-0.06/LICENSE0000644000076400007640000000026010534402345015726 0ustar mdavismdavis00000000000000Copyright (c) 2006 Michael R. Davis (mrdvt92) All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Geo-Constants-0.06/t/0000755000076400007640000000000010552630156015171 5ustar mdavismdavis00000000000000Geo-Constants-0.06/t/base.t0000755000076400007640000000251010552624040016264 0ustar mdavismdavis00000000000000#!/usr/bin/perl -w # -*- perl -*- # # $Id: base.t,v 0.1 2006/02/21 eserte Exp $ # Author: Michael R. Davis # =head1 NAME base.t - Good examples concerning how to use this module =cut use strict; use lib q{lib}; use lib q{../lib}; use constant NEAR_DEFAULT => 7; sub near { my $x=shift(); my $y=shift(); my $p=shift()||NEAR_DEFAULT; if (($x-$y)/$y < 10**-$p) { return 1; } else { return 0; } } sub dms2dd { my $d=shift(); my $m=shift(); my $s=shift(); my $dir=shift()||'N'; my $val=$d+($m+$s/60)/60; if ($dir eq 'W' or $dir eq 'S') { return -$val; } else { return $val; } } BEGIN { if (!eval q{ use Test; 1; }) { print "1..0 # tests only works with installed Test module\n"; exit; } } BEGIN { plan tests => 10 } # just check that all modules can be compiled ok(eval {require Geo::Constants; 1}, 1, $@); my $o = Geo::Constants->new(); ok(ref $o, "Geo::Constants"); ok ($o->PI, 4*atan2(1,1)); ok ($o->DEG, 180/(4*atan2(1,1))); ok ($o->RAD, 4*atan2(1,1)/180); ok ($o->KNOTS, 1852/3600); use Geo::Constants qw{PI DEG RAD KNOTS}; ok (PI(), 4*atan2(1,1)); #Barewords on some machines or perl versions ok (DEG(), 180/(4*atan2(1,1))); #fail. So, I do not use them. You may use ok (RAD(), 4*atan2(1,1)/180); #them in your scripts but they may not port. ok (KNOTS(), 1852/3600); Geo-Constants-0.06/META.yml0000644000076400007640000000064510552630156016204 0ustar mdavismdavis00000000000000# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Geo-Constants version: 0.06 version_from: lib/Geo/Constants.pm installdirs: site requires: Exporter: 0 strict: 0 vars: 0 distribution_type: module generated_by: ExtUtils::MakeMaker version 6.17 Geo-Constants-0.06/MANIFEST0000644000076400007640000000015010534407331016050 0ustar mdavismdavis00000000000000CHANGES lib/Geo/Constants.pm LICENSE Makefile.PL MANIFEST This list of files META.yml README t/base.t Geo-Constants-0.06/Makefile.PL0000644000076400007640000000067310534507025016704 0ustar mdavismdavis00000000000000use ExtUtils::MakeMaker; WriteMakefile( NAME => q{Geo::Constants}, VERSION_FROM => q{lib/Geo/Constants.pm}, PREREQ_PM => { strict => 0, vars => 0, Exporter => 0, }, ($] >= 5.005 ? ( ABSTRACT_FROM => 'lib/Geo/Constants.pm', ) : () ), ); Geo-Constants-0.06/CHANGES0000644000076400007640000000030210536410435015712 0ustar mdavismdavis000000000000002006-12-08 v0.04 * Changed tests to be more portable 2006-12-05 v0.03 * Added Req for Exporter 2006-12-05 v0.03 * Added DEG and RAD * Documentation 2006-12-02 v0.01 * Original version