in reply to Elegant way to call a method

The return value of can is a function reference:

if ( my $handler = "some::cool::${module}"->can("method") ) { $handler->( ... some arguments ... ) } else { ... }

Replies are listed 'Best First'.
Re^2: Elegant way to call a method
by siberia-man (Friar) on Dec 23, 2017 at 12:10 UTC
    Thank you. I was in one step behind this solution.