-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fromtcpdump.t fails because Net::DNS::Packet doesn't provide TO_JSON #32
Comments
sigh fromtcpdump was a script I needed a couple of times back when I was doing a lot of latency analysis, I'm not sure we even need to keep it. I think this is a change in behavior from Net::DNS::Packet, because I definitely used this a bunch like 2-3 years ago. I'm cool with just skipping fromtcpdump work for now (disabling the test). If you want to fix it (would would, of course, be awesome), I'd say we should do the local monkey patch, or just post process the objects ourselves, though that can be a little crazy... |
Net::DNS::Packet doesn't serialize properly yet. JSON::XS is configured to allow blessed objects and convert them if a TO_JSON method is available. If TO_JSON is not available, however, the object is replaced by a JSON null. Net::DNS::Packet doesn't have a TO_JSON method. Monkey-patching one in will require futzing with a number of other classes contained with Net::DNS::Packet objects too. See GH benbernard#32.
Hmm. Digging into the history of Net-DNS and RecordStream, I'm not sure how the test ever worked. The internal structures of Net::DNS::Packet don't match those in the expected JSON, i.e. the objects appear carefully massaged either by hand or by code that's vanished entirely. Regardless, I've just gone and marked the test todo skip. Pull request ahoy! |
JSON::XS is configured to allow blessed objects and convert them if a TO_JSON method is available. If TO_JSON is not available, however, the object is replaced by a JSON null.
I'm not sure if I should just adjust the test or if I should monkey patch TO_JSON methods into Net::DNS::Packet and related packages so that they JSON-ify as expected by RecordStream.
For example, RecordStream could do this:
although ideally it would be localized to avoid side-effects in other code:
Full test output below:
The text was updated successfully, but these errors were encountered: