Gossamer Forum
Home : Products : Links 2.0 : Installation -- Unix :

Can't use global $! in "my" at db_utils.pl line 27.

Quote Reply
Can't use global $! in "my" at db_utils.pl line 27.
Hi

I've a error with Links which I cannot find any reference to in the support forums - anyone got any good ideas?

I get this when any .cgi files are called in a browser:

Code:
Error including libraries: Can't use global $! in "my" at /home/redcom/cgi-bin_local/childrenfirst/admin/db_utils.pl line 27.

Make sure they exist, permissions are set properly, and paths are set correctly.


db_utils.pl line 27 is this:

Code:
open (DB, "<$db_file_name") or &cgierr("error in get_records. unable to open db file: $db_file_name.\nReason: $!");



My config file has this:

Code:
# PATH and URL of Admin CGI directory. No Trailing Slash.
$db_script_path = "/home/redcom/cgi-bin_local/childrenfirst/admin";
$db_dir_url = "http://childrenfirst.webarchitects.co.uk/cgi-bin/childrenfirst/admin";

# URL of User CGI directory. No Trailing Slash.
$db_cgi_url = "http://childrenfirst.webarchitects.co.uk/cgi-bin/childrenfirst";

# PATH and URL of Pages to be built. No Trailing Slash.
$build_root_path = "/home/redcom/www/childrenfirst_org_uk/links";
$build_root_url = "http://childrenfirst.webarchitects.co.uk/links";


This is how Apache is set up:

Code:
# childrenfirst
NameVirtualhost 192.168.1.28

<VirtualHost 192.168.1.28>
ServerAdmin root@localhost
DocumentRoot /home/redcom/www/children_first_org_uk
ServerName childrenfirst.webarchitects.co.uk
ErrorLog logs/childrenfirst-error_log
TransferLog logs/childrenfirst-access_log

ScriptAlias /cgi-bin/ /home/redcom/cgi-bin_local/

<Directory /home/redcom/cgi-bin_local>
Options Indexes Includes FollowSymLinks ExecCGI
order allow,deny
allow from all
AllowOverride None
</Directory>

</VirtualHost>

Everything in the admin dir is 777 (Apache runs as nobody) and all the paths seem OK:

Code:
[chris@atomism admin]$ pwd
/home/redcom/cgi-bin_local/childrenfirst/admin
[chris@atomism admin]$ ls -la
total 318
drwxrwxrw- 7 nobody nobody 1024 May 18 15:05 .
drwxr-xr-x 3 nobody nobody 1024 May 18 14:24 ..
drwxrwxrwx 2 nobody nobody 1024 May 18 14:24 HTML
drwxrwxrwx 3 nobody nobody 1024 May 18 14:24 LWP
-rwxrwxrwx 1 nobody nobody 11923 May 18 14:07 Mailer.pm
-rwxrwxrwx 1 nobody nobody 4525 May 18 14:09 Template.pm
-rwxrwxrwx 1 nobody nobody 3217 May 18 14:09 Validator.pm
-rwxrwxrwx 1 nobody nobody 5879 May 18 18:15 admin.cgi
-rwxrwxrwx 1 nobody nobody 71022 May 18 14:07 admin_html.pl
drwxrwxrwx 2 nobody nobody 1024 May 18 14:24 backup
-rwxrwxrwx 1 nobody nobody 3191 Feb 11 00:08 category.def
drwxrwxrwx 4 nobody nobody 1024 May 18 14:24 data
-rwxrwxrwx 1 nobody nobody 38723 Feb 11 00:08 db.pl
-rwxrwxrwx 1 nobody nobody 23352 May 18 16:07 db_utils.pl
-rwxrwxrwx 1 nobody nobody 10470 May 18 15:28 links.cfg
-rwxrwxrwx 1 nobody nobody 4777 Feb 11 02:10 links.def
-rwxrwxrwx 1 nobody nobody 47765 May 18 14:07 nph-build.cgi
-rwxrwxrwx 1 nobody nobody 7488 May 18 14:07 nph-email.cgi
-rwxrwxrwx 1 nobody nobody 9721 May 18 14:10 nph-verify.cgi
-rwxrwxrwx 1 nobody nobody 46559 May 18 14:09 site_html.pl
-rwxrwxrwx 1 nobody nobody 16354 May 18 14:07 site_html_templates.pl
drwxrwxrwx 2 nobody nobody 1024 May 18 14:24 templates

There are not any stray carriage returns (I've done this for all the files and my editor, notetab saves in unix format by default):

Code:
[chris@atomism admin]$ perl -wc admin.cgi
Name "main::db_script_url" used only once: possible typo at admin.cgi line 59.
Name "main::db_script_link_url" used only once: possible typo at admin.cgi line 59.
admin.cgi syntax OK

If I run admin.cgi from the command line I get the same message:

Code:
[chris@atomism admin]$ perl admin.cgi
Content-type: text/plain

Error including libraries: Can't use global $! in "my" at /home/redcom/cgi-bin_local/childrenf
irst/admin/db_utils.pl line 27.

Make sure they exist, permissions are set properly, and paths are set correctly.

If I run db_utils.pl at the command line I get this:

Code:
[chris@atomism admin]$ perl db_utils.pl
Can't modify substitution in postdecrement at db_utils.pl line 3, near "# --"
(Might be a runaway multi-line ## string starting on line 1)
syntax error at db_utils.pl line 19, near "sub get_record "
Can't use global $! in "my" at db_utils.pl line 27.

perl -wc gets roughly the same thing:

Code:
[chris@atomism admin]$ perl -wc db_utils.pl
Can't modify substitution in postdecrement at db_utils.pl line 3, near "# --"
(Might be a runaway multi-line ## string starting on line 1)
syntax error at db_utils.pl line 19, near "sub get_record "
"my" variable $key masks earlier declaration in same scope at db_utils.pl line 25.
"my" variable $found masks earlier declaration in same scope at db_utils.pl line 25.
Can't use global $! in "my" at db_utils.pl line 27.

My Apache logs are set to debug level but there is nothing of use there.

Perl is OK (and I've changed all files to: #!/usr/bin/perl):

Code:
[chris@atomism admin]$ whereis perl
perl: /usr/bin/perl5.00502 /usr/bin/perl /usr/man/man1/perl.1

The server is RedHat 5.9 which has not been hacked about with much.

Anyone come across this before? Have I missed something really simple? I have installed Links a few times before and have never had a problem like this.

Help!!

TIA

Chris























Quote Reply
Re: Can't use global $! in "my" at db_utils.pl line 27. In reply to
Wow, that's the most informative debugging I've ever seen. =)

This is quite telling:

Quote:
Can't modify substitution in postdecrement at db_utils.pl line 3, near "# --"
(Might be a runaway multi-line ## string starting on line 1)
syntax error at db_utils.pl line 19, near "sub get_record "
Can't use global $! in "my" at db_utils.pl line 27.

Have you changed db_utils.pl at all? If not, try uploading a brand new one again, as you shouldn't get an error.

Cheers,

Alex

Quote Reply
Re: Can't use global $! in "my" at db_utils.pl line 27. In reply to
Hi

Yippee :-) sorted!

Thanks Alex you are a star :-)

I did start this morning with a brand new version - god knows what I messed up!

Quote:
Wow, that's the most informative debugging I've ever seen. =)

Thanks :-)

It's from bitter experience!

Chris