Re: Can't install Inline::Java
On 04/25/2010 11:19 AM, C.DeRykus wrote: You might want to check the Inline mailing list mentioned on CPAN. Good idea. I'll try that. Thanks. Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Can't install Inline::Java
Hi all, I just tried to install Inline::Java from CPAN and it didn't work. The install process just stopped after some time. When I tried it the second time it stopped again at the same time. There was no error message or anything, it just stopped. Here is the output from CPAN when I ran it the second time, I hope one of you can help me. cpan[4] install Inline::Java Running install for module 'Inline::Java' Running make for P/PA/PATL/Inline-Java-0.52.tar.gz Has already been unwrapped into directory /home/alekoe/.cpan/build/Inline-Java-0.52-lSMcKs Has already been made Running make test make[1]: Entering directory `/home/alekoe/.cpan/build/Inline-Java-0.52-lSMcKs/Java' make[1]: Leaving directory `/home/alekoe/.cpan/build/Inline-Java-0.52-lSMcKs/Java' PERL_DL_NONLAZY=1 /usr/bin/perl -MExtUtils::Command::MM -e test_harness(0, 'blib/lib', 'blib/arch') t/*.t t/01_init.t Perl version is 5.01 Inline version is 0.46 Inline::Java version is 0.52 J2SDK version is 1.6.0_0, from /usr/lib64/jvm/java CLASSPATH is empty t/01_init.t ok t/02_primitives.t .. ok t/02_primitives_1_4.t .. ok t/03_objects.t . ok t/04_members.t . ok t/05_arrays.t .. ok t/06_static.t .. ok t/07_polymorph.t ... ok t/08_study.t ... ok t/09_usages.t .. ok t/10_1_shared_alone.t .. ok t/10_2_shared_start.t .. 1/3 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: list guidelines?
You wrote on 02/02/2010 05:29 PM: i think we need to come up with a set of guidelines for this list. this would be autoposted a few times a week and possibly to every new address seen. While I think this is a good idea in principle, in my opinion posting this a few times a week to the list borders on spamming. How about once, twice a month? bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: basename question from learning perl
Hi Jim, Jim Green wrote on 01/17/2010 05:25 PM: my $name = /usr/local/bin/perl; (my $basename = $name) =~ s#.*/##; # Oops! after substitution $basename is supposed to be perl but why it is not /local/bin/perl? will .*/ matches longest possible string? Yes it will match the longest possible string. To understand how this works (and how to avoid this behaviour if you don't want it) look into the concept of greedy regular expressions. For example here http://perldoc.perl.org/perlretut.html bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
eval and next
Hi all, I have a Perl program where I use eval to catch errors. As they are Java errors (via Inline::Java) I want my program to continue and just log the errors somewhere. My problem with this is, that I use the eval within a loop and I also use next in this loop to ignore some special cases. But now, whenever the next is triggered I get a warning like this: Exiting eval via next at ad_hoc_stats.pl line 204, GEN6 line 5421. Googling the message I found this thread on Perlmonks http://www.perlmonks.org/?node_id=104789 But that does not seem to be about the same problem. I know that next is executed for the enclosing for loop and not for the eval block. That is how I want it. I tried naming the for loop to show perl that I know what I'm doing but the warning persists. Is there some recommended way of doing this, so that I won't get a warning every time the next is triggered? I hope my problem is clear. If not, I could provide some sample code as well. bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: some errors in databasescript
Hi Ruprecht, You wrote on 09/17/2009 10:31 AM: syntax error at ./statistik.pl line 73, near } or syntax error at ./statistik.pl line 82, near ) { syntax error at ./statistik.pl line 86, near } or Missing right curly or square bracket at ./statistik.pl line 100, at end of line Execution of ./statistik.pl aborted due to compilation errors. Here the scriptcode: Line numbers would have been great. about line 40 die $sth-errstr if $sth-err; while (($name, $vorname, $firma) = $sth1-fetchrow_array) { -- You never close this opening curly bracket. That's probably the problem. hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Time stamp in file name.
Hi, You wrote on 07/08/2009 09:35 AM: #!/usr/bin/perl -w # Prog for demostrating file name concatenations. $prefix=log; $suffix=.gz; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); # Time $middle=sprintf %4d-%02d-%02d \n,$year+1900,$mon+1,$mday; print My Date : $middle \n; $file_name=join(_,$prefix.$middle.$suffix); print New File name : $file_name \n; I am getting value of $file_name as New File name : 1250_RDE_2009-07-07 .gz The script above has a different output for me, i.e.: - My Date : 2009-07-08 New File name : log_2009-07-08 _.gz -- Why do you put a whitespace and a linebreak into $middle? I would change this line $middle=sprintf %4d-%02d-%02d \n,$year+1900,$mon+1,$mday; to this $middle=sprintf %4d-%02d-%02d,$year+1900,$mon+1,$mday; Why are you using join to put the filename together? I would change this line $file_name=join(_,$prefix.$middle.$suffix); to this $file_name= $prefix._.$middle.$suffix; hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Time stamp in file name.
I wrote on 07/08/2009 09:50 AM: #!/usr/bin/perl -w # Prog for demostrating file name concatenations. $prefix=log; $suffix=.gz; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); # Time $middle=sprintf %4d-%02d-%02d \n,$year+1900,$mon+1,$mday; print My Date : $middle \n; $file_name=join(_,$prefix.$middle.$suffix); print New File name : $file_name \n; I am getting value of $file_name as New File name : 1250_RDE_2009-07-07 .gz The script above has a different output for me, i.e.: - My Date : 2009-07-08 New File name : log_2009-07-08 _.gz -- I'm sorry. The actual output from the quoted script was My Date : 2009-07-08 New File name : log2009-07-08 .gz This is because join expects a list as its second parameter. That means it should be $file_name=join(_,($prefix,$middle,$suffix)); instead of $file_name=join(_,$prefix.$middle.$suffix); bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Time stamp in file name.
Hi again, You wrote on 07/08/2009 10:14 AM: But still a bit curios about this if I do $middle=`date +%F`; I get result ( the new line prob), New File name : log_2009-07-07 .gz It there any way to do it using this (Using date command). That's because the date output includes a newline. Try chomping it before you use it: $middle=`date +%F`; chomp ($middle); print $middle; = no linebreak anymore hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Pattern match question
You wrote on 05/27/2009 10:50 AM: I want to match one tr.../tr pair. my code : my $pattern = (tr (.|\\n)*\\\/tr); ... but I got the whole matches instead of one tr.../tr pair each loop. Do need to de-greedify it. my $pattern = (tr (.|\\n)*?\\\/tr); This should do the trick. hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Simple regex question
You wrote on 05/19/2009 03:18 PM: Simple question for the regEXperts out there... I have a string that is always in the format: a.nn+x.y a is always 5 chars n can be 1 or 2 digits x can be +/- (with sign), 1-4 digits y is always positive (no sign), 1-4 digits The best I can come up with on the fly would be something like this: --- #!/usr/bin/perl use strict; use warnings; my @test = ('A123C.11+002.001','FC32G.2-1.0','12B15.01+2145.15'); foreach my $item (@test) { print $item\n\n; ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/; my ($lengthx, $lengthy) = (length $x, length $y); print a = $a, n = $n, x = $x, y = $y, length x = $lengthx, length y = $lengthy\n; } --- But the real experts can probably compress it much more still. hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Simple regex question
Chas. Owens wrote on 05/19/2009 04:02 PM: ($a,$n,$x,$y)) = $item =~ /(.{5})\.(\d\d?)[-+](\d{1,4})\.(\d{1,4})/; snip As of Perl 5.8 \d no longer matches [0-9]. It now matches any UNICODE character that has the digit property. This includes characters such as \x{1815} (MONGOLIAN DIGIT FIVE). You must use [0-9] if you mean [0-9] or use the bytes pragma[1] to return the old meaning of \d (but this breaks all UNICODE processing in the scope you declare it). Oh, I didn't know that. Thanks for pointing that out. But in most scenarios \d will still work, right? I mean, how often do you actually encounter the Mongolian Digit Five in real life data? bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Testing a scalier for two possible values at once
You wrote on 05/13/2009 02:17 AM: I need to test a scalier to see if its value is not two possibilities, because this test is being done inside a while loop I can not use an elsif statement without things getting ugly. I have tried it like this if ($scalier nq 'A') || ($scalier nq 'B') { but that just gave me a syntax error when I tried to run it. It's ne not nq. hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Can't Retrieve Data From foreach block
Hi, You wrote on 03/30/2009 04:07 PM: How can I retrieve data loaded into an array within a foreach block? The array is defined outside the foreach block and is not the indexing array of the foreach loop. I ran your code and it works fine here. I did however have the same problem as you at first, so maybe you made the same mistake I did at first. foreach (@lines) { @line = split /\t/, $_; push @lastnames, $line[2]; } Are you sure that the split (always) produces an array with three elements? In my test array it only had two a la alex\tkoenig, which resulted in the error messages you described. To test this you could insert a print line after the split. Something like this. print $line[0]\t$line[1]\t$line[2]\n; bye Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: free perl editor wanted
itshardtogetone wrote on 02/09/2009 12:22 AM: Can someone introduce me a free Perl editor that also can easily produce html codes. Thanks If you are on Windows, try Notepad++[1]. It knows a lot of formats (including Perl and HTML), is easy to use (if you don't want to learn emacs or vim) and is licensed under GPL. hth Alex [1] http://notepad-plus.sourceforge.net -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: free perl editor wanted
David Shere wrote on 02/18/2009 02:26 PM: If you want an editor that will also allow you to put in breakpoints, and step through code line by line while examining variables, you could use Komodo. I haven't used it for a while but it was a very nice tool when I was first learning. ... It would be nice if eclipse would do this sort of thing for perl... It does. I am using EPIC[1] and it does allow breakpoints and stepping through code. bye Alex [1] http://www.epic-ide.org/ -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Perl MOdule Tutorial
You wrote on 02/03/2009 10:21 AM: Hi, Can you please point me to some good perl module tutorial for a beginner level? Have a look at the Perlmonks site: http://perlmonks.org/?node=Tutorials#Modules-How-to-Create-Install-and-Use hth Alex -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/