Time:Piece

Hi

I am trying to find out difference between two dates with Time:Piece. I am able to get the days difference, but I want the Days as wells as hours, mins and sec difference. Below is my code for both, but the later is now working. Can anyone help me out.

With only days

 
use Time::Piece;
use Time::Seconds;
$before = Time::Piece->strptime("2001/01/01", "%Y/%m/%d");
$now = localtime;
$diff = $now - $before;
print int($diff->days), " days since $before\n";

I am changing the days with hms, but it is giving me the error. Please some check this and let me know where I am doing the mistake.

error:

 
Can't call method "hms" on an undefined value at timediff line 7.

Note that I dont have Date::Calc installed in my production systems.