Astro::App::Satpass2::Utils - Utilities for Astro::App::Satpass2
use Astro::App::Satpass2::Utils qw{ instance }; instance( $foo, 'Bar' ) or die '$foo is not an instance of Bar';
This module is a grab-bag of utilities needed by Astro::App::Satpass2.
This module is private to the Astro::App::Satpass2 package. Any and all functions in it can be modified or revoked without prior notice. The documentation is for the convenience of the author.
All documented subroutines can be exported, but none are exported by default.
This module supports the following exportable subroutines:
has_method( $object, $method );
This exportable subroutine returns a code reference to the named method if the given object has the method, or a false value otherwise. What you actually get is the result of $invocant->can( $method ) if the invocant is a blessed reference, or a return otherwise.
$invocant->can( $method )
instance( $object, $class )
This exportable subroutine returns a true value if $object is an instance of $class, and false otherwise. The $object argument need not be a reference, nor need it be blessed, though in these cases the return is false.
$object
$class
load_package( $module ); load_package( $module, 'Astro::App::Satpass2' );
This exportable subroutine loads a Perl module. The first argument is the name of the module itself. Subsequent arguments are prefixes to try, without any trailing colons.
In the examples, if $module contains 'Foo', the first example will try to require 'Foo', and the second will try to require 'Astro::App::Satpass2::Foo' and require 'Foo', in that order. The first attempt that succeeds returns the name of the module actually loaded. If no attempt succeeds, undef is returned.
$module
'Foo'
require 'Foo'
require 'Astro::App::Satpass2::Foo'
undef
Arguments are cached, and subsequent attempts to load a module simply return the contents of the cache.
quoter( $string )
This exportable subroutine quotes and escapes its argument as necessary for the parser. Specifically, if $string is:
$string
* undef, 'undef' is returned;
'undef'
* a number, $string is returned unmodified;
* an empty string, '' is returned;
''
* a string containing white space, quotes, or dollar signs, the value is escaped and enclosed in double quotes ("").
""
* anything else is returned unmodified.
Support is by the author. Please file bug reports at http://rt.cpan.org, or in electronic mail to the author.
Thomas R. Wyant, III wyant at cpan dot org
Copyright (C) 2011-2012 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Astro::App::Satpass2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Astro::App::Satpass2
CPAN shell
perl -MCPAN -e shell install Astro::App::Satpass2
For more information on module installation, please visit the detailed CPAN module installation guide.