in reply to Aliasing Module->method

> Time::Piece module doesn't export strptime.

because it has an object oriented interface. IOW it's a class not a simple procedural module.

(update: see Perl_module#Object-oriented_example )

> Can I alias some "x" to Time::Piece->strptime?

Aliasing a method can only be done by another method ..

(I don't get the point?!)

but you are free to do

sub x { Time::Piece->strptime(@_) }

be aware that the returned value is still an object.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!

Replies are listed 'Best First'.
Re^2: Aliasing Module->method
by gerases (Sexton) on Feb 06, 2016 at 23:17 UTC
    Yeah, I wanted to alias the method call to a symbol within my program so I didn't have to type that much. So if the original is Time::Piece->strptime ... I wanted it to become: x->strptime. But on second thought, I of course could have created an object for Time::Piece and called strptime on the object. Didn't occur to me at the time I was writing it. I thought strptime was a CLASS method. All is good, thank you for making me think!