Dumb newbie question

Cash Perkins cash at flashcom.net
Sun Sep 24 12:32:42 CDT 2000


Hi guys,

I'm trying to write a little script that will automagically pick a gif image from a specificed directory.

So far I've got:

#! /usr/local/bin/perl

  $basedir = "/home/wobblewire/html/avengers_site/images/";

  opendir(DIR, $basedir);
  @files = grep(/\.gif$/,readdir(DIR));
  closedir(DIR);

  srand(time ^ $$);
  $num = rand(@files); # Pick a Random Number

  print "<img src=\"$basedir$files[$num]\">\n";
                                                 

When I run it directly it seems to work ok:

[wobblewire at bizcom cgi-bin]$ perl rnd_image.cgi
<img src="/home/wobblewire/html/avengers_site/images/casttopr.gif">
[wobblewire at bizcom cgi-bin]$ perl rnd_image.cgi
<img src="/home/wobblewire/html/avengers_site/images/eqavenger21.gif"> 

But now I try to embed it into my html doc and it doesn't work at all:

<html>
<body>
<center>
<!-- #exec cgi="/cgi-bin/rnd_image.cgi" -->
</center>
</body>
</html>
      
This prints out Nothing.  Permissions on rnd_image.cgi are wide open.

What am I doing wrong?

Thanks in advance!

Cash Perkins
Perl numbskull.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/san-diego-pm/attachments/20000924/59232d63/attachment.htm


More information about the San-Diego-pm mailing list