> Hi Kenneth, > > I think the error is clear on what is going wrong: *Error: Can't call > method "findnodes" on unblessed reference at <file_name> line <line_number>. > * > * > * > When you colleague calls: $xPath->findnodes('//job'); > > Perl tels him that $xPath is not an blessed reference. In human speak it > means he at some point said $xPath = new XML::XPath->new(filename =><filename> > ); and this call failed... or he might have assigned a value to $xPath > destroying XPath the object that it was holding before. > > Now lets assume your colleague isn't that silly that he would reassign > $xPath my guess is that the file cannot be read, does not exist or maybe is > locked. I suspect that your colleague is not wrong the code didn't change > but the environment did and now the Perl script does not have rights to read > the file. > > Hope that helps, > > Rob > > ps, you might want to besides the rules to always use strict and warnings > also implement a rule that before opening of a file one always checks if it > exists, and can be opened for the purposes you need it for (read only will > not do if you want to write to it) also enforce a simple check to see if the > new module::xyz call actually did what was expected from it. >
Hi Rob; Thank you so much for your quick response. Should he be using the XML::XPath in OO form and instead of direct assignment? There's no file I/O here; perhaps there was an error at the findObjects call? Here is a minimized version of the script which illustrates the problem. 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);