Closed cashfields closed 6 years ago
Hi, this does not sound like a Komodo problem, but a problem with how you are invoking your Perl interpreter. Perhaps the files are owned by admin and cannot be read by a normal user, perhaps any Perl script needs to be run as admin, etc. Regardless, this does not sound like a Komodo bug.
Mitchell You guys - KOMODO IDE - are invoking a CMD window and calling the perl script. When you invoke the CMD window , it does not have ADMIM level. There is nothing that I do other then click two IDE boxes to get the CMD window to open. By clicking the two boxes , the perl program does NOT run in the IDE , but external to the IDE. So internal to the IDE some call is being made to start a CMD window , and then invoke the perl program. Please reopen and open your thinking. Look carefully at the first page , the two check boxes from IDE - these say invoke a external console (CMD). Not in the IDE. Look carefully at the tilde on page 4 ; it says: "C":\WINDOWS\system32\ cmd.exe". This is invoked by the Komodo IDE ; it does not request enough privilege to properly execute the CMD & perl interpreter. That is why it fails.
UC
On Monday, April 9, 2018, 9:43:18 AM CDT, mitchell <notifications@github.com> wrote:
Closed #3530.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
I tested the code, and it does not work, at least as I understand it should. Some steps to reproduce are below.
Running under Strawberry Perl 5.26.1 under Komodo 11.0.2 with the "Simulate CGI Environment" and "Debug in separate console" options set:
syntax error at C:\komodocheck\XX.PL line 5, near "= ;"
syntax error at C:\komodocheck\XX.PL line 6, near "= ;"
Execution of C:\komodocheck\XX.PL aborted due to compilation errors.
Press any key to continue . . .
If I add use strict; use warnings;
to the top of the file then I get:
Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 8.
syntax error at C:\komodocheck\XX.PL line 8, near "= ;"
Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 9.
syntax error at C:\komodocheck\XX.PL line 9, near "= ;"
Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 10.
Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 10.
Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 12.
Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 13.
Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 14.
Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 15.
Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 17.
Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 19.
Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 20.
Execution of C:\komodocheck\XX.PL aborted due to compilation errors.
Press any key to continue . . .
When I correct those lines I get:
Name "main::INFILE2" used only once: possible typo at C:\shawn\git\perlmonks\komodo\XX.PL line 6.
Name "main::INFILE1" used only once: possible typo at C:\shawn\git\perlmonks\komodo\XX.PL line 4.
Press any key to continue . . .
The code never reads from the file handles. Updating the file to do so triggers the crash dialogue, but the code still does not work as intended (so far as I understand it). It also crashes when called outside komodo. See the first set of code below.
The second set of code below works as I understand it should, although it could still be modernised to use lexical file handles.
# This code segfaults
use strict;
use warnings;
open (INFILE1, "merge1.txt") ||
die ("Cannot open input file merge1.txt\n");
open (INFILE2, "merge2.txt") ||
die ("Cannot open input file merge2.txt\n");
my $line1 = '';
my $line2 = '';
# not very valid code here, but triggers the seg fault
while ($line1 = <INFILE1> or $line2 = <INFILE2>)
{
if ($line1 ne "") {
print STDOUT ($line1);
print ($line1);
$line1 = '';
}
if ($line2 ne "")
{
print ($line2);
$line2 = '';
}
}
# This code does not segfault
use strict;
use warnings;
open (INFILE1, "merge1.txt")
or die ("Cannot open input file merge1.txt\n");
open (INFILE2, "merge2.txt")
or die ("Cannot open input file merge2.txt\n");
my $line1 = <INFILE1>;
my $line2 = <INFILE2>;
while (defined $line1) {
if ($line1 ne "") {
print ($line1);
}
if ($line2 ne "")
{
print ($line2);
}
$line1 = <INFILE1>;
$line2 = <INFILE2>;
}
Guys I added your code and the problem went away. I see the "my" fixed the problem. I am reading an e-book called: (ebook pdf) teach yourself perl in 21 days.pdf
Just don't understand why there is so much difficulty to learn a new language. Thanks for the help.
same code in perl5:http://ft-sipil.unila.ac.id/dbooks/(ebook%20pdf)%20Teach%20Yourself%20Perl%20in%2021%20Days.pdf
=====================from the manual : (ebook pdf) teach yourself perl in 21 days.pdf
around page 247:
Merging Two Files into OneIn Perl, you can open as many files as you like, provided you define a different file variable for each one.(Actually, there is an upper limit on the number of files you can open, but it's fairly large and also systemdependent.)For an example of a program that has multiple files open at one time, take a look at Listing 6.5.This program merges two files by creating an output file consisting of one line from the first file, one linefrom the second file, another line from the first file, and so on. For example, if an input file named merge1contains the linesa1a2a3and another file, merge2, contains the linesb1b2b3then the resulting output file consists ofa1b1a2b2a3b3Listing 6.5. A program that merges two files.1: #!/usr/local/bin/perl2:3: open (INFILE1, "merge1") ||4: die ("Cannot open input file merge1\n");5: open (INFILE2, "merge2") ||6: die ("Cannot open input file merge2\n");7: $line1 =
Thanks again - will use "my" from here on out !!
UC
On Monday, April 9, 2018, 4:30:16 PM CDT, shawnlaffan <notifications@github.com> wrote:
I tested the code, and it does not work, at least as I understand it should. Some steps to reproduce are below.
Running under Strawberry Perl 5.26.1 under Komodo 11.0.2 with the "Simulate CGI Environment" and "Debug in separate console" options set: syntax error at C:\komodocheck\XX.PL line 5, near "= ;" syntax error at C:\komodocheck\XX.PL line 6, near "= ;" Execution of C:\komodocheck\XX.PL aborted due to compilation errors. Press any key to continue . . .
If I add use strict; use warnings; to the top of the file then I get: Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 8. syntax error at C:\komodocheck\XX.PL line 8, near "= ;" Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 9. syntax error at C:\komodocheck\XX.PL line 9, near "= ;" Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 10. Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 10. Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 12. Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 13. Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 14. Global symbol "$line1" requires explicit package name (did you forget to declare "my $line1"?) at C:\komodocheck\XX.PL line 15. Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 17. Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 19. Global symbol "$line2" requires explicit package name (did you forget to declare "my $line2"?) at C:\komodocheck\XX.PL line 20. Execution of C:\komodocheck\XX.PL aborted due to compilation errors. Press any key to continue . . .
When I correct those lines I get: Name "main::INFILE2" used only once: possible typo at C:\shawn\git\perlmonks\komodo\XX.PL line 6. Name "main::INFILE1" used only once: possible typo at C:\shawn\git\perlmonks\komodo\XX.PL line 4. Press any key to continue . . .
The code never reads from the file handles. Updating the file to do so triggers the crash dialogue, but the code still does not work as intended (so far as I understand it). It also crashes when called outside komodo. See the first set of code below.
The second set of code below works as I understand it should, although it could still be modernised to use lexical file handles.
use strict; use warnings;
open (INFILE1, "merge1.txt") || die ("Cannot open input file merge1.txt\n"); open (INFILE2, "merge2.txt") || die ("Cannot open input file merge2.txt\n"); my $line1 = ''; my $line2 = '';
while ($line1 =
open (INFILE1, "merge1.txt")
or die ("Cannot open input file merge1.txt\n");
open (INFILE2, "merge2.txt")
or die ("Cannot open input file merge2.txt\n");
my $line1 =
if ($line1 ne "") {
print ($line1);
}
if ($line2 ne "")
{
print ($line2);
}
$line1 = <INFILE1>;
$line2 = <INFILE2>;
} — You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
The book you are using is copyright 1996. You'd be better off using a more recent resource such as https://perlmaven.com/perl-tutorial or (at a more advanced level) https://pragprog.com/book/swperl/modern-perl-fourth-edition
You could also try perlmonks (e.g. http://www.perlmonks.org/?node_id=1172488) or stack overflow for perl specific problems.
Thanks for helping out @shawnlaffan ! :)
Shawn Thanks.
UC
On Monday, April 9, 2018, 6:30:01 PM CDT, shawnlaffan <notifications@github.com> wrote:
The book you are using is copyright 1996. You'd be better off using a more recent resource such as https://perlmaven.com/perl-tutorial or (at a more advanced level) https://pragprog.com/book/swperl/modern-perl-fourth-edition
You could also try perlmonks (e.g. http://www.perlmonks.org/?node_id=1172488) or stack overflow for perl specific problems.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
No worries.
Shawn.
Short Summary
Perl Interpreter Has Stopped Working Use Komodo IDE , when executing a small perl script , and opening a DOS window , by checking the two boxes "Simulate ...." and "Debug ...." (see screen print) the perl script runs. But the system fails at the end.
Steps to Reproduce
Run the IDE , for prel XX.PL
For example, if an input file named merge1
contains the lines
a1
a2
a3
and another file, merge2, contains the lines
b1
b2
b3
then the resulting output file consists of
a1
b1
a2
b2
a3
b3
open (INFILE1, "merge1.txt") || die ("Cannot open input file merge1.txt\n"); open (INFILE2, "merge2.txt") || die ("Cannot open input file merge2.txt\n"); $line1 =;
$line2 = ;
while ($line1 ne "" || $line2 ne "")
{
if ($line1 ne "") {
print STDOUT ($line1);
print ($line1);
$line1 = ;
}
if ($line2 ne "")
{
print ($line2);
$line2 = ;
}
}
Expected results
A list of data printed: a1 b1 a2 a2 b2 a3 a3 b3
Actual results
Prints , but then WINDOWS say , the "Perl Interpreter Has Stopped Working ..." (see screen print)
Platform Information
Komodo IDE Komodo Version? Komodo IDE, version 11.0.2, build 90813, platform win32-x86. Built on Mon Dec 04 08:56:02 2017. Operating System Windows 10?
See screen prints of system data
Additional Information
If I open a CMD window , and it is run as ADMINISTRATOR ; job runs successfully. No problems.
See screen print.
You need to add another "clicklydoodle" box the say's "Run as Administrator" or just execute the program (CMD and the perl script) as Administrator.
KOMODO FIX ADMIN ON EXECUTE.docx