On 3 May 2000, Chip Turner wrote:
> "Jeffrey W. Baker" <[EMAIL PROTECTED]> writes:
>
> > Apache::print() dereferences its arguments. For example, this code:
> >
> > my $foo = "bar";
> > $r->print(\$foo);
> >
> > prints "bar" instead of the expected SCALAR(0xDEADBEEF). Can anyone
> > explain the purpose of this behavior, or is it a misfeature? In my case,
> > this is not the desired behavior.
>
> If I recall correctly, this is a performance issue. If you have a
> large string you want to print, sending a reference will result in
> less data copying etc. I don't know how much it pays off, but it is
> an intended effect.
>
> You could try something like:
>
> $r->print("@{[\$foo]}");
Or I could just do $r->print(scalar(\$foo));, but that's not my point. My
point is Ewwwwwwwwwwwwwwwwwww. I just don't like the overloaded
interface. Does $r->print() take scalars, or references? If it takes
scalars, it shouldn't be dereferencing them. If there is a performance
need for passing references around instead of copying strings, that should
be a different method, perhaps print_ref(). It just seems more clean to
me. Is my mindset too C?
-jwb