oylenshpeegul
- Website: oylenshpeegul.typepad.com/
Recent Actions
-
Commented on fresh perlbrew sugar
You should have mentioned that we can run perlbrew self-upgrade to get it. We're too lazy to run perlbrew help! :)...
-
Commented on Q: When not to use Regexp? A: HTML parsing
I've had good luck with Mojo::DOM, which handles both HTML and XML in a relaxed manner. Here is a tiny example....
-
Commented on You're Wrong!
Sorry. What I said was, "it seems a bit disingenuous to claim the autoboxed thing looks better than the alternative when you're not being honest about the alternative." What I meant was that given A: $string->split(" ")->reverse->join(" ")->say; B: say...
-
Commented on Putting the ideas together, a hands on tutorial of modern Perl
I agree with Mithaldu. I don't think adding a ton of parentheses adds clarity at all; it just adds a ton of parentheses. His version isn't just shorter, it's easier to both read and write. It seems a bit disingenuous...
-
Commented on Kickin' it old school
Neat! I did Nicomachus. I moved the "yes or no" logic into a subroutine and re-used it for the "try another". Otherwise, I guess we'd have to hit C-c to exit. #!/usr/bin/env perl # http://www.atariarchives.org/basicgames/showpage.php?page=117 use v5.12; use warnings; use...
-
Commented on Got 20 minutes? WWW::xkcd is born!
And you ought to use 313 as the example in the man page!...
-
Commented on Got 20 minutes? WWW::xkcd is born!
Nice! Now when someone sends you an xkcd cartoon without the mouseover text, you can fetch it with a Perl one-liner! perl -MWWW::xkcd -E 'say WWW::xkcd->new->fetch_metadata->{alt}'...
-
Commented on Announcing Text::AsciiTeX
Instead of an array reference, how about returning an array of lines in list context and joining the lines in scalar context? We could even just print the lines in void context (fork on github)....
-
Commented on Which Marpa distribution to use?
Yes, I came here to make the same comment, only using CSV as an example....
-
Commented on CPAN modules for generating passwords
It's probably worth mentioning that (as you might expect from a module in the App namespace) App::Genpass comes with the genpass application as well. $ genpass N9bzGpcmiA...
-
Commented on And the fastest OO accessor is...
Perl 5.21? I am so out of date!...
-
Commented on Perl Feature Request, or am I missing something?
How about using magic to guess the file type and then adding an appropriate IO layer? use File::LibMagic qw(:easy); my $layer = MagicFile($file) ~~ /\bCRLF\b/ ? ':crlf' : ''; open my $fh, "<$layer", $file; Then chomp just works normally....
-
Commented on The Oft-Overlooked and the Sometimes-Neverused
Recently, I was raving about do-given in the upcoming Perl 5.14 and I was surprised at how many of my coworkers never use do....
-
Commented on Listing All Installed Programs in Windows XP
That looks interesting, but I couldn't get Win32::WMIC to install with Strawberry Perl. I am using Strawberry Perl 5.10.1. Trying to install Win32::WMIC resulted in failing test t/query.t ......... 1/? Invalid XSL format (or) file name. # Failed test 'data...
-
Commented on Mangling CPAN with Plack::App::Proxy
Nice! I also had to add cpanm Plack::Handler::Twiggy to get it to work....
-
Commented on Master-Slave 2.0: Replica Sets
Keen! This didn't work with my distribution's MongoDB (1.2), but when I downloaded 1.6 it worked fine....
-
Commented on I ♥ perlbrew
Ha ha! Yeah, I guess you're right, that is shorter. I still prefer the perlbrew solution, though, because after a switch I've not only got the right perl, but also the corresponding perldoc and cpanm and ......
-
Posted I ♥ perlbrew to oylenshpeegul
I love perlbrew! I like to keep the version of Perl that I normally use as up-to-date as possible, but it's nice to keep other versions around for compatibility. Just now, I needed to know when readline got fixed. With perlbrew, it was…
-
Commented on Poll: What is the primary operating system you use for developing Perl applications?
I agree with meraxes...I use Linux RHEL at work, but Linux Ubuntu at home. But unlike meraxes, I voted for the one I use at home, since that's the one where I had a choice in the matter....
-
Commented on Perl 6 Config::INI on Github
The link is broken. It goes Config-Tiny, but apparently you called it Config-INI....
-
Commented on Padre, the Perl IDE
Thanks for your comments! I re-installed the Windows version and ran padre.bat. That started up just as you said and now clicking on Padre starts padre, as expected. The "File Dialog" started up reasonably fast in Windows too. In fact,...
-
Posted Padre, the Perl IDE to oylenshpeegul
I have been using Emacs for decades. I am totally happy with it (indeed, it keeps getting better and better!) and am not looking for another editor. Nonetheless I like to keep abreast of things, so when new tools become available, I like to check them out.
For a while now, I have been hear…
Comment Threads
-
Aristotle commented on
Q: When not to use Regexp? A: HTML parsing
Usually you do not care about the structure of the whole HTML page but only the part you are interested in. The simplest way to identify that part is to match it with regexps, not by walking down a syntax tree.
I don’t know what you are trying to do but last I tried, I found it far easier to locate a tag on an HTML page with a CSS selector than to laboriously match out the text with a pattern (not to mention having to manually handle charsets, unescaping etc. in that case). Even XPath is still a lot easier.
Are you using a DOM and manually walking it with …
-
Ed Avis commented on
Q: When not to use Regexp? A: HTML parsing
Yes, I have sometimes found it easier to use HTML::TableExtract or other modules which truly parse the HTML and walk over its structure. It depends on how well-structured the page is and what you are trying to extract. A CSS selector is a nice declarative approach, and as long as you are matching based on particular attributes rather than 'the third row in the fourth table', you will be fairly robust against minor layout changes.
That said, a regexp approach can be declarative too. Because you can start by taking an example of the HTML you want to match and adding placeholders, it…
- Brad Gilbert commented on Q: When not to use Regexp? A: HTML parsing
-
Aristotle commented on
Q: When not to use Regexp? A: HTML parsing
Yes, that is what the link to “the cthulhu way” points to.
-
Aristotle commented on
Q: When not to use Regexp? A: HTML parsing
Because you can start by taking an example of the HTML you want to match and adding placeholders, it is immediately clear what HTML structure is matched - as long as you keep your regexp nicely formatted and commented using /x.
No amount of
/x
will make regexps look less messy than a CSS selector. Aside from that, the regexp will break not only when the layout breaks, but for even the most minor variation, such as the quotes around an attribute changing from double to single, or being removed altogether; the order of attributes changing; a comment being…
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.