user-pic

smash

  • About: I blog about Perl.
  • Posted Portuguese Perl Workshop 2013 to smash

    The Portuguese Perl Workshop is back, the event will be held on October 9th and 10th in Lisbon, Portugal. Featuring Dancer2 training class with Alexis Sukrieh, and AnyEvent and Coro GreenThreads Tutorials with Pedro…

  • Posted Portuguese Perl Workshop 2012 to smash

    The Portuguese Perl Workshop is back, the event will be held on September 28th in Braga, Portugal.

    Check the workshop website for more information.

  • Posted Portuguese Perl Workshop 2011 to smash

    The Portuguese Perl Workshop is back. This year's event will be held in the 22nd and 23rd of September in sunny Lisbon, where the grass is green and the girls are pretty.

    Check the official site for details.

  • Posted OpenCert 2010 to smash

    This weekend I gave a presentation at OpenCert 2010 about the Perl testing ecosystem, this was an article I wrote with ambs++ and jjoao++. The article can be found on the conference site

  • Posted Begin at the BEGIN and go on till you come to the END: then stop. to smash

    In Perl we can run user defined code blocks at different stages when running a program.

    1. BEGIN blocks are run as soon as Perl finds them. If there is more than one block they get executed in the order they are found.
    2. CHECK blocks are run as s…
  • Posted Perl6 modules in Rakudo baby-steps, part 1 to smash

    Here is an example of what a module can look like. In this case it only has a simple method that greets the user:

    class Greeter;
    
    

    method greet($name = 'world') {
    say "hello $name";
    }


    Now to use the module we can write something like:

    BEGIN…
  • Posted fork'ing your world to smash

    The fork function is a very powerful tool used among many languages. Unfortunately It's not that common among Perl scripts, maybe because most scripts don't really have a need for it. But it's a handy trick to keep inside your hat.

    Fork creates a new process running the same program, usual…

  • Posted Watching directories for new files to smash

    Linux::Inotify2 is great for detecting newly created files in a directory. You can watch a directory by simply using:

    use Linux::Inotify2;
    
    

    my $inotify = new Linux::Inotify2;

    $inotify->watch…

  • Posted one liner history command counter to smash

    Wondering what commands you use the most, try this one liner:

    $ history | perl -ne 'END { map {print ++$i.": $_\n";} splice(@{[sort {$h{$b}<=>$h{$a}} (keys %h)]},0,5); } m/\s+\d+\s+(.*)/; $h{$1}++;'

    In one of the servers I use I got:

    1: ls
    2: fg
    3: cd ..
    4: sudo tail …
  • Commented on Memcached to the rescue
    That particular module was used just as an example. Of course any other module can be used for similar approaches being CHI::Driver::Memcached a good candidate....
  • Posted Memcached to the rescue to smash

    Everyday the Internet becomes faster, and everyday new and more complex content is provided via web applications. The problem is that sometimes (maybe most of the times) these rich and complex content applications aren't fast enough to answer big flows of requests. One trick that is often used to…

  • Posted grep is your friend to smash

    Grep is another Perl's great built in function, one of the things I use it most is to check if I can find an element on a list. For example, instead of something like

        my $found = 0;
        foreach (@list) {
            $search eq $_ and $found++;
        }
    


    I prefer to use som…

  • Posted Perl shebang for different versions to smash

    In a Perl script typically a shebang line is something like:

    #!/usr/bin/perl


    this works great if you want to use a wide, system based, Perl for your scripts. But what if you have several different installations of Perl and want to run the same script using different Perl…

  • Posted Portuguese Perl Workshop 2010 Last Call to smash

    We are a few days away from the Portuguese Perl Workshop. We still have some spots left for the training sessions and are still accepting presentations submissions. Workshop official website here.

  • Posted Portuguese Perl Workshop 2010 to smash

    The Portuguese Perl Workshop is back. This year's event will be held in the 4th and 5th of June in Porto. Check the official site for details.

Subscribe to feed Recent Actions from smash

  • fifo11 commented on Memcached to the rescue
  • Shantanu Bhadoria commented on Memcached to the rescue

    Here is the problem that I see with these caching solutions. Why write so much code to retrieve one cached value???

    my $content = $cache->get($key);
    unless ($content) {
    process_request();
    $cache->store($key, $content);
    }
    $content = $cache->get($key);

    5 lines to get one value!! Ouch!!

    I think we should have some thing on the lines of
    $result = $cache->get(subroutine(),ttl=>5 );

    The name 'subroutine()' itself should be stored as the key, and every time the ttl expires for the sub the subroutine should…

Subscribe to feed Responses to Comments from smash

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.