Tk installation with CPAN - windows

I want to write GUI in perl by using the Tk module. Therefore, I want to install Tk module.
I opened a command window, and typed "cpan Tk". After a few minutes the run was over and then I got the following message on the command window:
""windres' is not recognized as an internal or external command, operable program or batch file. dmake.exe: Error code 129, while making 'tkres.o' dmake.exe: Error code 255, while making 'pTk\libpTk.a' SREZIC/Tk-804.032.tar.gz C:\Perl64\site\bin\dmake.exe -- NOT OK"
Apparently, the installation didn't go well. I also tried to execute a perl script that contains the line "use Tk" and I got the following message:
""Can't locate Tk.pm in #INC (you may need to install the Tk module)
(#INC contain s: C:/Perl64/site/lib C:/Perl64/lib .) at file.pl line 1. BEGIN failed--compilation aborted at file.pl line 1."
Can you help me install Tk properly?

After installing CPAN module with command perl -MCPAN -e "shell",
add path c:\Perl\site\lib\auto\MinGW\bin to system PATH and restart window with CPAN console.
Then commands 'make Tk', 'test Tk' and 'install Tk' in CPAN console should work.

Have you tried running the "Perl Package Manager"? It's located in your Perl directory under "bin/wperl.exe."
Copy the location of the file and type this in the cmd window.
'Location of wperl.exe' -x '"Location of ppm.bat"'
Example :
C:\Perl\bin\wperl.exe -x "C:\Perl\bin\ppm.bat"
ppm.bat should be in the same folder.
An easier way to launch that would be from your start menu in the "All Programs" section under your Perl Directory. There should be a "Perl Package Manager" there.
It's basically a GUI that allows you to locate every module on the CPAN website. From there you can find Tk (which I don't know, but I assume it's http://search.cpan.org/dist/Tk-804.030/).

Related

Perl not running in Windows 10

I've just downloaded ActivePerl for Windows 10 on my 64 bit laptop, but when I go to the command prompt, perl -v fails unless the directory is C:\Perl64\bin in which case it tells me that I have Perl 5.20.2 Copyright Larry Ullman etc, but if I try and open perl files anywhere, nothing happens, if I run perl.exe it just shows me a command window with a flashing bar and nothing happens, and when I try and run .pl programs in Eclipse it tells me predictably that because perl-v failed it won't run.
What can I do to get .pl files running?
You must create a file association between the .pl file extension and the Perl runtime.
At a command prompt type the following.
assoc .pl=PerlScript
ftype PerlScript=c:\perl\bin\perl.exe %1 %*
Choose perl.exe or wperl.exe, depending on your need to get a visible command window.
To get perl to be recognized, you must add C:\Perl64\bin to the PATH environment variable. Go to Control Panel > System > Advanced System Settings > Environment Variables. Edit the line containing PATH in the top box marked User variables for , and add ;C:\Perl64\bin (note the semicolon) to the end. Be sure not to corrupt anything that's already there.
installing perl in windows 7

Can I open the ruby app from Rubymine terminal

I just got Rubymine and getting used to ruby on rails on mac. I'm wondering if there is any command to open a ruby app on Rubymine 7, from terminal.
Would there be a command like this?
$ Rubymine /Path/to/RubyApp
RubyMine has a special menu item for that. In ver. 8, 'Tools' > 'Create command-line launcher ...' Previous versions should keep the item somewhere around.
Once you've created command-line launcher (Tools > Create Command-Line Launcher), you can use the command mine via the command line..
e.g. If you have navigated to a folder via the command line, that you then want to open with Rubymine, you can run mine .
The standard way to do it on bash/OSX from the JetBrains site:
$<RubyMine> <path1> --line<number> <path2>
That's the launcher, the path to the project, the line you want the file to open to and the path to the file in order. An example would be: /Applications/RubyMine.app/Contents/MacOS/rubymine ~/RubyMineProjects/untitled45 --line 1 ~/RubyMineProjects/untitled45/sample.sass These can be pretty long commands, but you can create a symlink to shorten the launcher at least.
Keep in mind that launching from the command line launches with the ruby version you have set there as well as any other command line configs. If you want to keep configurations from the editor you should open the project the conventional way.
it's enough to append the following line into your ~/.bashrc or ~/.zshrc
alias rubymine="open -a rubymine"
reference Use Typora from Shell or Cmd
For RubyMine 2017.1.5, just type Alt + F12 for local terminal
Just go to folder where Rubymine is download.Then go to Rubymine bin folder. And run command from console. In my case
kashif#kashif-HP-ProBook-4520s:~/Downloads/RubyMine-2017.1.6/bin$ ./rubymine.sh
Previous answers didn't help me (using RubyMine 2020.1)
Instructions for Mac (different OSs also described on rubymine docs):
Create a script:
You can create a shell script with this command in a directory from your PATH environment variable. For example, create the file /usr/local/bin/rubymine with the following contents:
#!/bin/sh
open -na "RubyMine.app" --args "$#"
Tada! Assuming that script is executable (in case not - run chmod +x /usr/local/bin/rubymine) Now you are able to navigate to proper directory and run rubymine . to run RubyMine for that directory
If you want to play around with different args passed while starting RubyMine, check rubymine docs.

How to start GNU Octave with GUI through Cygwin from a desktop icon?

Since GNU Octave comes wit a GUI since versions 3.8.0, I thought I should check it out.
So since I run Windows and could only find Octave 3.8 for Cygwin, I installed Cygwin and the packages octave, xinit, xlaunch and gnuplot (according to this page, but I don't know if all those packages are needed).
Then, when trying to start Octave with the GUI from Cygwin with octave --force-gui, I initially got the error message
octave: X11 DISPLAY environment variable not set
and Octave would start in console mode. So I found this page, which told me to run
echo "export DISPLAY=:0.0" >>~/.bash_profile
from Cygwin, to permanently get rid of the error message, which worked. However, then I instead got this error message:
octave: unable to open X11 DISPLAY
The same page also said that you have to run the X Server by going to Start -> Cygwin-X -> XWin Server. That worked, but since I don't want the xterm terminal to start since it is not needed, I found this page which told me to run
touch ~/.startxwinrc
from Cygwin to create an empty .startxwinrc file, to prevent the xtrem terminal from starting by default, which worked. The same page also mentioned that the X Server can be started directly from Cygwin with the command startxwin.
So, now I can start Octave with the GUI from Cygwin, simply by running
startxwin
octave --force-gui
However, I would like to just be able to double click on a desktop icon to get everything up and running.
So, to my question: Can I somehow put this in a script file, which when I run it, will be opened in Cygwin so that the commands in the script file will be run in Cygwin? And is there some way to automatically close the X Server after Octave has terminated? I've tried writing a file octave.bat, which starts Cygwin and gives a second batch file as argument, which in turn contains the commands I want to execute. But when I run the first script, I just get bombarded with command prompts (not Cygwin prompts), and the all say
'startxwin' is not recognized as an internal or external command, operable program or batch file.
Why is the second script not opened in Cygwin, and how can I achieve what I want as simply as possible?
Please grab Octave from here: http://mxeoctave.osuv.de/
The installer should configure everything for you.
GNU Octave offers now Windows binary itself. Go to ftp://ftp.gnu.org/gnu/octave/windows/
You have to put
c:\cygwin64\bin\mintty.exe /bin/sh -lc 'startxwin /bin/octave --force-gui'
in your windows batch file (please adapt the Cygwin path to your settings). That worked fine for me.
The call
c:\cygwin64\bin\bash --login -c "startxwin /bin/octave --force-gui"
did open Octave as desired but the GUI seemed to have response issues to the keyboard and froze after clicking into the editor.
I don't have any of the those commands installed with my Cygwin installation, so I can't test this by trying using the following an .bat file on your desktop:
c:\cygwin\bin\bash --login -c "startxwin octave --force-gui"
Replace c:\cygwin with the directory where you installed Cygwin.
If this leaves a console window on the screen try doing:
c:\cygwin\bin\bash --login -c "run startxwin octave --force-gui"

Perl in Windows 8

I am trying to get Strawberry perl running on my windows 8 machine. This is my first attempt ever to use perl and I am going through the readme file to try and get it up and running. At the moment i have got as far as typing
c:\>perl
and i get access denied message. Am i misunderstanding the readme or do i need to make some further adjustments to get it to work?
The instrustions for the readme are
1. run any perl script by launching
c:\> perl c:\path\to\script.pl
i have also tried
c:\>perl c:\perls\ex1.pl
where perls is the folder on C: in which the script ex1 is located. Also get access denied message.
Posting comment as answer.
The command
c:\>perl
in the windows cmd shell is an instruction to redirect the output of the command c:\ to a file named perl. The > character is the one that does that.
I was going to say that it fails because you probably have a directory named perl there, but I notice on my system that it fails even though I have no such directory.
The problem is that the readme had included the prompt in their sample command. The default prompt in windows cmd looks like that: C:\> So, like I mentioned in the comments, the command you need to run perl is simply perl. For example:
perl -e "print 'Hello world!'"
It could be either the fact that Perl isn't in your PATH, or permissions issue.
If it's the PATH, to troubleshoot and fix:
Find the directory where you installed Perl (say, "c:\program files\strawberry\perl\bin\" as an example)
Run Perl as full path: `"c:\program files\strawberry\perl\bin\perl c:\perls\ex1.pl".
If that works, you will simply need to add Perl's directory to PATH variable, so that running "perl" without a path will search for it in that directory. To do that, here are the references:
Window add Java to Path
https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them
http://www.itechtics.com/customize-windows-environment-variables/
If it's permissions, here's a reference: http://windows.microsoft.com/en-us/windows7/how-do-i-open-a-file-if-i-get-an-access-denied-message

Executing Ipython Script from System Shell

In the same way we can execute regular Python using shebangs (or PyLauncher on windows), can we do the same with Ipython and .ipy files?
Registering IPython in Windows registry so double-click .ipy launches IPython Console. Or from linux just adding an 'i' to '/usr/bin/python' and execute.
In Windows this would be really helpful, because one of the trickest parts of "system integration" is the command line arguments. If these could be tucked into a text file on the shebang (pylauncher style), that would be fabulous.
Not sure if I fully understand your problem, but you can create a py.ini file on Windows as described in the Customized Commands section of PEP 397 of which PyLauncher is an implementation.
[commands]
ipython=C:\Anaconda\Scripts\ipython.exe -v
Changing the path to where your local IPython is installed. If you associate the .ipy file extension with the pylauncher executable ( typically C:\Windows\py.exe and you can save the py.ini file to the same path ) and use the shebang below at the top of your .py/.ipy files they should run with ipython and the options specified in the py.ini file
#! ipython
You can also associate the ipython.exe with .ipy files on Windows and it will run the .ipy files.

Resources