|
I found a much better way of doing things, no extra modules required: I'll post it when I'm back at work tomorrow
|
# ? Jul 22, 2010 01:42 |
|
|
# ? Apr 26, 2024 12:19 |
|
Okay, so my boss suggested redirecting the output to a file, then reading it back in, which seemed a bit sloppy, but I decided to try using the filehandle approach anyway, and used the following:code:
The command is run with STDERR redirected into STDOUT so that errors can be caught in the the while loop if required, and aren't displayed on the screen when the command is run in the script.
|
# ? Jul 22, 2010 14:07 |
|
which just iterates through bash's $PATH variable so why not cut out the middle-man and do it yourself?code:
code:
|
# ? Jul 22, 2010 16:13 |
|
I think you may want to consider checking $? rather than $!. The latter contains errors from C library calls, which do not necessarily indicate that the shell command you issued exited with an error. Use $? to check for a non-zero exit status and/or signal code from a subprocess. I usually do something like this... code:
|
# ? Jul 22, 2010 16:35 |
|
Mario Incandenza posted:which just iterates through bash's $PATH variable so why not cut out the middle-man and do it yourself? I needed to capture output from a load of other commands too though; the gunzip one was just one I was showing as an example. Mario Incandenza posted:IO::Uncompress::Gunzip is a core module, so you don't really need to use gzcat either: Rohaq fucked around with this message at 16:42 on Jul 22, 2010 |
# ? Jul 22, 2010 16:39 |
|
SA Support Robot posted:I think you may want to consider checking $? rather than $!. The latter contains errors from C library calls, which do not necessarily indicate that the shell command you issued exited with an error. Use $? to check for a non-zero exit status and/or signal code from a subprocess.
|
# ? Jul 22, 2010 16:41 |
|
Anyone around here know much about Log4perl? I have a batch processing application that processes thousands of jobs. I want have Log4perl handle all the logging aspects of it. However, since there are thousands of jobs going through it, I want to have a separate log file for each job. And, since groups of jobs can be related to each other, I would like to have the log files for related jobs in the same directory. I was thinking I could accomplish this with categories. When creating the logger I could specify the category as something like 'Jobs.JobType.JobName' and then somewhere (ideally in the config file) go though the work of translating the category into a file path. After pouring over the documentation I still haven't figured out a good way to accomplish this. At first I thought that I could use a perl hook on the filename parameter of the File Appender, but I can't seem to pass the category name into there. I suppose one way to make this work is to manually create a new file appender with the correct filename after each call to get_logger. But it seems that there is a better way to do this I and just haven't found it yet. Any ideas?
|
# ? Jul 29, 2010 08:04 |
|
pmichaud posted:On behalf of the Rakudo and Perl 6 development teams, I'm happy to announce the July 2010 release of "Rakudo Star", a useful and usable distribution of Perl 6. The tarball for the July 2010 release is available from http://github.com/rakudo/star/downloads. From here. Blotto Skorzany fucked around with this message at 20:47 on Jul 29, 2010 |
# ? Jul 29, 2010 20:36 |
|
pmichaud posted:Rakudo Star releases are created on a monthly cycle or as needed in response to important bug fixes or improvements. The next planned release of Rakudo Star will be on August 24, 2010. This is the first I've heard of Rakudo Star being a regular thing. I thought it was a one-shot release, hyped up as something usable to encourage people to finally try Perl 6. Cool, either way, though I wonder how it'll interact with existing monthly releases.
|
# ? Jul 29, 2010 20:42 |
|
So I wrote a quick tool for character frequency analysis, but the characters are in unicode; any tips of getting special characters to display properly in STDOUT?
|
# ? Jul 29, 2010 23:15 |
|
Tell your terminal to do unicode?
|
# ? Jul 29, 2010 23:21 |
|
Welp, I am retarded. I set my terminal to use unicode, but forgot to change the font to something that supported the characters :P Still some not displaying correctly, but that's not surprising.
|
# ? Jul 29, 2010 23:37 |
|
Rohaq posted:Welp, I am retarded. I set my terminal to use unicode, but forgot to change the font to something that supported the characters :P Still not as bad as the morass that is getting unicode to display properly through putty -> screen -> irssi
|
# ? Jul 29, 2010 23:52 |
|
I recently took up a new job in NYC in one of the city's like... five or so active Perl shops. It's like a vicious cycle! Anyway, I should be back on the Perl grind soon. I'm going to miss Visual Studio...
|
# ? Jul 31, 2010 15:41 |
|
Triple Tech posted:I recently took up a new job in NYC in one of the city's like... five or so active Perl shops. It's like a vicious cycle! Anyway, I should be back on the Perl grind soon. I'm going to miss Visual Studio... Probably took my last job. ;X
|
# ? Jul 31, 2010 16:45 |
|
Fenderbender posted:Probably took my last job. ;X Where did you work and where do you work now?
|
# ? Aug 1, 2010 21:03 |
|
Triple Tech posted:Perl ... miss Visual Studio
|
# ? Aug 1, 2010 21:45 |
|
Filburt Shellbach posted:This is the first I've heard of Rakudo Star being a regular thing. I thought it was a one-shot release, hyped up as something usable to encourage people to finally try Perl 6. Star will eventually peter out to something like quarterly or half yearly releases as it gets more stable and usable, apparently. Monthlies will still be monthlies. I'll just continue to `git pull` regardless
|
# ? Aug 2, 2010 06:57 |
|
TiMBuS posted:Star will eventually peter out to something like quarterly or half yearly releases as it gets more stable and usable, apparently. Monthlies will still be monthlies. Just curious, what is everyone's opinion here of the Perl6 situation? Anyone have any real expectations to move major applications to it? I wrote off Perl6 long ago. I believe it was an enormous mistake to basically set Perl adrift to chase down the whole Parrot project. I won't even consider using Perl6 until there are stable packages in enterprise Linux distros, and even then I'll hold off until I see reputable reports of its stability/performance in business-critical production scenarios. While many interpreted languages were evolving and embraced the rise of web applications, Perl's developers veered off into the weeds. They all but destroyed Perl as a product. It will take a lot to win me over again.
|
# ? Aug 2, 2010 17:04 |
|
I think Perl6 itself won't be making any converts in business, but once a web framework project gets to a stable level and a few evangelists and success stories get out there, there will probably be a slow shift to it.
|
# ? Aug 2, 2010 18:37 |
|
SA Support Robot posted:Just curious, what is everyone's opinion here of the Perl6 situation? Anyone have any real expectations to move major applications to it? I'm kind of with you on this one. While Perl6 has been slowly (slowly) gestating, everything else has moved forward relentlessly, usually in an iterative, steadily-improving manner. Much of what we might want from it is now served to us from competing technologies that we've elected to make use of in the meantime. We still actively use Perl5 (and will for the foreseeable future), and develop new systems with it, but we'd absolutely not go to Perl6 (in my opinion, though I'm not the person that'd be making that sort of decision) 'just because'. Any changes we make to our infrastructure go through as much analysis, review, and testing as developmental changes, and with a massive legacy codebase we'd probably be hard pushed to justify shunting to Perl6 runtime. And for new-build? Well where Perl in general fits, Perl5 already fits, and for other cases, we already have an established use of alternate technologies (with their own extant codebases, system of support, processes, etc, etc).
|
# ? Aug 2, 2010 18:54 |
|
I think 6 will be pretty popular eventually, but I don't think it will be pulling the majority of its users from the current Perl userbase, much of which has moved on to Ruby or become skeptical of 6 and decided to reinvigorate Perl 5 instead (cf. backported 6 features in 5.10 and 5.12, the move to a faster and regular release schedule instead of the insane time gap between 5.8 and 5.10, myriad cultural shifts, the rise of Moose (itself a mixture of cultural elements and poo poo robbed from 6, CLOS and everything else that wasn't nailed down), etc). In retrospect I think a cleanup and regularization of Perl 5 would have been a great Perl 6 in 2003 or 2004, with the current supercalifragilisticexpialidocious spec being a great Perl 7 or 8.
Blotto Skorzany fucked around with this message at 20:05 on Aug 2, 2010 |
# ? Aug 2, 2010 20:01 |
|
SA Support Robot posted:Just curious, what is everyone's opinion here of the Perl6 situation? Anyone have any real expectations to move major applications to it? If you haven't yet, I suggest you try reading this, starting at introduction and working your way down the links on the left: http://perlgeek.de/blog-en/perl-5-to-6/00-intro.writeback I am still sceptical about Perl6 myself, and even some of the changes (since it's getting a LOT more line-noisy), but with what it offers, i also find myself wanting a ton of that poo poo in Perl5. As such, i think that Perl6 has a good chance to be a hella popular language in 20 years. What i find myself wondering though is whether there's an actual chance that this timeframe might be shortened by making a decisive push to port the large parts that make Perl5 useful (CPAN, DBI, just to mention two).
|
# ? Aug 2, 2010 21:15 |
|
I'm working through trying to teach myself perl because it seems without it I have absolutely no hope of ever getting a position in *nix administration. Anyway, I've got a tutorial/book I've been following and I'm working on an exercise where it asks me to make a program to take a number less than 256 and convert it to binary. The hint it gives suggests using the bitwise AND 8 times. What I have so far is: code:
|
# ? Aug 2, 2010 23:28 |
|
4 & 4 is still 4, it is not a boolean operation, it is a bitwise operation! You probably want to do something like !!($dec & 4) or maybe ($dec >> 2) & 1, I am not sure how/if exactly those work.
|
# ? Aug 2, 2010 23:36 |
|
Vanadium posted:4 & 4 is still 4, it is not a boolean operation, it is a bitwise operation! You probably want to do something like !!($dec & 4) or maybe ($dec >> 2) & 1, I am not sure how/if exactly those work. Well, I managed to figure it out in the ugliest way possible. I'm now doing ($dec&4)/4 which gives me the correct answer but I feel like there's got to be a better way. edit: The tutorial mentioned >> but I can't imagine that would be the solution because it wasn't fulled explained. In the first one are you basically saying (not)(not)($dec&4) or is !! somehow different? Doug fucked around with this message at 23:49 on Aug 2, 2010 |
# ? Aug 2, 2010 23:42 |
|
Yeah, not not.
|
# ? Aug 2, 2010 23:56 |
|
Doug posted:Well, I managed to figure it out in the ugliest way possible. I'm now doing ($dec&4)/4 which gives me the correct answer but I feel like there's got to be a better way. This is more a bitwise arithmetic question than a perl question; iirc this is an exercise that dates all the way back to K&R's The C Programming Language, so googling for answers should be pretty fruitful if you need to (C has the same bitwise operators as Perl, indeed it's where Perl got them from).
|
# ? Aug 3, 2010 00:43 |
|
Otto Skorzeny posted:This is more a bitwise arithmetic question than a perl question; iirc this is an exercise that dates all the way back to K&R's The C Programming Language, so googling for answers should be pretty fruitful if you need to (C has the same bitwise operators as Perl, indeed it's where Perl got them from). This. Also you might want to build the string in a loop. And here are a few examples of how you might get your "1" or "0": $s .= (1 == 2) ? "1" : "0"; $s .= sprintf("%u", (1 != 3)); $s .= 0 + (1 == 5); These statements make good Perl exercises on their own, since they will make you think about how Perl scalars behave in various contexts.
|
# ? Aug 3, 2010 01:23 |
|
If you want to get fancy, you can also use pack and unpack. print unpack('B*', pack('C', $dec)), "\n";
|
# ? Aug 3, 2010 01:41 |
|
I'm not exactly sure what features Perl6 even has, but it's poised in my head as "The Jesus Language". Whatever killer feature other languages have, Perl6 needs to have. Or, if Perl6 already has it, people just need to be educated about it. The only killer things I can think of are... * Low barrier parallelization (threads, cores, etc) * ORM * Client-side collection querying (like LINQ) * Web MVC framework (yawn) Once those spaces have matured (for any language, really), I'm not really sure what's left to do.
|
# ? Aug 4, 2010 14:46 |
|
One of the big Perl 6 features people have been talking about recently is Rules, composable elements by which one can make a legitimate parser for a grammar about as easily as one can halfass it with a regex in Perl 5. Taking off my skeptic's hat for a moment, there really are a million cool things that you can around for if you have a free hour or so.
|
# ? Aug 4, 2010 21:43 |
|
Triple Tech posted:* ORM These all should be completely separate from Perl. If Perl6 ever included such things or even advocated them as best practice, that would be the point for me where Perl became too pushy. It's already bad enough that Perl6 looks like Damion Conway ejaculated all over it.
|
# ? Aug 5, 2010 17:47 |
|
SA Support Robot posted:It's already bad enough that Perl6 looks like Damion Conway ejaculated all over it.
|
# ? Aug 5, 2010 19:51 |
|
I conflated Perl6 core with its ecosystem. I agree ORM and MVC needn't be core, but client-side querying and parallelization would get a huge boost if they were much closer to the native constructs of the language. Otherwise it'd be another Moose-type project and who needs that. Just make it core.
|
# ? Aug 5, 2010 20:53 |
|
SA Support Robot posted:Just curious, what is everyone's opinion here of the Perl6 situation? Anyone have any real expectations to move major applications to it? Parrot could also be a drat cool thing but the support from other languages isn't quite there. The way I saw it was that it was a CLR like .NET, where Perl 6 would be the C# that pushes it along. Fine and dandy, except that took waaay too long. They were prototyping Perl 6 using Haskell because Parrot couldn't keep up. My fantasy with Parrot that didn't pan out was that I could link it in to a program written in, say, C++, and incorporate Parrot as it's scripting engine. Then people could use in whatever scripting language they felt like, so long as it compiled to Parrot's byte code. Except that the compilers for the more interesting languages aren't there. That being said, everybody's got their own little VM prototype thingie for Parrot. I guess it's a fun project for people that like to toy with VMs and creating their own toy languages. More power to them--maybe I'll make one called "Python with curly braces and data types." I am trying to love array references but it's an abusive relationship. I try to pass arrays in as an argument to some subroutines for processing, and it's one argument of many, so I send it in as a reference. My rule of thumb has been to shift it into a temporary variable like "$directories_ref" then cast to "@directories" using @{ $directories_ref } so that I can then treat it like something sane. Is there something notationally clean that avoids those steps?
|
# ? Aug 6, 2010 07:03 |
|
Rocko Bonaparte posted:They were prototyping Perl 6 using Haskell because Parrot couldn't keep up.
|
# ? Aug 6, 2010 08:09 |
|
You can consume it directly or use more concise notation.code:
|
# ? Aug 6, 2010 14:39 |
|
Mithaldu posted:From reading stuff about that part of Perl 6 history that is not what happened. It was more that a certain hacker just picked it up *because* and managed to generate a shitton of momentum because of her own personality and work style. Then when she went away it collapsed, proving further that Haskell was irrelevant and it was about her. That's not quite how Pugs went down, but yeah it was developed at breakneck speed because audreyt is basically a human tornado, and when she got ill for a while none of the other lambdacamels were able to pick it up since they lacked the whirlwind nature. Haskell was a pretty awesome choice for implementation language though.
|
# ? Aug 6, 2010 20:34 |
|
|
# ? Apr 26, 2024 12:19 |
|
Mithaldu posted:From reading stuff about that part of Perl 6 history that is not what happened. It was more that a certain hacker just picked it up *because* and managed to generate a shitton of momentum because of her own personality and work style. Then when she went away it collapsed, proving further that Haskell was irrelevant and it was about her.
|
# ? Aug 7, 2010 06:09 |