Skip Menu |

This queue is for tickets about the Data-Dump CPAN distribution.

Report information
The Basics
Id: 48681
Status: rejected
Priority: 0/
Queue: Data-Dump

People
Owner: Nobody in particular
Requestors: naiman [...] math.jct.ac.il
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Data::Dump issue, I think
Date: Thu, 13 Aug 2009 16:11:36 +0200
To: Gisle Aas <gisle [...] aas.no>, bug-Data-Dump [...] rt.cpan.org
From: Aaron Naiman <naiman [...] math.jct.ac.il>
Dear Gisle, Hi there. Great modules you have written -- thanx! I have sat on a problem for a number of hours, scratching my head (<OUCH>!) and peeling the code down to something as small as possible. I have the behavior in my normal scripts, but here are the lines for copying into: perl -d -w -e 42 use URI use Data::Dump qw(pp) $url = [ bless(do{\(my $o = "http://google.com")}, "URI::http"), ] $data_string = pp(@{$url}) @copy_of_url = eval($data_string) $copy_of_url = \@copy_of_url p ${$copy_of_url}[0] With this, the output is: URI::http=SCALAR(0x9eb79ac) which is *not* what I wanted. However, if before the definition of $url I have the following line: $dummy = new URI('http://redhat.com') then the output is: http://google.com as expected. *Why* does this $dummy definition make the operator overloading work (and the URI object acts as if it invokes as_string)?? Please note that if the $dummy definition did not have an argument to the constructor, it would *not* have worked! (??) Finally, if I scale back $url to be an object (from the "bless ..." on), and not an array of such, then there is no problem, and the $dummy definition is not needed at all. This is very curious behavior, and I hope I am not wasting your time with my lack of object expertise. Thanx so my for your time! BFN, Aaron -- Aaron ("Aharon") Naiman Jerusalem College of Technology--Machon Lev naiman@math.jct.ac.il http://math.jct.ac.il/~naiman
I think the issue is that you need to load the 'URI::http' module in order to expect 'URI::http' objects to work. Constructing URI objecct using the http scheme will load that module for you. If you don't do that you need to load the module explictly.
Subject: Re: [rt.cpan.org #48681] Data::Dump issue, I think
Date: Fri, 14 Aug 2009 09:13:44 +0200
To: bug-Data-Dump [...] rt.cpan.org
From: Aaron Naiman <naiman [...] math.jct.ac.il>
Dear Gisle, Thank you for your speedy reply. I think the issue is that you need to load the 'URI::http' module in order Show quoted text
> to expect 'URI::http' > objects to work.
In order to make the 'URI::http' objects work correctly *in general*, or for Data::Dump *specifically*? In other words, is this a URI::http issue, or a Data::Dump issue? Show quoted text
> Constructing URI objecct using the http scheme will load that module for > you.
Why is "use URI;" not enough, to, e.g., get the overloading aspects to work? Is this particular to URI::http, or is the the general behavior of "use" for any module? Show quoted text
> If you don't do that you need to load the module explictly.
How is this done, in addition to the "use" command? Thank you very much for your time! BFN, Aaron -- Aaron ("Aharon") Naiman Jerusalem College of Technology--Machon Lev naiman@math.jct.ac.il http://math.jct.ac.il/~naiman
On Fri Aug 14 03:14:05 2009, naiman@math.jct.ac.il wrote: Show quoted text
> Dear Gisle, > > Thank you for your speedy reply. > > I think the issue is that you need to load the 'URI::http' module in order
> > to expect 'URI::http' > > objects to work.
> > > In order to make the 'URI::http' objects work correctly *in general*, or for > Data::Dump *specifically*? In other words, is this a URI::http issue, or a > Data::Dump issue?
Neither IMHO. When you use the URI->new("http://...") constructor it will load the URI::http module for you (on demand) so normally you don't load the module explicitly. If you create objects by just using the low level bless operation (the code that Data::Dump outputs), then you need to make sure yourself to load the code that fills the corresponding namespace. Show quoted text
> > Constructing URI objecct using the http scheme will load that module for > > you.
> > > Why is "use URI;" not enough, to, e.g., get the overloading aspects to > work? Is this particular to URI::http, or is the the general behavior of > "use" for any module?
Because URI's are implemented by separate classes for each scheme and since most of these will never be used URI only load the corresponding scheme support when URIs using the given scheme as constructed. Show quoted text
> > If you don't do that you need to load the module explicitly.
use URI::http;
Subject: Re: [rt.cpan.org #48681] Data::Dump issue, I think
Date: Wed, 19 Aug 2009 17:39:58 +0200
To: bug-Data-Dump [...] rt.cpan.org
From: Aaron Naiman <naiman [...] math.jct.ac.il>
Dear Gisle, Thank you again for taking the time, and your most informative and explanatory response. I now have a better understanding of the module-loading process. ATB, Aaron -- Aaron ("Aharon") Naiman Jerusalem College of Technology--Machon Lev naiman@math.jct.ac.il http://math.jct.ac.il/~naiman