Calendar-Julian
    
    
  
  
  
view release on metacpan or search on metacpan
0.10  Tue Apr 09 13:00:00 2019
      - Updated dependency on Calendar::Plugin::Renderer v0.14.
0.09  Wed Mar 27 15:40:00 2019
      - Added dependency on Date::Julian::Simple v0.07.
0.08  Sun Dec 16 12:20:00 2018
      - Added dependency on Date::Julian::Simple v0.06.
0.07  Sun Jan 28 21:35:00 2018
      - Added test script t/calendar-julian.t.
0.06  Fri Jan 26 09:40:00 2018
      - Using namespace::autoclean instead.
0.05  Thu Jan 25 13:55:00 2018
      - Added test scripts (t/meta-json.t and t/meta-yml.t).
0.04  Wed Jan 24 19:55:00 2018
      - Added key 'provides' to the Makefile.PL script.
MANIFEST
MANIFEST.SKIP
Makefile.PL
README
lib/Calendar/Julian.pm
t/00-load.t
xt/manifest.t
xt/pod.t
xt/meta-json.t
xt/meta-yml.t
t/calendar-julian.t
t/julian.xml
t/fake-julian.xml
META.yml                                 Module YAML meta-data (added by MakeMaker)
META.json                                Module JSON meta-data (added by MakeMaker)
lib/Calendar/Julian.pm view on Meta::CPAN
    $self->date->validate_month($self->month) if $self->has_month;
    unless ($self->has_year && $self->has_month) {
        $self->year($self->date->year);
        $self->month($self->date->month);
    }
}
=head1 DESCRIPTION
The Julian  calendar  was  proclaimed  by Julius Cesar  in  46 B.C. and underwent
several modifications before reaching its final form in 8 C.E.The Julian calendar
differs  from  the Gregorian only in the determination of leap years, lacking the
correction  for  years divisible by 100 and 400 in the Gregorian calendar. In the
Julian calendar, any  positive year  is  a leap year if divisible by 4. (Negative
years are leap years if the absolute value divided by 4 yields a remainder of 1.)
Days are considered to begin at midnight.
In the Julian calendar the average year has a  length of 365.25 days. compared to
the actual solar tropical year of 365.24219878 days.The calendar thus accumulates
one  day  of error with respect to the solar year every 128 years. Being a purely
solar  calendar, no  attempt  is  made to  synchronise the start of months to the
phases of the Moon.
    +-----------------------------------------------------------------------------------+
    |                                  July [2017 BE]                                   |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
    |    Sunday |    Monday |   Tuesday | Wednesday |  Thursday |    Friday |  Saturday |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
    |                                                           |         1 |         2 |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
    |         3 |         4 |         5 |         6 |         7 |         8 |         9 |
lib/Calendar/Julian.pm view on Meta::CPAN
    |        10 |        11 |        12 |        13 |        14 |        15 |        16 |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
    |        17 |        18 |        19 |        20 |        21 |        22 |        23 |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
    |        24 |        25 |        26 |        27 |        28 |        29 |        30 |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
    |        31 |                                                                       |
    +-----------+-----------+-----------+-----------+-----------+-----------+-----------+
The package L<App::calendr> provides command line tool  C<calendr> to display the
supported calendars on the terminal. Support for  C<Julian Calendar>  is provided
by L<App::calendr> v0.17 or above.
=head1 SYNOPSIS
    use strict; use warnings;
    use Calendar::Julian;
    # prints current julian month calendar.
    print Calendar::Julian->new, "\n";
    print Calendar::Julian->new->current, "\n";
    # prints julian month calendar in which the given julian day falls in.
    print Calendar::Julian->new->from_julian(2457102.5), "\n";
    # prints current month julian calendar in SVG format.
    print Calendar::Julian->new->as_svg;
    # prints current month julian calendar in text format.
    print Calendar::Julian->new->as_text;
=head1 JULIAN MONTHS
    +--------+------------------------------------------------------------------+
    | Number | Name                                                             |
    +--------+------------------------------------------------------------------+
    |   1    | January                                                          |
    |   2    | February                                                         |
    |   3    | March                                                            |
lib/Calendar/Julian.pm view on Meta::CPAN
    | Wednesday                                                                 |
    | Thursday                                                                  |
    | Friday                                                                    |
    | Saturday                                                                  |
    +---------------------------------------------------------------------------+
=head1 METHODS
=head2 current()
Returns current month of the Julian calendar.
=cut
sub current {
    my ($self) = @_;
    return $self->as_text($self->date->month, $self->date->year);
}
=head2 from_julian($julian_day)
Returns Julian month calendar in which the given C<$julian_day> falls in.
=cut
sub from_julian {
    my ($self, $julian_day) = @_;
    my $date = $self->date->from_julian($julian_day);
    return $self->as_text($date->month, $date->year);
}
=head2 as_svg($month, $year)
Returns calendar for the given C<$month> and C<$year> rendered  in SVG format. If
C<$month> and C<$year> missing, it would return current calendar month.
=cut
sub as_svg {
    my ($self, $month, $year) = @_;
    ($month, $year) = $self->validate_params($month, $year);
    my $date = Date::Julian::Simple->new({ year => $year, month => $month, day => 1 });
    return $self->svg_calendar(
        {
            start_index => $date->day_of_week,
            month_name  => $date->months->[$month],
            days        => $date->days_in_month_year($month, $year),
            year        => $year
        });
}
=head2 as_text($month, $year)
Returns  color  coded Julian calendar for the  given  C<$month>  and C<$year>. If
C<$month> and C<$year> missing, it would return current calendar month.
=cut
sub as_text {
    my ($self, $month, $year) = @_;
    ($month, $year) = $self->validate_params($month, $year);
    my $date = Date::Julian::Simple->new({ year => $year, month => $month, day => 1 });
    return $self->text_calendar(
        {
            start_index => $date->day_of_week,
            month_name  => $date->get_month_name,
            days        => $date->days_in_month_year($month, $year),
            day_names   => $date->days,
            year        => $year
        });
}
sub as_string {
lib/Calendar/Julian.pm view on Meta::CPAN
=item L<Calendar::Gregorian>
=item L<Calendar::Persian>
=item L<Calendar::Saka>
=back
=head1 BUGS
Please report any bugs / feature requests to C<bug-calendar-julian at rt.cpan.org>
or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Calendar-Julian>.
I will be notified, and then you'll automatically be notified of progress on your
bug as I make changes.
=head1 SUPPORT
You can find documentation for this module with the perldoc command.
    perldoc Calendar::Julian
t/fake-julian.xml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg height="297mm" viewBox="0 0 210 297" width="210mm" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<g id="calendar" label="Calendar">
		<text fill="blue" id="month" style="font-size: 18.1908" x="22.2412" y="154.4400">JanuaryX</text>
		<text fill="blue" id="year" style="text-align: end; text-anchor: end; font-size: 18.1908" x="201.6000" y="154.4400">2018</text>
		<rect height="118.24" id="bounding_box" style="fill:none; stroke: blue; stroke-width: 0.5;" width="179.2" x="22.4" y="160.3800" />
		<g fill="none" id="row0_col0" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="9.0954" id="box_row0_col0" width="22.7294" x="24.0265" y="161.8959" />
			<text adjust="spacing" font-size="8.1859" id="text_row0_col0" length="18.1835" stroke="red" text-anchor="middle" x="35.3912" y="169.1722">Sun</text>
		</g>
		<g fill="none" id="row0_col1" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="9.0954" id="box_row0_col1" width="22.7294" x="49.5971" y="161.8959" />
			<text adjust="spacing" font-size="8.1859" id="text_row0_col1" length="18.1835" stroke="red" text-anchor="middle" x="60.9618" y="169.1722">Mon</text>
t/julian.xml view on Meta::CPAN
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg height="297mm" viewBox="0 0 210 297" width="210mm" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
	<g id="calendar" label="Calendar">
		<text fill="blue" id="month" style="font-size: 18.1908" x="22.2412" y="154.4400">January</text>
		<text fill="blue" id="year" style="text-align: end; text-anchor: end; font-size: 18.1908" x="201.6000" y="154.4400">2018</text>
		<rect height="118.24" id="bounding_box" style="fill:none; stroke: blue; stroke-width: 0.5;" width="179.2" x="22.4" y="160.3800" />
		<g fill="none" id="row0_col0" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="9.0954" id="box_row0_col0" width="22.7294" x="24.0265" y="161.8959" />
			<text adjust="spacing" font-size="8.1859" id="text_row0_col0" length="18.1835" stroke="red" text-anchor="middle" x="35.3912" y="169.1722">Sun</text>
		</g>
		<g fill="none" id="row0_col1" stroke="blue" stroke-width="0.5" text-anchor="middle">
			<rect height="9.0954" id="box_row0_col1" width="22.7294" x="49.5971" y="161.8959" />
			<text adjust="spacing" font-size="8.1859" id="text_row0_col1" length="18.1835" stroke="red" text-anchor="middle" x="60.9618" y="169.1722">Mon</text>
( run in 0.592 second using v1.01-cache-2.11-cpan-5dc5da66d9d )