in reply to Re: New and need help in cgi, perl
in thread New and need help in cgi, perl

Hi Charles, My system have perl 5.001, and somehow when i run your code i get error.
webhome: 19% write.cgi Global symbol "name" requires explicit package name at write.cgi line +10. Global symbol "name" requires explicit package name at write.cgi line +11. No comma allowed after filehandle at write.cgi line 28.
Here are the code i used:
#!/usr/bin/perl -T use strict; # use warnings; # use diagnostics; use CGI qw/:standard center/; opendir DIR, "./Data" or die "Couldn't open directory ./Data: + $!"; my @files; while ( my $name = readdir DIR ) { next if $name !~ /^\d*.html/; push(@files, $name); } closedir DIR or die "Couldn't close directory './Data': $!"; my $next_file = 'testing.html'; open OUT, ">Data/$next_file" or die "Cannot open 'Data/$next_ +file': $!"; print OUT start_html( -title => param('title'), -bgcolor => '#FFFFFF'), center( h1( param('heading') ) ), br, p( param('body') ), end_html; close OUT or die "Cannot close 'Data/$next_file': $!"; push @files, $next_file; print header, start_html( -title => 'File Listing'); print a({ -href => "Data/$_" }, $_ ), br for @files; print end_html; exit;

Replies are listed 'Best First'.
Re: Re: Re: New and need help in cgi, perl
by CharlesClarkson (Curate) on Feb 06, 2002 at 01:13 UTC

    Hi Charles, My system have perl 5.001, and somehow when i run your code i get error.

    My best recommendation would be to upgrade to a more modern perl. I have my domain name on a server that refuses to upgade past 5.003, though, so I understand that may not be possible for you. I am sure they will understand when I move my domain next month.

    Unfortunately, I have never programmed in perl below 5.003, so I can only guess what is happening. You might try posting your question again as a new question. Title it as "Need to run this in perl 5.001" or something. There should be some others who are familiar with that version. You may as well explain in your message why it is not possible to upgrade your perl version. If you can get the version number of CGI.pm installed on your system, people will find that helpful too.

    In an effort to save face, perhaps I can help with the CGI.pm version info. In the CGI version I have this works:

    use CGI 'version'; print version;

    I'm sorry. It never occurred to me to find out which perl version you were using. I was recently admonished by crazyinsomniac for doing something similar.




    HTH more,
    Charles K. Clarkson
    Clarkson Energy Homes, Inc.