Thursday, August 16, 2012
lc, uc, and ucfirst
Have to say with trying to work with data that is from users, working with lc(), uc(), and ucfirst() makes things easy. I was working with some user input that some times people with upper case things and some times they will not. I know that I could match regardless of case, but I really like just doing that extra check, and step of making sure that I convert every thing to lower case and work on the data then if needed to just use the ucfirst where needed. I am not working on any thing with proper nouns or names so no worry about making sure of this.
Tuesday, August 14, 2012
WWW-Mechanize
If you have to work with page that you need to save your session cookies to scrape a web page and/or work with lots of forms WWW-Mechanize works really well. One thing that I have found that I really like about it is that I can use it from a shell like like this "perl -MWWW::Mechanize::Shell -eshell". You can then work with the site that you are needing to do your task on and just export every thing that you have done and "script myscriptname.pl" and then you have a Perl script "myscripname.pl" that you can call to do the same steps over and over again. Most of the time I just use that script file as a sub for my main code in the end. This has become a tool that is all ways on my belt of really nice Perl modules.
Subscribe to:
Comments (Atom)