in reply to How is this sub returning an object instead of a CODEREF
The difference is quite subtle:
*{"$pkg\::scraper"} = _build_scraper($class);
... and what you thought you saw was (or at least, I thought I saw that, for a moment):
*{"$pkg\::scraper"} = \&_build_scraper($class);
This installs the result of _build_scraper($class); as the sub scraper in your code.
And the result of _build_scraper($class) is what returns objects.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How is this sub returning an object instead of a CODEREF
by windowbreaker (Sexton) on Jul 13, 2012 at 18:06 UTC |