perl running question

R

Ross

Dear all,
I find posting here may be more appropriate and so tidy up my inquiries
and feedbacks and ask this question again:

after installing FC3, perl script needs to be run using:

/usr/bin/perl test.pl

when it is in FC1, i can just type test.pl

as both OS's are installed by me and the same conf files are to be used.

In the test.pl,

The first line of the script is:

#!/usr/bin/perl

i've even tried changing it to perl5.8.5 as i know it is in /usr/bin

no matter i add set path = ($path .) or i run the perl directly at
the directory containing it (no amibugous command confirmed by using
"which"), i must use

/usr/bin/perl test.pl

the permission of test.pl is
rwxr-xr-x

as test.pl takes one argument, when typing test.pl, something like "please
provide your filename" should be printed at the prompt but it doesn't.

Some say it would be the fixing of a security problem of FC3, could anybody
suggest any idea?
 
K

Keith Keller

as test.pl takes one argument, when typing test.pl, something like "please
provide your filename" should be printed at the prompt but it doesn't.

What *does* it do? Explaining what you want it to do is not helpful
unless you also explain what it actually does. Posting a *short*,
*complete* script that replicates the problem is also helpful.

--keith
 
D

Damian James

I find posting here may be more appropriate and so tidy up my inquiries
and feedbacks and ask this question again:

after installing FC3, perl script needs to be run using:

/usr/bin/perl test.pl

when it is in FC1, i can just type test.pl

as both OS's are installed by me and the same conf files are to be used.

Did you have "." in your path in the FC1 environment? Friends don't let
friends put "." in their path. If FC1 included this in the default path,
and FC3 removed it, then I would certainly call it a security enhancement.

Have you tried "./test.pl"?

This doesn't have much to do with Perl, of course.

--Damian
 
R

Ross

Damian James said:
Did you have "." in your path in the FC1 environment? Friends don't let
friends put "." in their path. If FC1 included this in the default path,
and FC3 removed it, then I would certainly call it a security enhancement.

? I don't know what you mean.
Have you tried "./test.pl"?

i've tried.
This doesn't have much to do with Perl, of course.

--Damian


#!/usr/bin/perl

$input = $ARGV[0];
if($input =~ /^$/) {
print "usage: addDB2HTML.pl [db name] \n";
exit;
}

open(IN, $input) || die "Could not open $input\n";

while($line = <IN>) {
print "$line\n";
}
 
P

Paul Lalli

Ross said:
Dear all,
I find posting here may be more appropriate

more appropriate than what?
and so tidy up my inquiries
and feedbacks and ask this question again:

You asked this question before? What were the responses you got? How
did they not satisfactorally assist you?
after installing FC3, perl script needs to be run using:

/usr/bin/perl test.pl

when it is in FC1, i can just type test.pl

as both OS's are installed by me and the same conf files are to be used.

In the test.pl,

The first line of the script is:

#!/usr/bin/perl

i've even tried changing it to perl5.8.5 as i know it is in /usr/bin

no matter i add set path = ($path .) or i run the perl directly at
the directory containing it (no amibugous command confirmed by using
"which"), i must use

/usr/bin/perl test.pl

You're saying that if your current directory is
/usr/bin
and you type
perl test.pl
then test.pl doesn't get executed? That sounds much more like an
environment issue than it does a Perl issue to me. Of course, you
haven't told us what actually happens when you type `perl test.pl`, so
there's no real way of knowing.
the permission of test.pl is
rwxr-xr-x

as test.pl takes one argument, when typing test.pl, something like "please
provide your filename" should be printed at the prompt

That phrase should only be printed if your code says to print it. If
you don't have a block very similar to:
if (!@ARGV){
print "Please provide your filename\n";
chomp (my $file = <STDIN>);
# ...
}
then there's no reason to expect your program to print anything of the
sorts.
but it doesn't.

Well what *does* it do? You haven't given us any indication of what
error you receive when attempting to run the perl script directly.
Some say it would be the fixing of a security problem of FC3, could anybody
suggest any idea?

Off hand, I would also suggest confirming that your shebang really is
what you think it is. If, for example, your code has windows-style
newlines, then the shebang might actually be telling your OS to try to
run the program "/usr/bin/perl\r" rather than "/usr/bin/perl". Try
running dos2unix on the file? It can't hurt...

Paul Lalli
 
R

Ross

You asked this question before? What were the responses you got? How
did they not satisfactorally assist you?

keep answering the same thing such as try ./test.pl even i stated clearly i
have tried. no blaming but appreciation for their help. still, need to solve
my problem

You're saying that if your current directory is
/usr/bin
and you type
perl test.pl
then test.pl doesn't get executed?

no. i run the script test.pl in its own containing directory. when i input
perl test.pl, everything is normal and
usage: test.pl [db name]

is printed out
That sounds much more like an environment issue than it does a Perl issue
to me.
Well, then how should i tell the OS to execute test.pl without typing perl?
What and where environment variable i should set? i'm doing this to let
users (Or those who've indulged in Windows) without computer background life
easier
Off hand, I would also suggest confirming that your shebang really is
what you think it is. If, for example, your code has windows-style
newlines, then the shebang might actually be telling your OS to try to
run the program "/usr/bin/perl\r" rather than "/usr/bin/perl".

Try running dos2unix on the file? It can't hurt...
I've tried....
 
J

John Bokma

Ross said:
no. i run the script test.pl in its own containing directory. when i
input perl test.pl, everything is normal and
usage: test.pl [db name]

is printed out

What exactly do you get if you enter:

test.pl

at the prompt?

(note that test is a bad choice for a program name :) ).
 
R

Ross

John Bokma said:
Ross said:
no. i run the script test.pl in its own containing directory. when i
input perl test.pl, everything is normal and
usage: test.pl [db name]

is printed out

What exactly do you get if you enter:

test.pl

at the prompt?

the output is as follows:

admin/var/www/html/test> test.pl
admin/var/www/html/test>

Furthermore, indeed test is just for my convenience to ask questions only
(i've used "which" to confirm), thx
 
J

Jon

Ross said:
John Bokma said:
Ross said:
no. i run the script test.pl in its own containing directory. when i
input perl test.pl, everything is normal and
usage: test.pl [db name]

is printed out

What exactly do you get if you enter:

test.pl

at the prompt?

the output is as follows:

admin/var/www/html/test> test.pl
admin/var/www/html/test>

Furthermore, indeed test is just for my convenience to ask questions only
(i've used "which" to confirm), thx

Can you provide the output of 'echo $PATH' and 'which test.pl'?
 
R

Ross

Can you provide the output of 'echo $PATH' and 'which test.pl'?

admin/home/admin> echo $PATH
/usr/bin:/bin<snip for my security reason, here contains all the paths where
my scripts reside, the strange thing is, some have :.:, but some just
:>.:/usr/X11R6/bin

admin/home/admin> which test.pl
< for my security reason, path residing test.pl>/test.pl
 
T

Tad McClellan

[ Please provide an attribution when you quote somebody ]

admin/home/admin> echo $PATH
/usr/bin:/bin<snip for my security reason, here contains all the paths where
my scripts reside, the strange thing is, some have :.:, but some just
:>.:/usr/X11R6/bin
^
^
^

There is a closing angle bracket (>) character in your $PATH?

That's strange...

admin/home/admin> which test.pl
< for my security reason, path residing test.pl>/test.pl


Due to your security reasons, we are unlikely to be able to help.

Since you don't know what the problem is, you may have snipped
the part that indicates what the problem is.

The devil is in the details with computer stuff, but you are the
only one with access to those details...


You may need to hire someone that you can get to sign an NDA,
so you can then provide the details to someone.
 
J

John Bokma

Ross said:
John Bokma said:
Ross said:
no. i run the script test.pl in its own containing directory. when i
input perl test.pl, everything is normal and
usage: test.pl [db name]

is printed out

What exactly do you get if you enter:

test.pl

at the prompt?

the output is as follows:

admin/var/www/html/test> test.pl
admin/var/www/html/test>

Try test2.pl:

#!/usr/bin/perl

use strict;
use warnings;

pwasas;

what is the output?

Try test3.pl

#!/usr/bin/foo

bar;

what is the output?
 
R

Ross

no. i run the script test.pl in its own containing directory. when i
input perl test.pl, everything is normal and
usage: test.pl [db name]

is printed out

What exactly do you get if you enter:

test.pl

at the prompt?

the output is as follows:

admin/var/www/html/test> test.pl
admin/var/www/html/test>

Try test2.pl:

#!/usr/bin/perl

use strict;
use warnings;

pwasas;

what is the output?

again, it exits and "seems" to do nothing
Try test3.pl

#!/usr/bin/foo

bar;

what is the output?

command not found. wow! does it mean it does do something but just don't
print anything out?!
 
R

Ross

Can you provide the output of 'echo $PATH' and 'which test.pl'?
^
^
^

There is a closing angle bracket (>) character in your $PATH?

no, just to close as i open one after bin
Due to your security reasons, we are unlikely to be able to help.
thx anyway :)
 
T

Tad McClellan

[ Please please provide an attribution when you quote someone! ]


Ross said:
command not found. wow! does it mean it does do something but just don't
print anything out?!


"command not found" means the command was not found, it cannot
"do something" if it cannot execute, and it cannot execute if
the command to run cannot be found by the shell.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top