{"action":"created","issue":{"url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime/issues/6","repository_url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime","labels_url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime/issues/6/comments","events_url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime/issues/6/events","html_url":"https://github.com/houseabsolute/DateTime-Format-Strptime/issues/6","id":188995387,"number":6,"title":"Allow specifying a custom class for the object returned from parsing","user":{"login":"autarch","id":50729,"avatar_url":"https://avatars.githubusercontent.com/u/50729?v=3","gravatar_id":"","url":"https://api.github.com/users/autarch","html_url":"https://github.com/autarch","followers_url":"https://api.github.com/users/autarch/followers","following_url":"https://api.github.com/users/autarch/following{/other_user}","gists_url":"https://api.github.com/users/autarch/gists{/gist_id}","starred_url":"https://api.github.com/users/autarch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autarch/subscriptions","organizations_url":"https://api.github.com/users/autarch/orgs","repos_url":"https://api.github.com/users/autarch/repos","events_url":"https://api.github.com/users/autarch/events{/privacy}","received_events_url":"https://api.github.com/users/autarch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-11-13T21:12:59Z","updated_at":"2016-11-13T21:12:59Z","closed_at":null,"body":"Migrated from [rt.cpan.org #77130](https://rt.cpan.org/Ticket/Display.html?id=77130) (status was 'open')\n\nRequestors:\n* Joakim.Tormoen@evry.com\n\nAttachments:\n* [Strptime.pm](https://rt.cpan.org/Ticket/Attachment/1076746/566555/Strptime.pm)\n* [100-Extended-DateTime.t](https://rt.cpan.org/Ticket/Attachment/1076746/566556/100-Extended-DateTime.t)\n\n\nFrom joakim.tormoen@evry.com on 2012-05-11 11:45:23:\n\nHello Sir,\n\nFirst let me start by saying thank you for creating and maintaining the DateTime package.\n\nIn one of my projects i have extended the DateTime::Duration package, so i needed the DateTime package to return a object of this class instead.\n\nSo i looked into the DateTime and discovered the possibility to set the constant duration_class. This enables DateTime to return a custom duration object.\n\nSo i extended DateTime and changed the constant. But then the problem with DateTime::Format::Strptime occures, i also rely on this package.\nThis means that it also now needs to return a object of my custom extended DateTime class.\n\nSo i applied logic based on the same principles that is in the DateTime core class around returning a custom Duration object to the DateTime::Format::Strptime package.\nI choose the same solution principles in order to be consistent through the hole package namespace.\n\nI thought that most likely some other people have also had this desire, and that it could be that others want to do the same as me.\nSo i therefor humbly ask you to take a look at my small diff, and to consider if that is something you could include in the package.\n\nAttached is a small and very simple test file, and the modified Strptime.pm\n\n(A full diff is below)\n\nIf you think this is a useful feature but want it implemented in another way, please contact me with your comments, and i will see what i can do.\n\nBest regards\nJoakim\n\n\n[root@localhost Format]# diff Strptime.pm /tmp/DateTime-Format-Strptime-1.5000/lib/DateTime/Format/Strptime.pm\n22,23d21\n< use constant core_datetime_class => 'DateTime';\n<\n389c387\n<         $epoch_dt = $self->core_datetime_class->from_epoch(\n---\n>         $epoch_dt = DateTime->from_epoch(\n513c511\n<             $self->core_datetime_class->from_day_of_year(\n---\n>             DateTime->from_day_of_year(\n559c557\n<             $self->core_datetime_class->new(\n---\n>             DateTime->new(\n665c663\n<         $self->core_datetime_class->new(\n---\n>         DateTime->new(\n1020,1021c1018,1019\n<     $regex      =~ s|%{(\\w+)}|($self->core_datetime_class->can($1)) ? \"(.+)\" : \".+\"|eg;\n<     $field_list =~ s|(%{(\\w+)})|($self->core_datetime_class->can($2)) ? \"#$2#\" : $1 |eg;\n---\n>     $regex      =~ s|%{(\\w+)}|(DateTime->can($1)) ? \"(.+)\" : \".+\"|eg;\n>     $field_list =~ s|(%{(\\w+)})|(DateTime->can($2)) ? \"#$2#\" : $1 |eg;\n\n"},"comment":{"url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime/issues/comments/260213281","html_url":"https://github.com/houseabsolute/DateTime-Format-Strptime/issues/6#issuecomment-260213281","issue_url":"https://api.github.com/repos/houseabsolute/DateTime-Format-Strptime/issues/6","id":260213281,"user":{"login":"autarch","id":50729,"avatar_url":"https://avatars.githubusercontent.com/u/50729?v=3","gravatar_id":"","url":"https://api.github.com/users/autarch","html_url":"https://github.com/autarch","followers_url":"https://api.github.com/users/autarch/followers","following_url":"https://api.github.com/users/autarch/following{/other_user}","gists_url":"https://api.github.com/users/autarch/gists{/gist_id}","starred_url":"https://api.github.com/users/autarch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/autarch/subscriptions","organizations_url":"https://api.github.com/users/autarch/orgs","repos_url":"https://api.github.com/users/autarch/repos","events_url":"https://api.github.com/users/autarch/events{/privacy}","received_events_url":"https://api.github.com/users/autarch/received_events","type":"User","site_admin":false},"created_at":"2016-11-13T21:12:59Z","updated_at":"2016-11-13T21:12:59Z","body":"From drolsky@cpan.org (@autarch) on 2014-11-15 17:03:16:\n\nOn Fri May 11 07:45:23 2012, Joakim.Tormoen@evry.com wrote:\n> So i applied logic based on the same principles that is in the\n> DateTime core class around returning a custom Duration object to the\n> DateTime::Format::Strptime package.\n> I choose the same solution principles in order to be consistent\n> through the hole package namespace.\n\nSorry for the slow response. I think allowing this makes sense. If you are still interested in working on this, I'd greatly prefer a pull request against https://github.com/autarch/DateTime-Format-Strptime, or at the very least a full (including the new tests) in a separate file attachment. Pasting a diff into the body of a ticket makes very hard to pull it back out.\n\nHowever, this needs to be implemented as an optional parameter that gets passed to the constructor, not as a constant. Also, let's just name it \"datetime_class\". Then you don't need to subclass Strptime too.\n\n\nCheers,\n\n-dave\n"}}
{"actor":{"display_login":"autarch"}}