http://qs321.pair.com?node_id=10904

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

How do I change a script that checks refering URLs from within to a seperate file with the require function?

Current script:

@referers = 'http://www.mydomain.com','http://www.another.com'); # Check Referring URL &check_url; sub check_url { local($check_referer) = 0; if ($ENV{'HTTP_REFERER'}) { foreach $referer (@referers) { if ($ENV{'HTTP_REFERER'} =~ /$referer/i) { $check_referer = 1; last; } } } else { $check_referer = 1; } if ($check_referer != 1) { &error('bad_referer') } }

Originally posted as a Categorized Question.