Sunday, June 22. 2008Functions vs. inline code
Recently I had a little discussion about our style guide with one of the co-workers. And the matter was concerning the line length. Most default is to limit the line length with 79-85 characters - because of terminals, printing etc. But an other question took my head in the middle of the conversation: limiting the line length would mean for example to encapsulate deep included blocks of the code into functions - sounds not bad, but ...
Continue reading "Functions vs. inline code" Saturday, March 8. 2008Map objects recursive in perl
One interesting thing I've got stucked on - if we have some multilevel arrays/hashes (which aren't the same in perl), there is no standard way to change all the object's values. The only thing I've found usefull is map function, which nevertheless works only for map arrays. However, it could be very usefull, to have a possibility to change each scalar element of some multilevel object. For example, if you ever used XML::Simple, you could observe the following behavior with values, which contain new lines.
XML: <root> <elem>asdf</elem> </root> Continue reading "Map objects recursive in perl" Sunday, December 23. 2007I know the future weather
A simply and cool script for the weather forecast. May be even correct
.. thanks to Weather::Underground perl module PERL: #!/usr/bin/perl use Weather::Underground; Continue reading "I know the future weather" Stop image hotlinking with Perl
Sometimes there are things, which can bring everyone to the rage accumulation. For example if traffic of the server is exceeded because of hotlinking and it's measured at least in hundreds of megabytes. | So, for me this is only a story about someone else because I'm always using the following script, if the traffic of the server is not unlimited. I've used Perl to convert or resize images, because according my measurements Perl was doing this at least twice as fast as PHP and more qualitatively as PHP (this concerns anyhow PHP4). Only the one weakness can prevent you from using this script - it works with HTTP_REFERER server variable and since some browsers, firewalls or proxies for any reasons don't sending this field to the webserver, you can punish innocent people, who want only to see your images. But the advantages are evident - you can place your images out of the web space and show them only if they has been called from your web site. Lets go on.
Continue reading "Stop image hotlinking with Perl"
(Page 1 of 1, totaling 4 entries)
|
CategoriesQuicksearchArchives |