Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problems running perl without .pl extention

Reply
Thread Tools

Problems running perl without .pl extention

 
 
Kapil Khosla
Guest
Posts: n/a
 
      06-19-2004
Hi,
I have a small perl code
####
use strict;
print $#ARGV;
####

When I do perl 1.pl, it runs fine and gives the output 0.

But when I do 1.pl, it gives me the output -1.

I did the following already.

assoc .pl=Perl
ftype Perl=perl.exe "%1" %*
set PATHEXT=.pl;%PATHEXT%

This should have done the trick but it doesnt seem to work for me.
Anyone has any suggestions? I am testing this on Windows Server 2003.
Thanks a lot,
Kapil
 
Reply With Quote
 
 
 
 
ChrisO
Guest
Posts: n/a
 
      06-20-2004
Kapil Khosla wrote:
> Hi,
> I have a small perl code
> ####
> use strict;
> print $#ARGV;
> ####
>
> When I do perl 1.pl, it runs fine and gives the output 0.
>
> But when I do 1.pl, it gives me the output -1.
>
> I did the following already.
>
> assoc .pl=Perl
> ftype Perl=perl.exe "%1" %*
> set PATHEXT=.pl;%PATHEXT%
>
> This should have done the trick but it doesnt seem to work for me.
> Anyone has any suggestions? I am testing this on Windows Server 2003.


Your FTYPE command needs the full path to the command your are "F
typing"... Like:

c:\> ftype Perl=c:\perl\bin\perl.exe "%1" %*

That should do it, I would think.

-ceo
 
Reply With Quote
 
 
 
 
ChrisO
Guest
Posts: n/a
 
      06-20-2004
Purl Gurl wrote:

> Research, read and learn about setting environment
> variables for Win32 platforms, and learn about this
> distinction between a GUI association and command
> line parameters.


Translated means: "I'm not really sure what the answer to your problem
is, but I'd like to pretend that I do know, so I'll write this
condescending garbage as the 'answer' so I won't feel so stupid."

-ceo
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      06-20-2004
Purl Gurl wrote:

> "perl 1.pl"
>
> That will result in -1 for $#ARGV.
>
> "1.pl"
>
> That will not run a perl script from a command line
> based on your parameters.



C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>perl 1.pl
-1
C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>1.pl
-1
C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>type 1.pl
use strict;
print $#ARGV;

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>

> Your statements enjoy discrepancies.


With ActiveState it does.

>>assoc .pl=Perl
>>ftype Perl=perl.exe "%1" %*
>>set PATHEXT=.pl;%PATHEXT%


After entering those 3, it still works for me:

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>1.pl
-1

$#ARGV gives the highest index, which (normally) is number_of_items
minus one, so there are zero items in @ARGV, hence $#ARGV should report
-1. Why perl 1.pl shows something different, I don't understand.

(BTW, the assoc stuff should be set by ActiveState Perl at install time,
no need to do it manually)

> Research, read and learn about setting environment
> variables for Win32 platforms, and learn about this
> distinction between a GUI association and command
> line parameters.


Bla bla bla.

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>assoc
..purl=Perl
..purl=Perl

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>ftype
Purl=perl.exe "%1" %*
Purl=perl.exe "%1" %*

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>set
PATHEXT=.purl;%PATHEXT%

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>1.purl
-1
C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>type 1.purl
use strict;
print $#ARGV;

Maybe you should spend some time keeping stalkers and hackers using open
proxies from your website . And stop them from abusing you and your
family.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      06-20-2004
ChrisO wrote:

> Your FTYPE command needs the full path to the command your are "F
> typing"... Like:


Not if the command is in the PATH.

> c:\> ftype Perl=c:\perl\bin\perl.exe "%1" %*
>
> That should do it, I would think.


The script was already running ok. Why perl 1.pl gave 0 is the problem .

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
 
Reply With Quote
 
Kapil Khosla
Guest
Posts: n/a
 
      06-20-2004
"perl 1.pl"
>
> That will result in -1 for $#ARGV.


You are right, but
perl 1.pl name1 RESULT = 0
1.pl name1 RESULT = -1

It seems that this is a common issue and is not related to enviroment
variables etc and I solved the problem by the following way.


To fix it I clicked:

Explorer -> Tools -> Folder Options -> File Types
Scrolled down to "PL - PL File"
Clicked "Restore"

It works as expected.
I have no idea why it wasn't working in the first place.
Thanks,
Kapil


Purl Gurl <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Kapil Khosla wrote:
>
> (snipped)
>
> > use strict;
> > print $#ARGV;

>
> > When I do perl 1.pl, it runs fine and gives the output 0.

>
> > But when I do 1.pl, it gives me the output -1.

>
>
> I am highly skeptical.
>
> @ARGV provides only those arguments provided
> to a Perl script. @ARGV does not contain
> command line arguments which invoke your
> perl core and specific perl file.
>
> "perl 1.pl"
>
> That will result in -1 for $#ARGV.
>
> "1.pl"
>
> That will not run a perl script from a command line
> based on your parameters.
>
> Your statements enjoy discrepancies.
>
>
> > assoc .pl=Perl
> > ftype Perl=perl.exe "%1" %*
> > set PATHEXT=.pl;%PATHEXT%

>
> Research, read and learn about setting environment
> variables for Win32 platforms, and learn about this
> distinction between a GUI association and command
> line parameters.
>
>
> Purl Gurl
> --
>
> #!perl
>
> print "Input Arguments: @ARGV";
>
> print "\n";
>
> print "Command Line Arguments: $ENV{CMDLINE}";
>
>
> TEST RESULTS:
> _____________
>
> C:\APACHE\USERS\TEST>perl test.pl
> Input Arguments:
> Command Line Arguments: perl test.pl
>
> C:\APACHE\USERS\TEST>perl test.pl one two three
> Input Arguments: one two three
> Command Line Arguments: perl test.pl one two three

 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      06-20-2004
ChrisO wrote:

> Purl Gurl wrote:
>
>> Research, read and learn about setting environment
>> variables for Win32 platforms, and learn about this
>> distinction between a GUI association and command
>> line parameters.

>
> Translated means: "I'm not really sure what the answer to your problem
> is, but I'd like to pretend that I do know, so I'll write this
> condescending garbage as the 'answer' so I won't feel so stupid."


She's just confused due to all those people trying to hack her server
looking for fat girls . I understood that their main device for
hacking is something called Yahoo! Picture Search. To make tracking a
bit more difficult they use Google too.

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
 
Reply With Quote
 
John Bokma
Guest
Posts: n/a
 
      06-20-2004


Kapil Khosla wrote:

> "perl 1.pl"
>
>>That will result in -1 for $#ARGV.

>
>
> You are right, but
> perl 1.pl name1 RESULT = 0
> 1.pl name1 RESULT = -1
>
> It seems that this is a common issue and is not related to enviroment
> variables etc and I solved the problem by the following way.



C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>type 1.pl
use strict;
print $#ARGV;

C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>1.pl name1
0
C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>perl
1.pl name1
0
C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>

So, I can not reproduce this using Win XP. I am sure it worked with
Windows2000, Win98, etc. So... Is this a 2003 issue?

> To fix it I clicked:
>
> Explorer -> Tools -> Folder Options -> File Types
> Scrolled down to "PL - PL File"
> Clicked "Restore"
>
> It works as expected.
> I have no idea why it wasn't working in the first place.


Me neither .

--
John MexIT: http://johnbokma.com/mexit/
personal page: http://johnbokma.com/
Experienced Perl programmer available: http://castleamber.com/
Happy Customers: http://castleamber.com/testimonials.html
 
Reply With Quote
 
Kapil Khosla
Guest
Posts: n/a
 
      06-20-2004
John Bokma <(E-Mail Removed)> wrote in message news:<40d50aff$0$25362$(E-Mail Removed)> ...

>So, I can not reproduce this using Win XP. I am sure it worked with
>Windows2000, Win98, etc. So... Is this a 2003 issue?


Yes. This looks like a Windows 2003 issue.
Thanks.
Kapil


> Kapil Khosla wrote:
>
> > "perl 1.pl"
> >
> >>That will result in -1 for $#ARGV.

> >
> >
> > You are right, but
> > perl 1.pl name1 RESULT = 0
> > 1.pl name1 RESULT = -1
> >
> > It seems that this is a common issue and is not related to enviroment
> > variables etc and I solved the problem by the following way.

>
>
> C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>type 1.pl
> use strict;
> print $#ARGV;
>
> C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>1.pl name1
> 0
> C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>perl
> 1.pl name1
> 0
> C:\Documents and Settings\John\Mis documentos\Projects\johnbokma>
>
> So, I can not reproduce this using Win XP. I am sure it worked with
> Windows2000, Win98, etc. So... Is this a 2003 issue?
>
> > To fix it I clicked:
> >
> > Explorer -> Tools -> Folder Options -> File Types
> > Scrolled down to "PL - PL File"
> > Clicked "Restore"
> >
> > It works as expected.
> > I have no idea why it wasn't working in the first place.

>
> Me neither .

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change file extention Howard ASP .Net 2 01-05-2006 01:54 PM
Forwarding Extention. Aido Firefox 2 12-17-2005 10:47 AM
A's Yahoo! Mail Nofifier Firefox Extention can not log in ion Firefox 8 06-22-2005 01:53 PM
G/H/Y mail Notifier Extention Cron Firefox 4 01-26-2005 03:42 PM
How do I make .cgi extention work? Carl Ogawa Perl 1 12-28-2003 01:00 PM



Advertisments