in reply to Time:Piece help

Post the actual code that produces the error. As it is & as already noted, your code (currently) does not produce the error of "Can't call method "hms" on an undefined value".

hms is a method of Time::Piece to get the time parts as string.

Look up Time::Seconds API to get seconds, hours, minutes from difference (object) as noted in Time::Piece.

Replies are listed 'Best First'.
Re^2: Time:Piece help
by Anonymous Monk on Apr 24, 2014 at 16:15 UTC

    (On a side note, Time::Piece API is bad for it returns T::P object when adding a plain number; returns Time::Seconds object when adding two T::P objects.)

      On a side note, Time::Piece API is bad for it returns T::P object when adding a plain number; returns Time::Seconds object when adding two T::P objects.

      Adding a number to a T::P object and getting back a T::P object makes sense (the 'number' is assumed to be seconds). What do you expect? The last part of your statement is wrong...you cannot add two T::P objects...that would make no sense, and it is rightfully an error to do so. You can subtract two T::P objects and get back a T::S object, as that makes sense. So what is bad about the API?