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: Beginner:
chmod +x

 



midmofarmer
Novice

Jun 6, 2011, 12:45 PM

Post #1 of 14 (2233 views)
chmod +x Can't Post

running windows xp sp3

jus started studying some perl today, downloaded "ActivePerl-5.12.3.1204-MSWin32-x86-294330" and installed it to c: couldn't find a /usr/bin directory, mistake?

downloaded curl the other day and it's .exe file is all over the place c:\ c:\perl c:\windows\system32 and in documents and settings, mistake?

trying to get ttytter to function, downloaded it to the c:\perl folder as a .pl

under the run cmd command prompt and in the perl dirrectory c:\perl> i can get a response from curl and ttytter but it says that curl is not found

the ttytter instructions say to make ttytter executable with chmod +x command, ive tried every variation that i've read about and always get that its a nonregnized command

and on the perl instructions it said to activate the gci i beleave it was but couldn't ever find the folder for the change, mistake?

please help ty


miller
User

Jun 6, 2011, 1:38 PM

Post #2 of 14 (2232 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

It doesn't directly relate to your issues, but I would advise anyone to use Strawberry perl over ActivePerl on windows.

I've just found fewer issues and the ease of using CPAN makes it the obvious choice for me.

Maybe it would help you with this issue, but at the very least I believe it will help you in the future.

- Miller


(This post was edited by miller on Jun 6, 2011, 1:39 PM)


midmofarmer
Novice

Jun 6, 2011, 2:22 PM

Post #3 of 14 (2228 views)
Re: [miller] chmod +x [In reply to] Can't Post

do i need to totally remove active perl first? and how?


midmofarmer
Novice

Jun 7, 2011, 3:32 AM

Post #4 of 14 (2218 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

ok i've removed activeperl 5.12.3.1204

installed activeperl 5.8.9.829 with the same results, so i uninstalled it

now i got strawberry perl 5.10.1.5 with the same results

the perl -v and other commands have worked on all 3 versions, but with any variation of chmod returns a "is not recognized as an internal or external command, operable program or batch file"

ive been running all my commands from the run cmd command line, mistake?

i can get ttytter to start but says it can't find curl, curl operates in the same directory, will ttytter not be able to access other exe files until it's an exe itself?

where do i find the chmod command file?

shurely this has to be a simple goof, please help


BillKSmith
Veteran

Jun 7, 2011, 4:51 AM

Post #5 of 14 (2216 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

It may help to use the command window. In my system, it starts from

Run->All Programs->Accessories->Command Prompt.
Good Luck,
Bill


midmofarmer
Novice

Jun 7, 2011, 6:36 AM

Post #6 of 14 (2210 views)
Re: [BillKSmith] chmod +x [In reply to] Can't Post

still no luck same error, is there another simple commmand approach without using chmod?


mino
Novice

Jun 7, 2011, 6:56 AM

Post #7 of 14 (2205 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

chmod is a UNIX/Linux command which does not exist and is not needed on Windows.

Neither does /usr/bin exist on Windows, don't worry about it.

I think what you need to do is to add the directory where you keep your curl to the PATH variable:
right-click on "My Computer", select Properties > Advanced > Environment Variables, and edit the PATH variable,
that is, add ";c:\perl" to the end (if that's where you keep curl).

Hope this gets you going. Smile


rovf
Veteran

Jun 7, 2011, 9:19 AM

Post #8 of 14 (2202 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

Windoze has a different approach to running programs than Unix/Linux.

First, the #! line is ignored.

Second, it has no x-attribute.

If you want to run a Perl program, you have two possibilities:

(1) Explicitly invoke perl.exe, i.e.


Code
perl curl.pl


(this is the way I personally prefer).

(2) Create a Windows-association between files of a certain extension (for example, files ending in .pl) and a certain application (for example, perl.exe). This means, however, that all your files ending in .pl are regarded by the system as executable Perl programs. Whether or not this is what you want, is something you have to decide by yourself.


midmofarmer
Novice

Jun 7, 2011, 10:22 AM

Post #9 of 14 (2198 views)
Re: [rovf] chmod +x [In reply to] Can't Post

thanks for the replies :)

mino - i added perl variable in the system variables as ;c:\perl and then c:\perl with no luck, when i goto the command prompt at c:\strawberry> it will run perl -v and others just fine, and i can run curl in the same directory, i have to run ttytter as ttytter.pl all in the same strawberry directory, but it still says it can't find curl, i got curl.exe files everywhere

from the ttytter website http://www.floodgap.com/software/ttytter/ it says

To install TTYtter, download it to the location you want to run it from (such as your home directory or bin/), make it executable with chmod +x, and then start it from your shell prompt with something like ./ttytter. If your Perl is not in /usr/bin, change the first line (/usr/bin/env on some systems does not support passing arguments in shebang lines, so for maximum compatibility it is not used here).

but i guess it's mostly nonsence for windows?

can't seem to find any direct support for ttytter and i've been googleing for the last 2 days

this is the ttytter perl ttytter 1.1.11 (Perl script text; 147KiB)

this is the curl references in the script:

# figure out what our user agent should be
if ($lynx) {
if (length($lynx) > 1 && -x "/$lynx") {
$wend = $lynx;
print $stdout "Lynx forced to $wend\n";
} else {
$wend = &wherecheck("trying to find Lynx", "lynx",
"specify -curl to use curl instead, or just let TTYtter autodetect stuff.\n");
}
} else {
if (length($curl) > 1 && -x "/$curl") {
$wend = $curl;
print $stdout "cURL forced to $wend\n";
} else {
$wend = (($curl) ? &wherecheck("trying to find cURL", "curl",
"specify -lynx to use Lynx instead, or just let TTYtter autodetect stuff.\n")
: &wherecheck("trying to find cURL", "curl"));
if (!$curl && !length($wend)) {
$wend = &wherecheck("failed. trying to find Lynx",
"lynx",
"you must have either Lynx or cURL installed to use TTYtter.\n")
if (!length($wend));
$lynx = 1;
} else {
$curl = 1;
}
}


ohhhhh this is so frustrating to have to learn so much code and syntax to perform a little task, miss my qbasic lol


FishMonger
Veteran / Moderator

Jun 7, 2011, 11:37 AM

Post #10 of 14 (2193 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

That script was not written to be platform independent, it was written for the *nix platform, not Windows.

Take another look on their download page to see if you can find a Windows version.


mino
Novice

Jun 7, 2011, 1:06 PM

Post #11 of 14 (2188 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post

Had a quick look at the code, offending part seems to be


Code
sub wherecheck { 
my ($prompt, $filename, $fatal) = (@_);
my (@paths) = split(/\:/, $ENV{'PATH'});
my $setv = '';

push(@paths, '/usr/bin'); # the usual place
...


This is clearly set up for *nix. The @paths variable holds the locations where
the program looks for curl, but it won't be right for the Windows environment.

It should be possible to hack the code a bit to make at least the part about
finding curl working. I don't have access to a Windows box until tomorrow,
can have a look then.

However, I would not be at all surprised if other problems will occur, even
if this one is fixed. Can't be all that hard to find a Twitter client meant for
Windows, can it?


rovf
Veteran

Jun 8, 2011, 12:03 AM

Post #12 of 14 (2180 views)
Re: [midmofarmer] chmod +x [In reply to] Can't Post


Quote
i added perl variable in the system variables


What do you mean by "perl variable"?


Quote
...make it executable with chmod +x, and then start it from your shell prompt with something like ./ttytter. If your Perl is not in /usr/bin, change the first line...


Forget these instructions. They don't apply to your system.

Did you try what I recommended?


mino
Novice

Jun 8, 2011, 12:21 AM

Post #13 of 14 (2180 views)
Re: [mino] chmod +x [In reply to] Can't Post

I got the program to start running with the following changes to ttytter.pl:

at line 662


Code
: &wherecheck("trying to find cURL", "curl"));


change to


Code
: &wherecheck("trying to find cURL", "curl.exe"));


at line 4645


Code
my (@paths) = split(/\:/, $ENV{'PATH'});


change to


Code
my (@paths) = split(/;/, $ENV{'PATH'});


Make sure you have your curl.exe in a location included in the
PATH variable. I downloaded the "Win 32 - Generic" version
from http://curl.haxx.se/download.html and put it at C:\curl-7.21.6.

Lastly, you have to create a new environment variable in Windows,
called HOME. The location this points to is where the OAuth keyfile
(.ttytterkey) will be stored, see line 817 of the code. I just created
the directory C:\ttytterkey, but you can put it any where you want.

Hope this works for you too.

EDIT:
I just realized that Vim, my texteditor, reads the HOME variable if its
present, and expects to find its startup files there. Other programs may
do the same.

I think if the variable is not set, "C:\Documents and Settings\my_login_name"
is considered the home directory (by Vim at least), so it might be best to
set the environment variable to that.


(This post was edited by mino on Jun 8, 2011, 5:29 AM)


midmofarmer
Novice

Jun 9, 2011, 7:48 AM

Post #14 of 14 (2171 views)
Re: [mino] chmod +x [In reply to] Can't Post

i'll be away from my computer for the next couple days but will try this as soon as i can ty ty

 
 


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

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