in reply to When I use "can"
Hmmm... This doesn't create any errors:Module -> import (args...) if Module -> can ("import");
whereas this does generate an error:$perl -e 'Foo->import' $
This implies to me that you can call the import method without having to worry whether it exists or not. perlfunc states with use:$ perl -e 'Foo->bar' Can't locate object method "bar" via package "Foo" (perhaps you forgot + to load "Foo"?) at -e line 1. $
If no "import" method can be found then the call is skipped.That can construed as to only applying to use, so maybe the wording of the documentation should be changed.
Liz
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: When I use "can"
by ysth (Canon) on Apr 08, 2004 at 10:20 UTC |