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

Hello Monks,
I was trying to use this example code to create a thumbnail using Image::Magik but getting this error. Any ideas.
Thanks Tim

Global symbol "$outdir" requires explicit package name at make_thumbnail.cgi lin e 17.

#!/usr/bin/perl -w use strict; use diagnostics; use Image::Magick; use Getopt::Long; use File::Basename; my $out_dir = 'thumbs'; my $geometry= '120x120'; my $img = "ezwindow.gif"; GetOptions( 'geometry=s' => \$geometry, 'directory=s' => \$out_dir, ); mkdir $out_dir,0777 or die"Cannot make $outdir:$!" unless -d $out_dir; foreach my $img (@ARGV) { my $rc; my $im = Image::Magik->new(); $rc = $im->Read($img); warn($rc), next if $rc; my $basename = basename $img; $basename =~ s/\.\w+$//; $rc = $im->Write("PNG:$out_dir/$basename.png"); warn($rc) if $rc; }

Replies are listed 'Best First'.
Re: Global symbol "$outdir" requires explicit package name
by fglock (Vicar) on Nov 07, 2002 at 17:36 UTC
     $outdir ne $out_dir
      $duh Thanks
        What is it about this script that makes it a command line script as opposed to executable in a browser. Thanks
Re: Global symbol "$outdir" requires explicit package name
by broquaint (Abbot) on Nov 07, 2002 at 17:38 UTC
    Just between you and me $outdir != $out_dir.
    HTH

    _________
    broquaint

      Actually, that should be'$outdir' ne '$out_dir';-)

      $outdir == $out_dir, since they are both (numerically) zero...