{"issue":{"created_at":"2010-01-25T07:26:38Z","state":"open","updated_at":"2011-12-02T17:50:16Z","comments":4,"user":{"gravatar_id":"e55e0ec3c00f834d78fbdddeaa36e308","id":25888,"url":"https://api.github.com/users/schwern","avatar_url":"https://secure.gravatar.com/avatar/e55e0ec3c00f834d78fbdddeaa36e308?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"schwern"},"body":"[overload.pm](http://search.cpan.org/perldoc?overload) has some functions which would be handy to have on any object.\r\n\r\n* `my $is_overloaded = $thing->is_overloaded()`\r\n\r\nWill return true if the object is overloaded, false otherwise.  Just a thin wrapper around overloaded::Overloaded().\r\n\r\nThis should work on a class or object and go into `lib/perl5i/2/Meta.pm`.\r\n\r\n* `my $code = $thing->is_overloaded($op);`\r\n\r\nReturns the method which implements $op, if its overloaded.  False otherwise.  A thin wrapper around overload::Method()\r\n\r\nThrow in some common terms for special operators.\r\n\r\n    string    => \"\"\r\n    numeric   => 0+\r\n\r\nSo `$thing->is_overloaded(\"string\")` and `$thing->is_overloaded(q[\"\"])` are the same.\r\n\r\nThis should work on a class or object and go into `lib/perl5i/2/Meta.pm`.\r\n\r\n* `my $string = $object->something_something_something_str_val`\r\n\r\nReturn the string value of the thing in the absence of overloading.  A thin wrapper around overload::StrVal().  Don't know what the method should be called, it's kinda difficult to express.  `as_string_no_overload` is descriptive but a bit awkward.\r\n\r\nThis should work on a object and go into `lib/perl5i/2/Meta/Instance.pm`.\r\n\r\n* `my $is_overloaded = $thing->is_string_overloaded`\r\n\r\nReturns the method $thing will respond with when used as a string.  This has to check both string and numeric overloading, because the object will fall back to its numeric overloading if it's not string overloaded.\r\n\r\nThis should work on a class or object and go into `lib/perl5i/2/Meta.pm`.\r\n\r\nYou can take `$has_string_overload` from `lib/perl5i/2/Meta.pm`.\r\n\r\nThe name could use some work to differentiate it from `$thing->is_overloaded(\"string\")`.  Something which expresses it's true purpose, \"will this return an overloaded value when used as a string\" is subtly different from \"does this have a string overload method\".","assignee":null,"number":72,"id":119245,"labels":[{"color":"21f016","name":"easy","url":"https://api.github.com/repos/schwern/perl5i/labels/easy"},{"color":"ededed","name":"meta","url":"https://api.github.com/repos/schwern/perl5i/labels/meta"},{"color":"edd713","name":"wishlist","url":"https://api.github.com/repos/schwern/perl5i/labels/wishlist"},{"color":"11e60e","name":"yes do it","url":"https://api.github.com/repos/schwern/perl5i/labels/yes+do+it"}],"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"title":"Add methods to read overloading","closed_at":null,"html_url":"https://github.com/schwern/perl5i/issues/72","url":"https://api.github.com/repos/schwern/perl5i/issues/72","milestone":null},"action":"created","comment":{"created_at":"2011-12-02T17:50:16Z","updated_at":"2011-12-02T17:50:16Z","user":{"gravatar_id":"e55e0ec3c00f834d78fbdddeaa36e308","id":25888,"url":"https://api.github.com/users/schwern","avatar_url":"https://secure.gravatar.com/avatar/e55e0ec3c00f834d78fbdddeaa36e308?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","login":"schwern"},"body":"A GCI student has claimed this, but I've not heard from them since.  http://www.google-melange.com/gci/task/view/google/gci2011/7139304","id":2993291,"url":"https://api.github.com/repos/schwern/perl5i/issues/comments/2993291"}}