Perl on windows

BobHegwood
, Thu, 24-09-09, 13:18 GMT:
Reply with quote
t00fri wrote:

I bet that many more users have Perl installed (often without knowing) than LUA...

I will certainly not spend my time rewriting my scripts to LUA, given that most of our BIG workscripts for Celestia are written in Perl, too: My galaxy extraction , my binary star extraction, my globulars extraction, Andrews' HIP star extraction, Andrews W UMa binaries add-on, etc.

Altogether this concerns MANY thousand lines of Perl code Wink
Fridger



Just FYI here, I *do* have Cygwin installed on my machine. Are you saying that I can run any of your
Perl scripts under the bash shell?

I may have to experiment a bit, but I'd very much like to give it a go. Wink

Thanks, Brain-Dead



t00fri
Hamburg, Germany, Thu, 24-09-09, 14:35 GMT:
Reply with quote
BobHegwood wrote:
t00fri wrote:

I bet that many more users have Perl installed (often without knowing) than LUA...

I will certainly not spend my time rewriting my scripts to LUA, given that most of our BIG workscripts for Celestia are written in Perl, too: My galaxy extraction , my binary star extraction, my globulars extraction, Andrews' HIP star extraction, Andrews W UMa binaries add-on, etc.

Altogether this concerns MANY thousand lines of Perl code Wink
Fridger



Just FYI here, I *do* have Cygwin installed on my machine. Are you saying that I can run any of your
Perl scripts under the bash shell?

I may have to experiment a bit, but I'd very much like to give it a go. Wink

Thanks, Brain-Dead



Hey Bob,

yes of course you can run Perl there and hence also my CMOD script. That's actually a GOOD further reason for installing CYGWIN. First, you must make sure that you have Perl installed, but it's almost for sure. Just type 'perl -v' at the CYGWIN console prompt and see what happens. If you get a Perl header output, you are in. Otherwise just install Perl via a call to setup.exe from a CYGWIN archive.

Then you got to copy the two needed text files (my Perl script phobos_cmod.pl and the phobos shape model data m1phobos.tab) into your CYGWIN home directory. Suppose your CYGWIN username is bob, then this is presumably at C:\cygwin\home\bob. You best use WE to copy the needed files there from their download location.

The model data file m1phobos.tab you get with a click from here:
http://www.psi.edu/pds/asteroid/EAR_A_5_DDR_SHAPE_MODELS_V2_1/data/m1phobos.tab

Then open your CYGWIN console, type ls (list command) at the prompt and look for these two file names in that directory. If found, just type at the prompt:

> perl phobos_cmod.pl < m1phobos.tab

After just 2 seconds, say you should have your desired result in form of the generated ascii CMOD, named phobos_ascii.cmod. You should see it in the same directory, after typing ls once more.

You could probably try out this file directly in Celestia or better -- with Chris' cmodfix-- convert it to a binary CMOD and have the normals calculated etc:

> cmodfix --normals --smooth 90 --weld --binary phobos_ascii.cmod phobos.cmod

You can download cmodfix for Windows from here
http://www.shatters.net/~claurel/celestia/cmodtools/

The binary output CMOD, phobos.cmod you may directly copy to your celestia/models directory and use it. But first save your original phobos.cmod file!

Good luck,
Fridger



BobHegwood
, Thu, 24-09-09, 15:58 GMT:
Reply with quote
t00fri wrote:

Hey Bob,

yes of course you can run Perl there and hence also my CMOD script. That's actually a GOOD further reason for installing CYGWIN. First, you must make sure that you have Perl installed, but it's almost for sure. Just type 'perl -v' at the CYGWIN console prompt and see what happens. If you get a Perl header output, you are in. Otherwise just install Perl via a call to setup.exe from a CYGWIN archive.
Fridger



Well, I get a "command not found" error when I type 'perl -v' at the Bash shell command prompt, so I'll have to
figure out how to install perl next.

Will let you know what happens after I try to install perl. Wink

Thanks for your continued patience with me, Brain-Dead



t00fri
Hamburg, Germany, Thu, 24-09-09, 16:04 GMT:
Reply with quote
yes. you first start the CYGWIN installer (setup.exe), select an archive close to you from the list, hit several times enter until the archive contents are displayed. Try to display the alphabetically sorted listing ('Full' on the top right label) . Then under P you select perl, and hit enter. Additionally needed programs will be automatically added. If the download works, try exactly the same exercise again (perl -v).

Fridger


_________________


BobHegwood
, Thu, 24-09-09, 16:55 GMT:
Reply with quote
t00fri wrote:
yes. you first start the CYGWIN installer (setup.exe), select an archive close to you from the list, hit several times enter until the archive contents are displayed. Try to display the alphabetically sorted listing ('Full' on the top right label) . Then under P you select perl, and hit enter. Additionally needed programs will be automatically added. If the download works, try exactly the same exercise again (perl -v).

Fridger



Okay,

I now have perl installed an working correctly, as well as all of the other interesting materials and
web sites containing FAQ's, help and documentation.

Good deal for a Brain-Dead old Geezer like myself. Wink
This is fun...

Now, I can try the scripts you were talking about.
Again, many thanks for your patience here.

I *know* I'm not the sharpest tool in the shed. Rolling Eyes



t00fri
Hamburg, Germany, Thu, 24-09-09, 17:10 GMT:
Reply with quote
Bob,

that is encouraging, given that you didn't grow up with using command line tools...

Let me know how it goes.

Fridger

PS:
========

What is most elegant with Perl is the installation of additional Perl modules (like e.g libm, quaternions, zlib, etc). You download the respective Perl module from here:

http://www.cpan.org/modules/index.html

(note there is also an installation instruction)

Go to the CPAN Search field and enter e.g. quaternion

Download the package Math-Quaternion-0.03.tar.gz (link on top left)

Copy that file from your download place to your CYGWIN home directory with WE (C:\cygwin\home\bob). Then after opening the CYGWIN console, unpack via:

> tar -xzvf Math-Quaternion-0.03.tar.gz

In case tar is not yet installed in your CYGWIN do the same procedure again like before and download the 'tar' package. No big deal...

Enter into the archive dir:
> cd Math-Quaternion-0.03

Generate the Makefile:
> perl Makefile.PL

Build!
> make

Test!
> make test

Install!
> make install

That's it. And from now on you can run my fancy galaxy Perl script that rotates every one of my 10036 galaxies by means of quaternions into the correct perspective...

In a Perl script the quaternion module will be included with the simple statement at the beginning:

use Math::Quaternion;

Cheers,
Fridger



BobHegwood
, Thu, 24-09-09, 20:56 GMT:
Reply with quote
t00fri wrote:
Bob,

that is encouraging, given that you didn't grow up with using command line tools...

Let me know how it goes.

Fridger



I believe that I have it all now Good Doctor.
Got the quaternions package and installed okay and I have played with your script a bit.
I almost know what I'm doing now, but this procedure is not for the faint of heart...

Kept running into "file not found" errors when I didn't know where the expected file(s) were to be
kept. Finally got around these errors by experimenting and finding out where they should go. Wink

Thanks for all the help...
Good stuff here.



t00fri
Hamburg, Germany, Thu, 24-09-09, 21:30 GMT:
Reply with quote
That all sounds very encouraging, Bob.

If one day you like to generate your own globular clusters via Perl (i.e. globulars.dsc from the Celestia distribution!) let me know. I'll send you the package with the original scientific catalogs. Since there are only 150 globulars in our galaxy, that package is not too big.

You are now becoming autonomous Wink

I suppose your 'file not found' problems arose simply from the fact that within CYGWIN you have to use the UNIX/Linux maner of writing directory trees, while outside of CYGWIN, Windows convention prevails for directories, of course.

So within CYGWIN your home directory would be (assuming your username is bob and cygwin is installed on the drive C:

/home/bob

while from outside CYGWIN the same directory would read

c:\cygwin\home\bob

Note the different forward and backward slashes! Within the CYGWIN Linux hierarchy the highest cygwin directory is just called

/

while any other is a subdirectory thereof, e.g.

/home/bob

If you want to address a Windows directory outside the CYGWIN dir hierarchy from INSIDE CYGWIN, you got to use instead of c: the naming /cygdrive/c which again denotes drive C: as a subdirectory of /.

Fridger



fenerit
Tuscany, Sat, 26-09-09, 10:06 GMT:
Reply with quote
Thanks Fridger for helping in these matters. Just two questions:

1) Being ready to install Perl on my machine, I found two distribution: ActivePerl and CYGWIN. Which is "best" to install? (noob question)

2) I read your .pl script and seem to me that is simple to fit it with other models (the FIRST script you posted, nor the new elaborated one) by changing just "Phobos" word with that of other model. I'm wrong?


_________________
Never at rest.


BobHegwood
, Sat, 26-09-09, 13:29 GMT:
Reply with quote
fenerit wrote:
Thanks Fridger for helping in these matters. Just two questions:

1) Being ready to install Perl on my machine, I found two distribution: ActivePerl and CYGWIN. Which is "best" to install? (noob question)

2) I read your .pl script and seem to me that is simple to fit it with other models (the FIRST script you posted, nor the new elaborated one) by changing just "Phobos" word with that of other model. I'm wrong?



Pardon my interruption here, but I actually had to install ActivePerl since *my* Cygwin installation did not come
with *any* perl. I don't know why, but it could just have been because I didn't know what I was doing obviously.

At any rate, the ActivePerl does work on my Vista system. Wink

Just FYI...

Thanks, Brain-Dead



t00fri
Hamburg, Germany, Sat, 26-09-09, 14:25 GMT:
Reply with quote
Bob,

you might have misunderstood the CYGWIN philosophy. CYGWIN is always used by Windows users and that in order to have some good features from Linux/UNIX also available in Windows. Examples are ssh networking, intelligent teminal/shell setups, a gcc compiler etc.

That is also the background for the fact that in dedicated Linux installations you will ALWAYS get Perl, always get a gcc compiler, always get a graphical desktop etc.

Since apparently many Windows users don't even know what Perl is, the CYGWIN team has decided to only offer a relatively SMALL default download pack, but of course with their clever setup scheme, additional more specialized downloads are really easy. In the same sense in your default installation, there is also no gcc C/C++ compiler + library environment included. But of course, it's all there just a click away from you.

Since I use CYGWIN since ~ 10 years in Windows, I meanwhile have a whole proven set of optimized configuration files that make life even much easier. If our community had more interest in serious CYGWIN, I would have long offered my configuration files and the recommended further downloads. The default console in CYGWIN looks horrible, the fonts are horrible etc.

Fridger


Last edited by t00fri on Sat, 26-09-09, 14:32 GMT; edited 1 time in total


t00fri
Hamburg, Germany, Sat, 26-09-09, 14:31 GMT:
Reply with quote
fenerit wrote:
Thanks Fridger for helping in these matters. Just two questions:

1) Being ready to install Perl on my machine, I found two distribution: ActivePerl and CYGWIN. Which is "best" to install? (noob question)

2) I read your .pl script and seem to me that is simple to fit it with other models (the FIRST script you posted, nor the new elaborated one) by changing just "Phobos" word with that of other model. I'm wrong?



(1)CYGWIN provides a much wider, most useful environment. Every native Windows application also runs within CYGWIN. So applications can be easily mixed according to gusto. You could also run the Active Perl within CYGWIN, for example. But this requires some basic knowledge about ENVIRONMENT variables and configuration files. See my reply to Bob above this post.

I would always recommend to use Perl from within CYGWIN. It's also much smaller than the Windows version. You can easily delete it again if you don't like it. Just try it out with one click.

(2) Surely it will take only very small modification to apply my script to converting other shape model data to CMOD, like what you most probably are interested in. Typically, the mesh for the data values might differ from the 2 degrees in case of Phobos. That's why it altogether seemed hard for me to understand your original arguments against a (compact) installation of Perl on your system! Wink

Fridger



 


Top of this page | Home | © The Celestial Matters Group
Powered by phpBB