NAME

Zodiac::Angle - Class for zodiac_angle manipulation.

SYNOPSIS

use Zodiac::Angle;

my $obj = Zodiac::Angle->new(%params);
my $zodiac_angle = $obj->angle2zodiac($angle, $opts_hr);
my $angle = $obj->zodiac2angle($zodiac_angle);

METHODS

new

my $obj = Zodiac::Angle->new(%params);

Constructor.

Returns instance of 'Zodiac::Angle'.

angle2zodiac

my $zodiac_angle = $obj->angle2zodiac($angle, $opts_hr);

Convert angle to Zodiac angle.

Options defined $opts_hr control output. Possible keys in reference to hash are: minute (0/1 print minutes), second (0/1 print second), second_round (number of round numbers, default 4), sign_type (sign or ascii, default sign).

Default value of $opts_hr is { minute => 1 }.

Returns zodiac angle string.

zodiac2angle

my $angle = $obj->zodiac2angle($zodiac_angle);

Convert Zodiac angle to angle.

Returns angle.

ERRORS

new():
        From Class::Utils::set_params():
                Unknown parameter '%s'.

angle2zodiac():
        Parameter 'sign_type' is bad. Possible values are 'sign' and 'ascii'.

EXAMPLE1

use strict;
use warnings;

use Zodiac::Angle;
use Unicode::UTF8 qw(encode_utf8);

# Object.
my $obj = Zodiac::Angle->new;

if (@ARGV < 1) {
        print STDERR "Usage: $0 angle\n";
        exit 1;
}
my $angle = $ARGV[0];

my $zodiac_angle = Zodiac::Angle->new->angle2zodiac($angle);

# Print out.
print 'Angle: '.$angle."\n";
print 'Zodiac angle: '.encode_utf8($zodiac_angle)."\n";

# Output without arguments:
# Usage: __SCRIPT__ angle

# Output with '0.5' argument:
# Angle: 0.5
# Zodiac angle: 0°♈30′

EXAMPLE2

use strict;
use warnings;

use Zodiac::Angle;
use Unicode::UTF8 qw(encode_utf8);

# Object.
my $obj = Zodiac::Angle->new;

if (@ARGV < 1) {
        print STDERR "Usage: $0 angle\n";
        exit 1;
}
my $angle = $ARGV[0];

my $zodiac_angle = Zodiac::Angle->new->angle2zodiac($angle, {
        'minute' => 0,
});

# Print out.
print 'Angle: '.$angle."\n";
print 'Zodiac angle: '.encode_utf8($zodiac_angle)."\n";

# Output without arguments:
# Usage: __SCRIPT__ angle

# Output with '0.5' argument:
# Angle: 0.5
# Zodiac angle: 0°♈

EXAMPLE3

use strict;
use warnings;

use Zodiac::Angle;
use Unicode::UTF8 qw(encode_utf8);

# Object.
my $obj = Zodiac::Angle->new;

if (@ARGV < 1) {
        print STDERR "Usage: $0 angle\n";
        exit 1;
}
my $angle = $ARGV[0];

my $zodiac_angle = Zodiac::Angle->new->angle2zodiac($angle, {
        'minute' => 1,
        'second' => 1,
        'second_round' => 4,
});

# Print out.
print 'Angle: '.$angle."\n";
print 'Zodiac angle: '.encode_utf8($zodiac_angle)."\n";

# Output without arguments:
# Usage: __SCRIPT__ angle

# Output with '0.5' argument:
# Angle: 0.5
# Zodiac angle: 0°♈30′0.0000′′

EXAMPLE4

use strict;
use warnings;

use Zodiac::Angle;
use Unicode::UTF8 qw(encode_utf8);

# Object.
my $obj = Zodiac::Angle->new;

if (@ARGV < 1) {
        print STDERR "Usage: $0 angle\n";
        exit 1;
}
my $angle = $ARGV[0];

my $zodiac_angle = Zodiac::Angle->new->angle2zodiac($angle, {
        'minute' => 1,
        'second' => 1,
        'second_round' => 4,
        'sign_type' => 'ascii',
});

# Print out.
print 'Angle: '.$angle."\n";
print 'Zodiac angle: '.encode_utf8($zodiac_angle)."\n";

# Output without arguments:
# Usage: __SCRIPT__ angle

# Output with '0.5' argument:
# Angle: 0.5
# Zodiac angle: 0° ar 30'0.0000''

DEPENDENCIES

Class::Utils, Error::Pure, List::Util, Readonly, Unicode::UTF8.

SEE ALSO

angle2zodiac

Script to convert angle to zodiac string.

App::Angle2Zodiac

Base class for angle2zodiac script.

Zodiac::Angle::SwissEph

Class for zodiac_angle manipulation based on SwissEph.

REPOSITORY

https://github.com/michal-josef-spacek/Zodiac-Angle

AUTHOR

Michal Josef Špaček mailto:skim@cpan.org

http://skim.cz

LICENSE AND COPYRIGHT

© 2020-2023 Michal Josef Špaček

BSD 2-Clause License

VERSION

0.06