CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Need help with glob

 



adiezsoto
New User

Jul 4, 2005, 11:27 PM

Post #1 of 2 (502 views)
Need help with glob Can't Post

Hi all,

Having problems with glob function. We are involved in a migration of an application from perl 5.005_03 to perl 5.6.1. This is an old and critic app code, so we don't want to modify it. In the application, we are reading from a database a string, containing an environment variable (e.g. $PATH), we store the value read into a perl structure and then we use glob to expand the environment variable ( I know that this is not the right use of glob) $a_variable = glob $structure->value;

$command ="value $a_variable";

When executing this in perl 5.005_03 we have in the $command the environment variable expanded. If we execute in perl 5.6.1 we have the string $PATH in $command="value $PATH".

We can solve this in the right way using reg exp to substitute the $PATH. But we don't want to change the code. The problem seem to be related to the change in glob implementation from perl 5.6.0, now perl is not calling to glob function from the unix operating system, it's calling a new implementation of glob from perl's core.

Do you know any way of maintain backwards compatibility ??? any way of still calling to glob from Unix without changing the code ???

Thanks in advance


davorg
Thaumaturge / Moderator

Jul 5, 2005, 8:41 AM

Post #2 of 2 (496 views)
Re: [adiezsoto] Need help with glob [In reply to] Can't Post

Sounds like you've been relying on a bug in "glob" that got fixed :)

The correct way to access environment variables is by using the %ENV hash. For example, the enviroment variable $PATH is in $ENV{PATH}.

--
Dave Cross, Perl Hacker, Trainer and Writer
http://www.dave.org.uk/
Get more help at Perl Monks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives