Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Crontab error!

by Ozoz (Initiate)
on Apr 04, 2001 at 14:12 UTC ( [id://69603] : perlquestion . print w/replies, xml ) Need Help??

Ozoz has asked for the wisdom of the Perl Monks concerning the following question:

dear monks, I receive the following error by email after each crontab job: Prototype mismatch: sub main::head ($) vs none at /usr/lib/perl5/ line 198. Any advices for this toddler? Thanks!

Replies are listed 'Best First'.
Re: Crontab error!
by davorg (Chancellor) on Apr 04, 2001 at 14:21 UTC

    Somewhere in your code you have a subroutine called main::head. It is defined as taking one argument (a scalar). Later on, it's being called without any arguments. I could give more details if I could see the code.


    "Perl makes the fun jobs fun
    and the boring jobs bearable" - me

      Here's the script. Thx! :)
      #!/usr/bin/perl # Environment Variables use LWP::Simple; use CGI qw/:standard :netscape :html3/; $sonuc="/home/usr254/html/sa/filmler/HeadLine.tlt"; &toplasa1; exit; sub toplasa1 { $elle1= get(""); # Oncesini sil $elle1=~ s/^.*<!---Insert_Tertiary_Stories--->//s; # Sonrasini sil $elle1=~ s/<!---END Insert_Tertiary_Stories--->.*$//s; # Gereksiz bosluklari kaldir $elle1=~ s/\s\s//g; # Enterlari kaldir $elle1=~ s/\n//g; # Returnleri tanimla $elle1=~ s/<TD WIDTH=13 VALIGN="TOP">/\n/g; $elle1=~ s/<!---spacing between headlines--->/\n\n/g; $elle1=~ s/&#0145;/'/g; $elle1=~ s/&#0146;/'/g; $elle1=~ s/&#0147;/"/g; $elle1=~ s/&#0148;/"/g; # Butun tablari kaldir $elle1=~ s/<[^>]+>//g; # Baaas open(PAGE,">$sonuc") || die("Error $! opening file"); print PAGE $elle1; close(PAGE); }

        Both LWP::Simple and CGI try to export a function called head and they have different prototypes. This can lead to badness - as you've seen.

        However, you don't actually use either of these subroutines, so you just need to stop importing them (or, at least, one of them). Quickest fix is to change the use LWP::Simple line to:

        use LWP::Simple 'get';

        "Perl makes the fun jobs fun
        and the boring jobs bearable" - me

      This is the crontab that runs the scipt above:
      3 1 * * * /home/usr254/cgi-bin/graab/ok-filmler.cgi