{"action":"created","issue":{"url":"https://api.github.com/repos/garu/Data-Printer/issues/91","repository_url":"https://api.github.com/repos/garu/Data-Printer","labels_url":"https://api.github.com/repos/garu/Data-Printer/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/garu/Data-Printer/issues/91/comments","events_url":"https://api.github.com/repos/garu/Data-Printer/issues/91/events","html_url":"https://github.com/garu/Data-Printer/issues/91","id":157354641,"number":91,"title":"Data::Printer should not use $/ as newline","user":{"login":"hakonhagland","id":6708379,"avatar_url":"https://avatars0.githubusercontent.com/u/6708379?v=4","gravatar_id":"","url":"https://api.github.com/users/hakonhagland","html_url":"https://github.com/hakonhagland","followers_url":"https://api.github.com/users/hakonhagland/followers","following_url":"https://api.github.com/users/hakonhagland/following{/other_user}","gists_url":"https://api.github.com/users/hakonhagland/gists{/gist_id}","starred_url":"https://api.github.com/users/hakonhagland/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hakonhagland/subscriptions","organizations_url":"https://api.github.com/users/hakonhagland/orgs","repos_url":"https://api.github.com/users/hakonhagland/repos","events_url":"https://api.github.com/users/hakonhagland/events{/privacy}","received_events_url":"https://api.github.com/users/hakonhagland/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-05-28T19:58:06Z","updated_at":"2018-03-19T13:04:51Z","closed_at":null,"author_association":"NONE","body":"Consider the output from:\n\n```\nmy $var = 2;\np $var;\n```\n\nit should give `2` as output. However if I set the _input_ record separator ( note: not the _output_ record separator), for example:\n\n```\nlocal $/ = \"00\\n\";\n\n# some code ...\n\nmy $var = 2;\np $var;\n```\n\nthe output is suddenly `200` and not `2` as it should. This is because the input record separator is used to add a newline character to the output in `Data::Printer`.\n\nI think this is a bug. To fix it, simply replace `$/` (inside `Data/Printer.pm`) with `\"\\n\"`. According to [perlport](http://perldoc.perl.org/perlport.html#Newlines) : \n\n> Perl uses \\n to represent the \"logical\" newline, where what is logical may depend on the platform in use.\n\nI added a [pull request](https://github.com/garu/Data-Printer/pull/90).\n"},"comment":{"url":"https://api.github.com/repos/garu/Data-Printer/issues/comments/374204269","html_url":"https://github.com/garu/Data-Printer/issues/91#issuecomment-374204269","issue_url":"https://api.github.com/repos/garu/Data-Printer/issues/91","id":374204269,"user":{"login":"garu","id":52187,"avatar_url":"https://avatars1.githubusercontent.com/u/52187?v=4","gravatar_id":"","url":"https://api.github.com/users/garu","html_url":"https://github.com/garu","followers_url":"https://api.github.com/users/garu/followers","following_url":"https://api.github.com/users/garu/following{/other_user}","gists_url":"https://api.github.com/users/garu/gists{/gist_id}","starred_url":"https://api.github.com/users/garu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/garu/subscriptions","organizations_url":"https://api.github.com/users/garu/orgs","repos_url":"https://api.github.com/users/garu/repos","events_url":"https://api.github.com/users/garu/events{/privacy}","received_events_url":"https://api.github.com/users/garu/received_events","type":"User","site_admin":false},"created_at":"2018-03-19T13:04:51Z","updated_at":"2018-03-19T13:04:51Z","author_association":"OWNER","body":"Hi @hakonhagland! Thanks for the report and sorry it took me so long to reply. I think you're right, the input record separator should not be used as a newline separator for Data::Printer. According to [perlvar](https://perldoc.perl.org/perlvar.html#Variables-related-to-filehandles), at the very least it should be `$\\`, the output record separator. But since that's usually `undef`, I think \"\\n\" should be safe enough. I just have to make sure the tests will still work regardless of OS, and hope we don't break anyone's code!\r\n\r\nThanks again!"}}
{"actor":{"display_login":"garu"}}