60 PerlMonks - Newest Nodes New nodes appearing on PerlMonks http://perlmonks.org/index.pl?node_id=30175 http://blogs.law.harvard.edu/tech/rss PerlMonks Newest Nodes XML Generator 961 PerlMonks 2015-06-03 01:03:54 rss,clean Tue Jun 2 15:03:54 2015 30 20150602150354 Tue Jun 2 15:03:54 2015 http://perlmonks.org/ Anonymous Monk Using XPaths with XML::LibXML and XPathContext worik http://perlmonks.org/index.pl?node_id=1128870 I am trying to parse some simple XML in XML::LibXML and I have struck a problem. The domain is WebDAV. A PROPFIND request from a user can send some very simple XML, but in a variety ... perlquestion Tue, 02 Jun 2015 23:24:34 +0000 http://perlmonks.org/index.pl?node_id=1128870 1128870 819844 2015-06-02 19:24:34 worik Perl file rename keltan http://perlmonks.org/index.pl?node_id=1128869 HI I've got problem i need to write file renamer. I know that there are topics on this forum with answers but i need to write slightly different code and i hope you will help. Yes this is my h... perlquestion Tue, 02 Jun 2015 23:22:49 +0000 http://perlmonks.org/index.pl?node_id=1128869 1128869 1124053 2015-06-02 19:22:49 keltan scp output without having to use "Net::SCP" in Perl pjzero@90 http://perlmonks.org/index.pl?node_id=1128852 Question, I'm trying to scp output/file from one machine to another without using Net::SCP, any ideas? Example: #system("/usr/bin/tmp",$output,"$USER\@$host:/tmp/LOGS/"); While trying t... perlquestion Tue, 02 Jun 2015 21:13:09 +0000 http://perlmonks.org/index.pl?node_id=1128852 1128852 1128849 2015-06-02 17:13:09 pjzero@90 Re^5: Threads From Hell #3: Missing Some Basic Prerequisites BrowserUk http://perlmonks.org/index.pl?node_id=1128885 I think $Q->enqueue( <a href="?node=%20%24Y%2C%20%40colors%20"> $Y, @colors </a> ); is a typo - it should be $Q->enqueue( <a href="?node=%20%24y%2C%20%40colors%20"> $y, @colors </a> );. Indeed. A typo. (Talking of which: for my $y ( 0 .. $width -... note Wed, 03 Jun 2015 01:03:26 +0000 http://perlmonks.org/index.pl?node_id=1128885 1128885 171588 2015-06-02 21:03:26 BrowserUk Re^2: Using XPaths with XML::LibXML and XPathContext worik http://perlmonks.org/index.pl?node_id=1128884 I get it now. (I was getting confused between the namespace DAV: and the namespace DAV, duh!) Is it compulsory to register a namespace prefix? I can seem to find no way... note Wed, 03 Jun 2015 01:03:06 +0000 http://perlmonks.org/index.pl?node_id=1128884 1128884 819844 2015-06-02 21:03:06 worik Re^2: Perl file rename Anonymous Monk http://perlmonks.org/index.pl?node_id=1128883 Just to add to that: Perl knows how to do filename expansion too: <a href="http://perldoc.perl.org/functions/glob.html">glob</a>... note Wed, 03 Jun 2015 00:43:51 +0000 http://perlmonks.org/index.pl?node_id=1128883 1128883 961 2015-06-02 20:43:51 Anonymous Monk Re: Using XPaths with XML::LibXML and XPathContext Anonymous Monk http://perlmonks.org/index.pl?node_id=1128882 In it I register 'D' as a prefix for 'DAV:' and so using a XPath with 'D' as prefix works where the XML uses it too. No, the expression /D:propfind/D:propname... note Wed, 03 Jun 2015 00:40:04 +0000 http://perlmonks.org/index.pl?node_id=1128882 1128882 961 2015-06-02 20:40:04 Anonymous Monk Re: Perl file rename aaron_baugher http://perlmonks.org/index.pl?node_id=1128881 When you run your command at the shell, any unescaped wildcards are expanded according to what files they match. So if there are three files, 1.pl, 2.pl, and 3.pl in the directory, then t... note Wed, 03 Jun 2015 00:26:12 +0000 http://perlmonks.org/index.pl?node_id=1128881 1128881 597736 2015-06-02 20:26:12 aaron_baugher Re^3: greedy subexpression between two nongreedy ones Anonymous Monk http://perlmonks.org/index.pl?node_id=1128878 What's the name of that @{ } construct? According to <a href="http://search.cpan.org/perldoc?perlsecret">perlsecret</a> @{<a href="?node=%20"> </a>} is the "baby cart" operator.... note Wed, 03 Jun 2015 00:02:04 +0000 http://perlmonks.org/index.pl?node_id=1128878 1128878 961 2015-06-02 20:02:04 Anonymous Monk Re^5: Annotations for Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1128877 See <a href="http://perldoc.perl.org/perlpod.html">perlpod</a>: =for actually shouldn't have a blank line after it, and according to the docs its contents can be on the same line, so something like =for ide @Returns Foo::Bar s... note Tue, 02 Jun 2015 23:56:18 +0000 http://perlmonks.org/index.pl?node_id=1128877 1128877 961 2015-06-02 19:56:18 Anonymous Monk Re^3: greedy subexpression between two nongreedy ones Anonymous Monk http://perlmonks.org/index.pl?node_id=1128876 @{<a href="?node=...">...</a>} is a trick for interpolation of almost any expression into a string, explained e.g. <a href="?node_id=1116403">here</a>.... note Tue, 02 Jun 2015 23:53:41 +0000 http://perlmonks.org/index.pl?node_id=1128876 1128876 961 2015-06-02 19:53:41 Anonymous Monk Re: Perl file rename FreeBeerReekingMonk http://perlmonks.org/index.pl?node_id=1128875 Writing *.pl in a shell (not sure if CMD too) will expand automatically BEFORE it is handed over to perl's @ARGV, better quote everything! Then there is this guy called Larry Wal... note Tue, 02 Jun 2015 23:50:08 +0000 http://perlmonks.org/index.pl?node_id=1128875 1128875 1117559 2015-06-02 19:50:08 FreeBeerReekingMonk Re^2: greedy subexpression between two nongreedy ones raygun http://perlmonks.org/index.pl?node_id=1128874 I had not -- because I had no idea such a thing was possible. (So many Perl tricks to learn!) In fact, I still don't know how to find out more about this, because it's impossible to search Perl d... note Tue, 02 Jun 2015 23:48:35 +0000 http://perlmonks.org/index.pl?node_id=1128874 1128874 930250 2015-06-02 19:48:35 raygun Re^2: Run a script in parallel mode marioroy http://perlmonks.org/index.pl?node_id=1128873 MCE applies "graceful" IO while reading input. Only a single worker reads at any given time. This allows for sequential IO which is typically faster than random IO, especially for mechanical drives... note Tue, 02 Jun 2015 23:42:32 +0000 http://perlmonks.org/index.pl?node_id=1128873 1128873 1005295 2015-06-02 19:42:32 marioroy Re: Perl file rename Anonymous Monk http://perlmonks.org/index.pl?node_id=1128872 Funny thing is that in other languages i don't have that problem only PERL always beat me down. Fight back, <a href="?node_id=745674">Basic debugging checklist</a> , <a href="https://metacpan.org/module/Data%3A%3ADump">Data::Dump</a>::dd( \@ARGV ... note Tue, 02 Jun 2015 23:39:35 +0000 http://perlmonks.org/index.pl?node_id=1128872 1128872 961 2015-06-02 19:39:35 Anonymous Monk Re: Using XPaths with XML::LibXML and XPathContext Anonymous Monk http://perlmonks.org/index.pl?node_id=1128871 This is just a repeat of your previous question, see <a href="?node_id=1128685">Re^2: xmlns and XML::LibXML</a> and <a href="?node_id=1128721">Re^5: xmlns and XML::LibXML ( local-name() )</a> ... note Tue, 02 Jun 2015 23:37:49 +0000 http://perlmonks.org/index.pl?node_id=1128871 1128871 961 2015-06-02 19:37:49 Anonymous Monk Re^4: why does location of function matter? eyepopslikeamosquito http://perlmonks.org/index.pl?node_id=1128868 Around the same time you made this reply, you <a href="?node_id=1128687">claimed</a>: I choose to spend my time striving to assist that person It was this implausible c... note Tue, 02 Jun 2015 23:15:33 +0000 http://perlmonks.org/index.pl?node_id=1128868 1128868 176576 2015-06-02 19:15:33 eyepopslikeamosquito Re^2: Why to wrap Perl classes inside a Perl script into blocks Anonymous Monk http://perlmonks.org/index.pl?node_id=1128867 sundialsvc4: perldoc <a href="http://perldoc.perl.org/functions/package.html">package</a> deserves careful and frequent re-reading, because the way that Perl handles this declaration is probably not what you would i... note Tue, 02 Jun 2015 23:14:40 +0000 http://perlmonks.org/index.pl?node_id=1128867 1128867 961 2015-06-02 19:14:40 Anonymous Monk Re^4: why does location of function matter? Anonymous Monk http://perlmonks.org/index.pl?node_id=1128866 sundialsvc4: Gentlemen, your time would be better served trying to constructively answer other people&rsquo;s questions, and less time bashing other Monks. &nbsp; If you don&rsquo... note Tue, 02 Jun 2015 23:05:43 +0000 http://perlmonks.org/index.pl?node_id=1128866 1128866 961 2015-06-02 19:05:43 Anonymous Monk Re^5: Run a script in parallel mode marioroy http://perlmonks.org/index.pl?node_id=1128865 I updated the code snippet to have workers remove the input file after running. You may have already done that in your code.... note Tue, 02 Jun 2015 23:03:19 +0000 http://perlmonks.org/index.pl?node_id=1128865 1128865 1005295 2015-06-02 19:03:19 marioroy Re: dbd-mysql permission denied Anonymous Monk http://perlmonks.org/index.pl?node_id=1128864 ?where is lib/DBD/mysql.pm located? ?where is auto/DBD/mysql/mysql.so located? ?what do you get when you run ls -loanh ...auto/DBD/mysql/mysql.so ldd ...auto/DB... note Tue, 02 Jun 2015 22:56:24 +0000 http://perlmonks.org/index.pl?node_id=1128864 1128864 961 2015-06-02 18:56:24 Anonymous Monk Re^3: Annotations for Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1128863 Yes, i know that. But there is a big difference between writing one-string and production OOP code. choroba is talking about "production", he is not talking about "one-string" ... note Tue, 02 Jun 2015 22:53:24 +0000 http://perlmonks.org/index.pl?node_id=1128863 1128863 961 2015-06-02 18:53:24 Anonymous Monk Re: Annotations for Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1128862 Of course, it's possible to constantly work on smart algorythms, which will be able to analyse previous sub in "dereference" chain and try to guess, what was returned. But it's an endless ... note Tue, 02 Jun 2015 22:52:22 +0000 http://perlmonks.org/index.pl?node_id=1128862 1128862 961 2015-06-02 18:52:22 Anonymous Monk Re^5: Annotations for Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1128861 Isn't it too messy? Nope. There is no reason pod has to go in the source code, it can go in its own .pod file. But then again magic comments can be added to the .pod file as well. ... note Tue, 02 Jun 2015 22:21:24 +0000 http://perlmonks.org/index.pl?node_id=1128861 1128861 961 2015-06-02 18:21:24 Anonymous Monk Re^2: scp output without having to use "Net::SCP" in Perl pjzero@90 http://perlmonks.org/index.pl?node_id=1128860 stevieb, $output is the output of a command, for example, let's say $output = `ls -ltra /tmp`; Thanks, -- pjzero@90... note Tue, 02 Jun 2015 22:20:20 +0000 http://perlmonks.org/index.pl?node_id=1128860 1128860 1128849 2015-06-02 18:20:20 pjzero@90 Re: Annotations for Perl Anonymous Monk http://perlmonks.org/index.pl?node_id=1128859 Really need a feedback and ideas. Seems like a dead end that gets in the way of work :) much like <a href="https://metacpan.org/module/Rinci">Rinci</a>/ <a href="https://metacpan.org/module/Perinci">Perinci</a> ... note Tue, 02 Jun 2015 22:11:40 +0000 http://perlmonks.org/index.pl?node_id=1128859 1128859 961 2015-06-02 18:11:40 Anonymous Monk Re: greedy subexpression between two nongreedy ones Anonymous Monk http://perlmonks.org/index.pl?node_id=1128858 Indeed it seems you are trying to accomplish too much with a single regex! But here's another alternative: s/(?&COMMA)(?:.*?(?:((?&CEEDEE)).*?(?&COMMA)|(?&COMMA)()))(?(DEFINE)(?,)(?... note Tue, 02 Jun 2015 22:07:15 +0000 http://perlmonks.org/index.pl?node_id=1128858 1128858 961 2015-06-02 18:07:15 Anonymous Monk Re: scp output without having to use "Net::SCP" in Perl stevieb http://perlmonks.org/index.pl?node_id=1128857 What exactly is in $output? It could be being mistaken for an argument to scp. Try hard setting all the system() arguments manually to their actual values, and go from there. For i... note Tue, 02 Jun 2015 21:59:16 +0000 http://perlmonks.org/index.pl?node_id=1128857 1128857 789891 2015-06-02 17:59:16 stevieb Re: XML Parse Anonymous Monk http://perlmonks.org/index.pl?node_id=1128856 See <a href="?node_id=1128682">xmlns and XML::LibXML</a> and <a href="https://metacpan.org/module/XML%3A%3ACompile%3A%3ASOAP">XML::Compile::SOAP</a> ... note Tue, 02 Jun 2015 21:48:37 +0000 http://perlmonks.org/index.pl?node_id=1128856 1128856 961 2015-06-02 17:48:37 Anonymous Monk Re^2: scp output without having to use "Net::SCP" in Perl pjzero@90 http://perlmonks.org/index.pl?node_id=1128855 I did, wondering why this did not work: system("/usr/bin/scp",$output,"$USER\@$host:/tmp/LOGS/"); I get the following: scp: illegal option -- w usage: scp <a href="?node=-1246BCpqrv">-1246BCpqrv</a> <a href="?node=-c%20cipher">-c cipher</a> &#91;-F ssh_conf... note Tue, 02 Jun 2015 21:46:47 +0000 http://perlmonks.org/index.pl?node_id=1128855 1128855 1128849 2015-06-02 17:46:47 pjzero@90 Re: greedy subexpression between two nongreedy ones Anonymous Monk http://perlmonks.org/index.pl?node_id=1128854 Have you considered testing for 'cd' in the replacement? s/,(.*?),/=@{<a href="?node=%241%20%3D~%20m">(cd)| && $1 </a>}=/ ... note Tue, 02 Jun 2015 21:38:56 +0000 http://perlmonks.org/index.pl?node_id=1128854 1128854 961 2015-06-02 17:38:56 Anonymous Monk Re: scp output without having to use "Net::SCP" in Perl sierpinski http://perlmonks.org/index.pl?node_id=1128853 /usr/bin/tmp Should probably try /usr/bin/scp.. ;-) ... note Tue, 02 Jun 2015 21:18:11 +0000 http://perlmonks.org/index.pl?node_id=1128853 1128853 776515 2015-06-02 17:18:11 sierpinski Re^5: greedy subexpression between two nongreedy ones Anonymous Monk http://perlmonks.org/index.pl?node_id=1128851 s#,(?:(?:(?!,).)*(cd))?(?:(?!,).)*,#=@{<a href="?node=%241%20%2F%2F%20%27%27">$1 // &#39;&#39;</a>}=# Are there any more requirements you're not telling us? ... note Tue, 02 Jun 2015 21:10:40 +0000 http://perlmonks.org/index.pl?node_id=1128851 1128851 961 2015-06-02 17:10:40 Anonymous Monk Re^3: Serial communication between perl and arduino jmlynesjr http://perlmonks.org/index.pl?node_id=1128848 Ok. Maybe the following will help. package Device::SerialPort::Arduino; use strict; use warnings; use Time::HiRes; use Carp; use Device::SerialPort; use vars qw($VERSION); ... note Tue, 02 Jun 2015 20:59:10 +0000 http://perlmonks.org/index.pl?node_id=1128848 1128848 982107 2015-06-02 16:59:10 jmlynesjr Re^5: greedy subexpression between two nongreedy ones Anonymous Monk http://perlmonks.org/index.pl?node_id=1128847 Phony problems lead to phony solutions... Please show the exact problem. ... note Tue, 02 Jun 2015 20:43:49 +0000 http://perlmonks.org/index.pl?node_id=1128847 1128847 961 2015-06-02 16:43:49 Anonymous Monk Re: Parse for a list in a long string vitoco http://perlmonks.org/index.pl?node_id=1128846 Thanks for all the responses and ideas. I was aware that this was a double loop problem, but I tried it with a single regexp anyway, and crashed against the fact that if I add a quantifie... note Tue, 02 Jun 2015 20:39:58 +0000 http://perlmonks.org/index.pl?node_id=1128846 1128846 763880 2015-06-02 16:39:58 vitoco Re^3: Match two files using regex GotToBTru http://perlmonks.org/index.pl?node_id=1128845 Yep. I strongly suggest you get familiar with the Perl <a href="http://perldoc.perl.org/perldebtut.html">debugger</a>. It will be an enormous help to you as you learn the language. You can inspect the values of variables while the ... note Tue, 02 Jun 2015 19:53:20 +0000 http://perlmonks.org/index.pl?node_id=1128845 1128845 844862 2015-06-02 15:53:20 GotToBTru Re: What kind of chocolate gives you the most pleasure? gandolf989 http://perlmonks.org/index.pl?node_id=1128844 Espresso Dark Chocolate with 85% or more cocoa. When you are tired dark chocolate is a beacon of light...... note Tue, 02 Jun 2015 19:45:27 +0000 http://perlmonks.org/index.pl?node_id=1128844 1128844 1104494 2015-06-02 15:45:27 gandolf989 Re: Parse for a list in a long string Anonymous Monk http://perlmonks.org/index.pl?node_id=1128843 It's really a double loop. #!/usr/bin/perl # http://perlmonks.org/?node_id=1128809 use strict; use warnings; while() { my @items; s/\s+/ /g; # simplify ... note Tue, 02 Jun 2015 19:35:56 +0000 http://perlmonks.org/index.pl?node_id=1128843 1128843 961 2015-06-02 15:35:56 Anonymous Monk Re^2: Match two files using regex chemshifts http://perlmonks.org/index.pl?node_id=1128842 I see, I guess it's the same for the fields variable as well...... note Tue, 02 Jun 2015 19:35:40 +0000 http://perlmonks.org/index.pl?node_id=1128842 1128842 1128817 2015-06-02 15:35:40 chemshifts Re^3: Lottery Numbers Anonymous Monk http://perlmonks.org/index.pl?node_id=1128841 There is one simple thing that you can fix the source file, just delete everything before 10/15/2013.... note Tue, 02 Jun 2015 19:31:51 +0000 http://perlmonks.org/index.pl?node_id=1128841 1128841 961 2015-06-02 15:31:51 Anonymous Monk Re^4: greedy subexpression between two nongreedy ones raygun http://perlmonks.org/index.pl?node_id=1128840 I see now my problem statement was a little sloppy: I failed to use the same sample text in my first two examples. Namely, I inadvertently omitted the trailing comma in the first example. ... note Tue, 02 Jun 2015 19:26:09 +0000 http://perlmonks.org/index.pl?node_id=1128840 1128840 930250 2015-06-02 15:26:09 raygun Re: Match two files using regex GotToBTru http://perlmonks.org/index.pl?node_id=1128839 You declare my $value inside the loop, so that variable will cease to exist once the loop exits. You need to move your test inside the loop, and don't re-declare the variable. That's the first prob... note Tue, 02 Jun 2015 19:21:27 +0000 http://perlmonks.org/index.pl?node_id=1128839 1128839 844862 2015-06-02 15:21:27 GotToBTru Re^5: Is there an option to see the non answered questions? mr_mischief http://perlmonks.org/index.pl?node_id=1128838 Some sites are built primarily as question and answer sites. They have a software feature to allow the person asking a question to mark it as answered or to select the best answer. That seems to ... note Tue, 02 Jun 2015 19:11:35 +0000 http://perlmonks.org/index.pl?node_id=1128838 1128838 62512 2015-06-02 15:11:35 mr_mischief Re^4: Run a script in parallel mode Anonymous Monk http://perlmonks.org/index.pl?node_id=1128837 Hi again! I want to thank you all for your input and particularly code snippets. I actually tested marioroy's code and it works as I needed. Parallelization is actually faster now. Thank you agai... note Tue, 02 Jun 2015 19:08:33 +0000 http://perlmonks.org/index.pl?node_id=1128837 1128837 961 2015-06-02 15:08:33 Anonymous Monk anotes anotes http://perlmonks.org/index.pl?node_id=1128879 user Wed, 03 Jun 2015 00:06:47 +0000 http://perlmonks.org/index.pl?node_id=1128879 1128879 1128879 2015-06-02 20:06:47 anotes pjzero@90 pjzero@90 http://perlmonks.org/index.pl?node_id=1128849 user Tue, 02 Jun 2015 21:10:32 +0000 http://perlmonks.org/index.pl?node_id=1128849 1128849 1128849 2015-06-02 17:10:32 pjzero@90