septemberlogic
Technical User
Hi,
I've had some past experience in C++ and Java but I'm pretty new to Perl. I was trying to use the Date::Calc module, after briefly looking through the Calc.pod page on CPAN, I realized that I didn't even know how to create a new Date object. In Java, it would be something like:
Date DateName = new Date(year, month, day);
But in Date::Calc, I was not able to find a "new()" method. After playing around for a while, I realized I can declare a new date simply with the following line (correct me if I'm wrong):
$DateName = ($year, $month, $day);
This puzzled me more than it delighted me. I mean, how can you declare an object by equating it to an array? Further more, how does Perl know that I'm trying to create a Date object?
I guess I just don't get OOP in Perl yet. It would be nice if someone can explain it to me. Much thanks in advance!
I've had some past experience in C++ and Java but I'm pretty new to Perl. I was trying to use the Date::Calc module, after briefly looking through the Calc.pod page on CPAN, I realized that I didn't even know how to create a new Date object. In Java, it would be something like:
Date DateName = new Date(year, month, day);
But in Date::Calc, I was not able to find a "new()" method. After playing around for a while, I realized I can declare a new date simply with the following line (correct me if I'm wrong):
$DateName = ($year, $month, $day);
This puzzled me more than it delighted me. I mean, how can you declare an object by equating it to an array? Further more, how does Perl know that I'm trying to create a Date object?
I guess I just don't get OOP in Perl yet. It would be nice if someone can explain it to me. Much thanks in advance!