简体   繁体   中英

perl $filename vs. ./$filename in SUSE Linux Enterprise

Student intern working on school's Linux system, back with another question. For background, please read this question: ( How to test an HTTP header value using LWP::UserAgent ).

I have made more progress on this after working on some other projects. One thing that I just happened to notice is that if I make the given script executable (using chmod) I no longer get the download error I mentioned in my first question. The strange thing (to me) is that if I run the file as perl $filename I get the vague, unhelpful download error, whereas if I run it as ./$filename it works fine.

Does anyone know why that is? Feel free to ask for more clarification, but hopefully reading my other question will help with that. Thanks!

EDIT: My apologies! The issue is still unsolved in my mind (I will look into the potential path issue), though I have a workaround via ./script.pl. Here is the exact error message that is returned on attempting to get the file:

500 Can't connect to $url.org:443 (SSL connect attempt failed with unknown error error:00000000:lib(0):func(0):reason(0))

Using perl foo will run foo with the first perl that is found in $PATH .

Using ./foo will run foo with whatever the first line of the script says it should run with (eg #!/opt/perlbrew/perls/perl-5.16.2/bin/perl -w ).

Working with different versions (and versions of modules) can give different results, as can running with different command line switches

There's not a lot of information to go on ;-) but, considering this question in the context of your previous posting on ( How to test an HTTP header value using LWP::UserAgent ), it at least seems possible that you are loading different versions of LWP's SSL library ( Crypt::SSLeay ). This can happen becasue many things depend on the path and/or command line switches you are using. For example, the Crypt::SSLeay contains a C code library that needs to be recompiled for the current version of the module and of perl. Perhaps you are loading the correct version (accidentally) by running ./script.pl and a broken version when you blithely type perl script.pl ?

If you find out what's going on please update your question :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM