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

DocDBHelp: “Can't use a hash as a reference” (Perl 5.34) - easy fix patch included #113

Open
pms967 opened this issue Aug 17, 2023 · 2 comments

Comments

@pms967
Copy link

pms967 commented Aug 17, 2023

More troubles with the help system. With up to date Perl (5.34) and libs, DocDBHelp fails with errors like the following in the apache log:

[cgi:error] AH01215: Can't use a hash as a reference at /var/www/docdb/cgi/DocDBHelp line 66.: /var/www/docdb/cgi/DocDBHelp, referer: SearchForm

The error is caused by (any/each of) these lines:

$DefaultText = %{$HelpXML->{entry}{$helpterm}}->{text};
$DefaultTitle = %{$HelpXML->{entry}{$helpterm}}->{title};

  $ProjectText = %{$ProjectXML->{entry}{$helpterm}}->{text};
  $ProjectTitle = %{$ProjectXML->{entry}{$helpterm}}->{title};
  $Action = %{$ProjectXML->{entry}{$helpterm}}->{action};
@pms967
Copy link
Author

pms967 commented Aug 17, 2023

Here's the patch to fix the problem:

--- ../../DocDB-8.8.9/cgi/DocDBHelp     2018-06-26 20:19:08.000000000 +0200
+++ DocDBHelp   2023-08-17 17:48:23.990017444 +0200
@@ -54,15 +63,15 @@
 
 my $HelpXML = XMLin("DocDBHelp.xml");
 
-$DefaultText = %{$HelpXML->{entry}{$helpterm}}->{text};
-$DefaultTitle = %{$HelpXML->{entry}{$helpterm}}->{title};
+$DefaultText = $HelpXML->{entry}->{$helpterm}->{text};
+$DefaultTitle = $HelpXML->{entry}->{$helpterm}->{title};
 
 if ($ProjectHelp) {
   my $ProjectXML = XMLin("ProjectHelp.xml");
 
-  $ProjectText = %{$ProjectXML->{entry}{$helpterm}}->{text};
-  $ProjectTitle = %{$ProjectXML->{entry}{$helpterm}}->{title};
-  $Action = %{$ProjectXML->{entry}{$helpterm}}->{action};
+  $ProjectText = $ProjectXML->{entry}->{$helpterm}->{text};
+  $ProjectTitle = $ProjectXML->{entry}->{$helpterm}->{title};
+  $Action = $ProjectXML->{entry}->{$helpterm}->{action};
 }
 
 # Remove line breaks and XML element tags

@pms967 pms967 changed the title DocDBHelp: “Can't use a hash as a reference” (Perl 5.34) DocDBHelp: “Can't use a hash as a reference” (Perl 5.34) - easy fix patch included Aug 17, 2023
@pms967
Copy link
Author

pms967 commented Aug 17, 2023

Doh! Only now I notice that an almost identical patch had been already submitted as pull request 0bcb322 by @jpamdeandre

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

No branches or pull requests

1 participant