|
Rohaq posted:Just a note for the future, a better way to write out regex questions in my mind is to do the following: http://search.cpan.org/dist/Parse-RecDescent/lib/Parse/RecDescent.pm or ... http://search.cpan.org/~dconway/Regexp-Grammars-1.012/lib/Regexp/Grammars.pm
|
# ? Dec 30, 2010 05:58 |
|
|
# ? Apr 18, 2024 06:44 |
|
slipped posted:http://search.cpan.org/dist/Parse-RecDescent/lib/Parse/RecDescent.pm Excuse me a few moments while I go cry about not finding either those before spending ages getting it all worked out myself. Edit: Not that I can figure out any idea of how to use either one from the linked documentation pages, but oh well. Edit edit: If anybody'd happen to have a primer around for Regex::Grammars or a sample pattern or something that would roughly fit that structure I posted, that would be really cool. The whole auto-grammaring idea seems pretty spiffy, but I just can't wrap my head around how it's all setup. anagramarye fucked around with this message at 11:43 on Dec 31, 2010 |
# ? Dec 31, 2010 08:48 |
|
What are some modules for zipping in Perl? Specifically Perl 5.8.4 - Archive::Zip and IO::Compress don't exist. I can't install anything else without a huge hassle, so if there's anything I'm missing, please let me know. Edit: gently caress it, just going to use the system's zip command. EVGA Longoria fucked around with this message at 16:20 on Jan 5, 2011 |
# ? Jan 5, 2011 15:10 |
|
I'd like to write a perl script that calls several executable jar files in sequence and appends all of their output (standard and err) to a log file. I've googled and tried several variations, all similar to this: pre:open ($log, '>>', "Publish.log") or die "could not open file: $!#"; @cmd = `java -jar thingy.jar 2>&1`; foreach (@cmd) {print $log $_;}
|
# ? Jan 7, 2011 23:13 |
|
Clanpot Shake posted:I'd like to write a perl script that calls several executable jar files in sequence and appends all of their output (standard and err) to a log file. code:
|
# ? Jan 8, 2011 01:21 |
|
Clanpot Shake posted:I'd like to write a perl script that calls several executable jar files in sequence and appends all of their output (standard and err) to a log file. Try IPC::Run, specifically something like code:
Backticks are of the Devil. Avoid them at every opportunity.
|
# ? Jan 8, 2011 08:32 |
|
wntd posted:Backticks are of the Devil. Avoid them at every opportunity.
|
# ? Jan 8, 2011 09:22 |
|
syphon posted:Why? I use them extensively to call external programs in Win32 platforms (where it's much more useful to parse the output than it is to catch the return code). I've never really run into a problem with them... but that certainly doesn't mean that one doesn't exist! As soon as you do it, you've stopped writing perl and started writing shell. (Admittedly, this may not be as much of a concern on Windows.) On top of being inflexible, it introduces things you shouldn't have to think about. E.g., to capture stderr, you have to do something like code:
Modules like IPC::Run or IPC::System::Simple are easier to use and more secure than deferring to the shell. I mean, there's a reason why you're doing this in perl in the first place, right?
|
# ? Jan 8, 2011 20:35 |
|
yeah you should immediately have red flags going off for backticks the same as when you see eval()
Fenderbender fucked around with this message at 21:50 on Jan 8, 2011 |
# ? Jan 8, 2011 21:44 |
|
Fenderbender posted:yeah you should immediately have red flags going off for backticks the same as when you see eval() NB. block eval != string eval
|
# ? Jan 8, 2011 23:57 |
|
Otto Skorzeny posted:NB. block eval != string eval Yeah, but even when you're tempted to use block eval, Try::Tiny is in most cases the proper solution.
|
# ? Jan 9, 2011 00:13 |
|
Otto Skorzeny posted:NB. block eval != string eval I thought about editing that to make myself more clear, but was too lazy. Thanks for clarifying.
|
# ? Jan 9, 2011 00:40 |
|
wntd posted:Try IPC::Run, specifically something like For context, This is running on a windows server and doesn't take user input.
|
# ? Jan 10, 2011 15:31 |
|
Anyone know how to edit the state of an initialized Log::Log4perl? There's not much documentation on it that I can find. I'm making a Moose role for internal libraries that takes a optional logger name and config file parameter, and pushes the configuration in the passed config onto the Log::Log4perl initialization at runtime. Since because different libraries get run as different users and I don't want every app getting append access rights to every logfile on the system, I need to do it like this as the monolithic config file that Log::Log4perl is based on requires anything consuming it to be able to initialize every logger.
|
# ? Jan 19, 2011 03:02 |
|
Roseo posted:Anyone know how to edit the state of an initialized Log::Log4perl? There's not much documentation on it that I can find. I'm making a Moose role for internal libraries that takes a optional logger name and config file parameter, and pushes the configuration in the passed config onto the Log::Log4perl initialization at runtime. I'm not sure if this is helpful but there is a system-wide threshold that can be set which overwrites category levels and such. It's in the Log4perl FAQ
|
# ? Jan 22, 2011 07:29 |
|
Wheelchair Stunts posted:I'm not sure if this is helpful but there is a system-wide threshold that can be set which overwrites category levels and such. It's in the Log4perl FAQ Not really. I'm trying to init it from multiple config files, so I can have a config per library that gets composed into the configuration at runtime and only opens up writes into the needed files instead of every logfile on the system.
|
# ? Jan 25, 2011 03:42 |
|
I'm writing a script using Win32::OLE to modify a setting on an IIS6 site. Here's the script:code:
code:
My immediate assumption is that the Put() method must return a positive value by default, but it seems to return null (when it succeeds). Any idea why my script is failing when I add in the 'or' conditionals? Note that the 'or' conditional doesn't cause any problems on the object instantiation, only with the Put() or SetInfo() methods. syphon fucked around with this message at 20:03 on Jan 28, 2011 |
# ? Jan 28, 2011 19:26 |
|
The value the Put and SetInfo methods return for success depends on the implementation of the OLE object, and in this case doesn't correspond to Perl's idea of true and false. They return the constant S_OK for success, which has a value of 0.
|
# ? Jan 28, 2011 22:03 |
|
I figured it was an issue of ADSI and Perl talking to each other in the same language. How can I check for errors in these methods?
|
# ? Jan 28, 2011 22:56 |
|
Is there an easy way to show yesterdays date using the POSIX module? (or another) You can just do `date -d yesterday` on the command line and it will work but every solution I've seen online for perl is some massive block of code: code:
|
# ? Feb 3, 2011 19:19 |
|
DateTime is a prime candidate for this: print DateTime->today->subtract( days => 1 )->ymd; or maybe instead of ymd, you can also use strftime with an appropiate pattern.
|
# ? Feb 3, 2011 19:50 |
|
I Really Wish Parrot Had Memory Barriers
|
# ? Feb 4, 2011 00:57 |
|
Does anyone have any experience with XS? I'm writing some web services that use this commercial format for geolocating IPs and the pure Perl module they have is way too slow for my needs but they have a very quick C library. What would be a good start in just making a bare bones XS library for exposing the functions in the C library? For reference: http://www.ip2location.com/c.aspx
|
# ? Feb 11, 2011 16:43 |
|
http://search.cpan.org/~sisyphus/Inline-0.47/C/C.pod
|
# ? Feb 12, 2011 00:06 |
|
After an hour of googling, for the life of me, I cannot figure out how to extract information from a hash table without using a key value. Lets Say I have a has table called %thisStupidTable with the following keys/values: code:
code:
code:
Canine Blues Arooo fucked around with this message at 01:49 on Feb 15, 2011 |
# ? Feb 15, 2011 01:44 |
|
There are a couple of mistaken assumptions and bad syntax in your post, but I'll try my best with an answer. First off, the concept of order in a hash is not straight forward. You can create your hash, but getting the same order out without tricks isn't going to happen. If you want to pull information out of your hash, you're going to want to look at keys and each. Also, when you're extracting scalars out of a hash, you need to use the scalar sigil ($) instead of the hash sigil (%), so: code:
Is that what you're asking? Edit: I don't know if I came off condescending. I apologize if I did. Anaconda Rifle fucked around with this message at 02:18 on Feb 15, 2011 |
# ? Feb 15, 2011 02:03 |
|
Anaconda Rifle posted:There are a couple of mistaken assumptions and bad syntax in your post, but I'll try my best with an answer. It's close, but instead of using 'orange' as a point of reference, I want to reference it from it's numerical position in the hash table, in this case, instead of using this: code:
code:
code:
edit: figured out the issue with the code above as well and it mostly revolves around me making more assumptions about this language. Canine Blues Arooo fucked around with this message at 02:41 on Feb 15, 2011 |
# ? Feb 15, 2011 02:24 |
|
http://search.cpan.org/~mhx/Tie-Hash-Indexed-0.05/lib/Tie/Hash/Indexed.pm maybe?
|
# ? Feb 15, 2011 02:44 |
|
Anaconda Rifle posted:http://search.cpan.org/~mhx/Tie-Hash-Indexed-0.05/lib/Tie/Hash/Indexed.pm maybe? That right there is a thing of beauty!
|
# ? Feb 15, 2011 03:01 |
|
Canine Blues Arooo posted:That right there is a thing of beauty!
|
# ? Feb 15, 2011 08:54 |
|
If you use Tie::* whoever uses your code after you is going to hate you. If you want to access your values in numerical order, simply use a data structure. For example:code:
code:
code:
Roseo fucked around with this message at 07:47 on Feb 16, 2011 |
# ? Feb 16, 2011 07:19 |
|
Triple Tech posted:Nevermind what I said. Low reading comprehension. Why don't you go gently caress yourself
|
# ? Feb 16, 2011 11:19 |
|
Is there a way to have Catalyst output what it is using from cache? I'm dynamically creating thumbnails, but i'm not sure if page_cache is caching them or not.
|
# ? Feb 26, 2011 03:07 |
|
I just got done overhauling quote_literal in EUMM and i have this need to share the love pain. After all, sharing is caring, right? If you have simple strings like this: code:
code:
code:
code:
code:
code:
code:
code:
code:
code:
code:
code:
Apparently the DOS batch parser is hilariously naive! This is code that actually represents working escaping under DOS batch parsing rules: code:
|
# ? Feb 27, 2011 20:44 |
|
Perhaps I haven't looked far enough, but I've never found a command line shell which provides the simple ability to safely escape-and-quote an arbitrary string. If you fancy another hilarious/maddening edge case in DOS, try getting this to actually print "%PATH%" out:code:
|
# ? Mar 2, 2011 23:21 |
|
qntm posted:Perhaps I haven't looked far enough, but I've never found a command line shell which provides the simple ability to safely escape-and-quote an arbitrary string. I think fish does? I should switch to it because I hate every shell including the one I use, zsh. Any shell that makes me type '"'"' instead of \' is a bastard. To bring this back to Perl a bit, there's a module that should be in your toolbox: String::ShellQuote.
|
# ? Mar 3, 2011 00:13 |
|
^^^^ Edit: This is entirely on Perl, let me assure you. I'm working on EUMM right now to get it to behave a lot nicer on Windows. Perfect DOS escaping would really be a treat there, but is just one of the things i'm doing. Heh, that one was surprisingly simple when you know that cmd.com ends input strings either at the closing quote or at the end of the line. code:
code:
|
# ? Mar 3, 2011 00:19 |
|
Has anyone ever encountered code where a hashref is preceded by a +? I have seen this a few times and have not been able to figure out why it is being done. I assume it forces some sort of context... but I have never been able to find a case where it actually did anything. e.g. code:
leedo fucked around with this message at 23:12 on Mar 8, 2011 |
# ? Mar 8, 2011 21:35 |
|
Is there a platform independent way to determine the amount of free memory on a system? I need to pass a heap size argument to a java process and the systems this will run on vary in OS and memory. I'd like to use 2, 3, or 4 GB of RAM depending on what's available.
|
# ? Mar 10, 2011 19:04 |
|
|
# ? Apr 18, 2024 06:44 |
|
I am having some troubles with the Outlook OLE and accessing some of its methods from Perl. Specifically, I'm looking to get the attachments from a file sitting in a public mailbox and move them to the network. A paired down version of my code is below: code:
|
# ? Mar 15, 2011 14:20 |