[sf-perl] 406 Not Acceptable

Michael C. Toren mct at toren.net
Tue Jul 14 14:20:39 PDT 2009


On Sat, Jul 11, 2009 at 10:19:32PM -0700, Michael Friedman wrote:
> Hey, look at this undocumented feature!

[..]

> Wow, this looks remarkably annoying. I wonder why the author did that?
> It's obviously intentional, as it's been continuously in service from  
> at least version 2.36 to 5.829 (the latest).

It's not only documented, it's remarkably handy.  I can quickly set my
User-Agent to the string "foobot/$VERSION ", which lets me announce not
only the version of my bot, but also the version of LWP it's pulling in.
The documentation from 5.805 (the version that happens to be installed
on the system I'm sending mail from) says:

    $ua->agent( $product_id )

    [...]

	If the $product_id ends with space then the _agent() string is
	appended to it.

and gives the example:

    $ua->agent('Checkbot/0.4 ' . $ua->_agent);
    $ua->agent('Checkbot/0.4 ');    # same as above

-mct


More information about the SanFrancisco-pm mailing list