matija has asked for the wisdom of the Perl Monks concerning the following question:
There is a small hitch, though: I want a function that returns an array of URLs. The synopsis for using URI::Find is this:
Now, I could easily use the callback function to store the URLs in a global array variable. But what if I want them in an array that is local to the function calling URI::Find? Is there any way to pass a reference to a target array to the callback function? Any other ideas I could try?require URI::Find; my $finder = URI::Find->new(\&callback); $how_many_found = $finder->find(\$text);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Avoiding global variables when I need to supply a callback
by gaal (Parson) on Jul 22, 2004 at 11:26 UTC | |
|
Re: Avoiding global variables when I need to supply a callback
by borisz (Canon) on Jul 22, 2004 at 11:42 UTC | |
|
Re: Avoiding global variables when I need to supply a callback
by beable (Friar) on Jul 22, 2004 at 11:39 UTC |