Greetings,

In the following script (see below) it should be pulling images from the directory:
rand_fp_imgs

The debug info looks good, but when I run the script from the URL below it pulls images
that I have sitting at the root level. 
Does anyone have any idea why this might be?
Thanks,

Dave
(kora musician / audiophile / webmaster @ www.coraconnection.com  / Ft. Worth, TX, USA)

http://www.coraconnection.com/index3.html
<!-- inside index3.html -->
<img src="/cgi-bin/rand_img.cgi/rand_fp_imgs/" alt=" " width="280" height="212">

(the script is on a UNIX server with PERL 5.04)
---


#!/usr/bin/perl
# script: random_pict2.pl  Thank you Lincoln Stein! 

use CGI qw/:standard/;
use CGI::Carp qw(fatalsToBrowser);

$PICTURE_PATH = path_translated();
$PICTURE_URL = path_info();
$PICTURE_URL =~ m#(.+/?)+(/\w+)#;

chdir "/www/coraconnection/$2" or die "Couldn't chdir to pictures directory: $!";

@pictures = <*.{jpg,gif}>;
$lucky_one = $pictures[rand(@pictures)];

die "Failed to pick a picture" unless $lucky_one;
print redirect("$2/$lucky_one");


__END__

print header('text/plain');
print $PICTURE_PATH, "\n"; 
print "Rand Imgs: , ", $lucky_one;

print "\$2: ", $2, "\n"; 



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to