Skip to content
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

DateTime crashed Devel::ptkdb #24

Open
autarch opened this issue Nov 12, 2016 · 7 comments
Open

DateTime crashed Devel::ptkdb #24

autarch opened this issue Nov 12, 2016 · 7 comments

Comments

@autarch
Copy link
Member

autarch commented Nov 12, 2016

Migrated from rt.cpan.org #116924 (status was 'new')

Requestors:

From [email protected] on 2016-08-12 20:17:05:

DateTime doesn't seem to work nicely with Devel::ptkdb.

Firstly if I monitor a DateTime object it reports a stringified version of the object.

Secondly if a DateTime object is part of a bigger structure - adding the structure to the expression to be monitored simply crashes the GUI.

This is how I reproduced the error.

$ cat t.pl use DateTime;

my $dt = DateTime->new(
year => 1964,
month => 10,
day => 16,
hour => 16,
minute => 12,
second => 47,
);

%arr = (k => $dt);

print %arr;

If I step up to line 14 then $dt shows 1964-10-16T16:12:47 and if I try to see %arr then the GUI crashes with the following error.

A DateTime object can only be compared to another DateTime object (DateTime=HASH(0x3066188), HASH(0x2a1c9c8)). at /cigdev64/borec/ExtData/2.0/opt/perl/lib/perl5/Devel/ptkdb.pm line 2658.

I can run the same script with perl -d and DataDumper correctly shows the complete hash structure of the object both in $dt and %arr without crashing.

I am using DateTime 1.34 Devel:,:ptkdb 1.1091 on perl 5.22.2

  • Mithun

CONFIDENTIALITY AND SECURITY NOTICE

The contents of this message and any attachments may be confidential and proprietary. If you are not an intended recipient, please inform the sender of the transmission error and delete this message immediately without reading, distributing or copying the contents.

@matthewpersico
Copy link

There are two ways to solve this:

  1. Overload == to call DateTime->compare()
  2. Fix Devel::Ptkdb to not require == overloading.

I am working on the latter. But I don't know why the former is not implemented. @autarch , PR's accepted?

@autarch
Copy link
Member Author

autarch commented Feb 22, 2017

DateTime implements <=> with fallback enabled, so == overloading should just work. Is Devel::Ptkdb doing something weird?

I'm not keen on adding things to DateTime just to support a tool which hasn't been updated in 13 years.

@matthewpersico
Copy link

matthewpersico commented Feb 22, 2017 via email

@autarch
Copy link
Member Author

autarch commented Feb 22, 2017

Just to confirm that this does work ...

$ perl -MDateTime -E 'my $now = DateTime->now; say $now == $now ? 1 : 0; say $now == DateTime->today ? 1: 0'
1
0

So whatever ptkdb is doing, it's something that somehow breaks the overloading fallback or ignores it. Maybe it checks directly if the object implements a specific overloading?

@matthewpersico
Copy link

matthewpersico commented Feb 22, 2017 via email

@preaction
Copy link
Contributor

So... It sounds like this is an issue with ptkdb, there's nothing to be done to DateTime, and we can close this?

@matthewpersico
Copy link

matthewpersico commented Feb 25, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants