You don't specify exactly what "special" is. That makes it difficult to come up with a solution to the return value.
You also don't give an example of the subroutine in question. Does it accept parameters? If so, what type?
You could demand that a user send in nothing to get a string return, and if the user sends in a reference to something, you could generate data within the reference for something "special".
That, or require a hash as arguments: $o->method(want => 'special');, whereby if no args are present, you return a string.
More information is necessary that describes what you're doing in behind the scenes, why you want to return different types of information and an example of what you have now.
In reply to Re: OO design: returning string and/or special value
by stevieb
in thread OO design: returning string and/or special value
by wanna_code_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |