Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Upgrade to CGI.pm 3.01 results in problems with CGI::Util

by jerrygarciuh (Curate)
on Feb 05, 2004 at 18:05 UTC ( #326825=perlquestion: print w/ replies, xml ) Need Help??
jerrygarciuh has asked for the wisdom of the Perl Monks concerning the following question:

Honored monks
The following script quick and dirty though it may be was working for months until the CGI.pm module(s) got upgraded. It now throws this error

"ebcdic2ascii" is not exported by the CGI::Util module
"ascii2ebcdic" is not exported by the CGI::Util module
Can't continue after import errors at pressUpload.pl line 8
BEGIN failed--compilation aborted at pressUpload.pl line 8.

I added an explicit import line in a blind attempt to get this back up and running (see use CGI::Util line in script below). but this did not change the error which is being thrown by the line use CGI; or use CGI qw/:all /;. Which one I use has made no difference. If, for fun, I comment out use CGI; then the same error is thrown by the use CGI::Util line. I have Googled the error and found this but haven't been able to figure out what is happening.

Any help will be greatly appreciated.

TIA
jg
#!/usr/local/bin/perl -w use strict; use CGI::Carp qw/fatalsToBrowser /; use lib ('/home/xxxxx/public_html/mods'); use CGI qw/:all /; # this line added to try to deal with error use CGI::Util qw(rearrange make_attributes unescape escape expires ebc +dic2ascii ascii2ebcdic); my $q = CGI->new(); use CGI::Upload; my $upload = CGI::Upload->new; use DBI; my $user_pass = $q->param('pass'); my $name = $q->param('name'); my $corrected_filename = $name; $corrected_filename =~ s/ /_/g; $corrected_filename =~ s/[^a-zA-Z0-9_-]//g; my $file_extension = $upload->file_type('temp_filename'); $corrected_filename .= ".$file_extension"; my $target_directory = "/home/ehrhardt/public_html/releases/"; if ($user_pass eq 'xxxxx') { file_up(); } else { print $q->header, start_html, h2('Bad Password=', $user_pass); exit; } sub file_up { local $| = 1; my ($bytesread,$buffer,$file); my $fh = $upload->file_handle('temp_filename'); open(OUTF, '>' . $target_directory . $corrected_filename); while ($bytesread = read($fh, $buffer, 1024)) { print(OUTF $buffer); } close(OUTF); if (!$file && $q->cgi_error) { print($q->header(-status=>$q->cgi_error)); exit 0; } update_db(); my $redir = "http://www.xxxxx.com/admin/done.htm"; print $q->redirect("$redir"); } sub update_db { my $dbh = DBI->connect("DBI:mysql:PressReleases:localhost","xxxx", +"xxxxx",{'RaiseError' => 1}); my $sth = $dbh->prepare("INSERT INTO Releases (Row, Name, FileURL, + Description, Uploaded, Archived) VALUES (?, ?, ?, ?, ?, ?)"); my $fileURL = "http://65.57.xxx.x/~xxxx/xxxxx/$corrected_filename" +; my $description = $q->param('description'); $description =~ s/\'/\\\'/g; $sth->execute('', $name, $fileURL, $description, undef, ''); }
_____________________________________________________
"The man who grasps principles can successfully select his own methods.
The man who tries methods, ignoring principles, is sure to have trouble.
~ Ralph Waldo Emerson

Comment on Upgrade to CGI.pm 3.01 results in problems with CGI::Util
Select or Download Code
Re: Upgrade to CGI.pm 3.01 results in problems with CGI::Util
by jdtoronto (Prior) on Feb 05, 2004 at 18:21 UTC
    Well, their are a few questions.
    • Why do you need to export those functions I don't see where you are using them in your code?
    • CGI.pm and this CGI::Util are now at v3.04 maybe you should upgrade again.
    • There is always a risk when trying to use private functions, but in this case I dont see anything drastic in store from a look at the source - and all the functions are listed in the EXPORT_OK list, so at least on 3.04 they should be exportable.
    • What version of CGI.pm were you using when this DID work okay?
    jdtoronto

    UPDATE: Mystery solved, if you read the CGI.pm docs file there must have been a problem introduced in 3.01, because for 3.02 it says:

    File upload on EBCDIC systems now works.
    Sorry, but I gotta say it, RTFM.
      As it turns out upgrading to 3.04 did not change the error.
      The problem lay in the fact that we had an older copy of CGI::Util in our lib so RTFM wouldn't have solved this.
      TA
      jg
      _____________________________________________________
      "The man who grasps principles can successfully select his own methods.
      The man who tries methods, ignoring principles, is sure to have trouble.
      ~ Ralph Waldo Emerson
        But how did you upgrade to 3.04? I thought CGI.pm only came in a distro so you got all the componets updated?

        Reason: jdtoronto delete please, dupe of 326874

        For more information on this node visit: this

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://326825]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2014-09-16 08:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (157 votes), past polls