On Wed, May 18, 2011 at 11:25 PM, Rob Dixon <rob.di...@gmx.com> wrote:
> On 18/05/2011 21:37, Kenneth Wolcott wrote: > >> >> A colleague claims that he made no changes, code worked yesterday >> and doesn't today. >> >> He is not using OO Perl. >> > > You say later that he uses XML::XPath. That is an object-oriented module. > > > I have asked him for a small code snippet that reproduces the error >> (I'm sure he is unwilling to show the entire code!). >> >> We have rules requiring the standard use of "use strict" and "use >> warnings" in all our Perl scripts. >> >> We use Perl on Windows, Linux and Solaris (all his scripts are >> supposed to run without modification on Linux and Windows). >> > > Hi Kenneth. > > All of the above may or may not be a proper assessment of your > situation, but it has nothing to do with Perl. My assessment would be > that your manager isn't doing his job, but also that you are bringing a > personal conflict to a Perl list instead of to your manager. He is there > to resolve things like this, and you haven't told him the relevant facts. > > > He claims this: "use strict; use warnings; use XML::XPath;" >> > > Until you have evidence otherwise, your colleague is telling the truth. > > > Trying to get value for: >> $ha = $xPath->findnodes('//job'); >> > > You have shown no code for the derivation of $xPath, or the declaration of > $ha. > > > Error: >> Can't call method "findnodes" on unblessed reference at<file_name> line >> <line_number>. >> > > Why are you hiding <line_number> from us when we have no code? That > also makes sense with the rest of your mail, which shows that whatever > you have dumped is unblessed. > > > Output from Data::Dumper follows: >> >> $VAR1 = { >> 'object' => [ >> { >> 'objectId' => 'job-21461', >> 'job' => { >> 'priority' => 'normal', >> 'status' => 'completed', >> 'outcome' => 'success', >> 'jobName' => >> 'DeleteBuilds-200911060000', >> 'jobId' => >> '21461', >> 'lastModifiedBy' => 'admin', >> } >> }, >> >> { >> >> 'objectId' => 'job-21473', >> 'job' => { >> 'priority' => 'normal', >> 'status' => 'completed', >> 'outcome' => 'success', >> 'jobName' => >> 'DeleteBuilds-200911070000', >> 'jobId' => '21473', >> 'lastModifiedBy' => 'admin', >> } >> }, >> ] >> } >> >> > That looks fine, except that all you have printed is a hash of data. It > isn't blessed and so it isn't an object. > > Please grow up and ask Perl questions. It looks to me as if you are as > silly as each other. I certainly wouldn't employ either of you. > > I also wonder if you 'Kenneth Wolcott' and your friend are the same > person. Since your name sounds English you embarrass me: the vast > majority of Englishmen are far more professional than yourself. > > Rob > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > :-) Guess it is getting late in England as well then :-) Anyway... use strict; use warnings; use Ec; use XML::XPath; use Data::Dumper; my $ec = Ec->new or die "Can not create Ec object $!\n"; my $xPath; $xPath = $ec->findObjects('job'); print Dumper($xPath); #my $ha = $xPath->findnodes('//job'); #print Dumper($ha); This makes no sense at all.... use strict; # Good no complaints use warnings; # Good no complaints use Ec; # What is this a home brew module how is this relevant to the rest of the code? use XML::XPath; # XPath module use Data::Dumper; # My all time favorite module my $ec = Ec->new or die "Can not create Ec object $!\n"; # Creating a new Ec object (what ever it might be) and storing this in $ec my $xPath; # Declaring a variable called $xPath $xPath = $ec->findObjects('job'); # Using the $ec variable to do something and storing the returned value in the $xPath variable print Dumper($xPath); # Dumping the $xPath variable looking at the above it is a neat looking nested data structure #my $ha = $xPath->findnodes('//job'); # Hang on a minute, now the $xPath variable containing that data structure is used as an object and Perl goes Bleh!!! not all that strange is it? #print Dumper($ha);