user-pic

Marco Fontani

  • About: Slicing and splicing onions
  • Commented on 10 Years of Attending Perl Events
    YAPC::EU 2010 was in Pisa...
  • Posted Dancing on a cloud made of pearls to Marco Fontani

    Thanks to a post on Hacker News, I got access to the beta test for DotCloud.…

  • Commented on Show Perl subname in vim statusline
    Or just rotate the monitor vertically; works ;)...
  • Commented on Inline::C optimizations
    Thanks for your comment, Illusori. Nothing's wrong with the hash lookup at all: I can't believe I had not thought of it at the time. Thanks for the suggestion of using the defined and undefined sections of a lookup array:...
  • Posted Inline::C optimizations to Marco Fontani

    At the last (first, actually) Glasgow.pm meeting last week, I mentioned to a couple of the people present an instance in which I've used the wonderful Inline::C module to replace a chunk of Perl code…

  • Posted Resurrecting Glasgow.pm to Marco Fontani

    During YAPC::EU mst suggested "why don't you just start Glasgow.pm?"

    I talked about it a bit with a friend who'll be back in the country soon enough and even today at work, and I think we may have enough people to kickstart the new Perl mongers group.

    I know there are several busin…

  • Commented on When Perl Met Android
    Hope the talk gets accepted, and look forward to it at the YAPC::EU in Pisa! As an Italian living abroad, I would suggest you book your flights sooner rather than later, as the flight prices to Pisa tend to go...
  • Posted SproutCore and Tatsumaki to Marco Fontani

    I added a Perl backend version of the SproutCore tutorial to the wiki. It was useful to see how Tatsumaki (the new framework by Tatsushiko Miyagawa) worked, and also because PSGI is quite fun to use!

  • Posted Is that perl 5.12 on your netbook? to Marco Fontani

    OH YEAH!

    Just finished installing the brand spanking new Perl 5.12 on the netbook on my "perl" account, with which I tested already earlier -RC releases with my personal code.

    It's fair to say that the user experience has gone a long way from the "old days" of manual configuration,…

  • Posted Google Talk with Perl to Marco Fontani

    I was looking for a way to send a Google Talk message (via Perl) whenever a certain something occurs, and thought it'd be a simple task since Google Talk uses the Jabber protocol, XMPP and all that.

    Boy was I wrong.

    I found some code on the 'net which used Net::XMPP::Client to crea…

  • Posted Cloud laziness part 1: creating a CloudServers server instance to Marco Fontani

    The following is ongoing on my private branch of the CPAN dist Net::RackSpace::CloudServers, in which I'm creating an App::Cmd interface to the module:

    okram@bluedesk:…
  • Posted Git - inhibit commit if modules don't compile to Marco Fontani
    Sometimes I forget to run Perl base tests for my modules, before committing changes. As to what happens, I end up committing something that doesn't quite compile ;) Luckily Git has a pre-commit hook one can use to run at least the "compile" tests. The following aborts the commit if the t/00*.t test…
  • Posted CloudServers Perl module - 0.09_10 to Marco Fontani

    perl -E'say join " ", reverse world, hello' # :)

    I've finally found some time to play again with the Rackspace API manual, and added a couple features to the Net-RackSpace-CloudServers module I hadn't to…

Subscribe to feed Recent Actions from Marco Fontani

  • Fernando commented on Show Perl subname in vim statusline

    Uh, double comment above, you may remove one.

    Corrections after having used this a bit:

    b:did_perl_statusline

    makes the variable local to the buffer instead of g: which is global

    my $line_number = ($curwin->Cursor)[0];
    
    my $line = '';
    $line = $curbuf->Get( $line_number )
        while $line_number-- > 0 && $line !~ /^\s*sub\s+(\w+)\b/;
    
    my $sub_name = $1 || '(not in sub)';
    VIM::DoCommand("let subName='$sub_name'");

    I do believe this is faster than getting all lines for each cursor movement :)

  • Marcel Grünauer commented on Show Perl subname in vim statusline

    Here's a function that determines the name of the current sub in much the same way, but it's in Vim script, so it works even if you don't have Perl embedded in Vim:

    
    function! PerlCurrentSubName()
        let s:currline = line('.')
        let s:currcol = col('.')
        normal $
        let [s:line, s:column] = searchpos('^\s*sub\s\+\zs\(\w\+\)','bcW')
        if (s:line != 0)
            let s:subname = expand('')
            call cursor(s:currline, s:currcol)
            return s:subname
        else
            return '(not in sub)'
        endif
    endfunction
    
  • Marcel Grünauer commented on Show Perl subname in vim statusline

    Actually, in this function we need to call cursor() even if there was no match, because "normal $" would insist on always keeping the cursor on the end of the line...

    
    function! PerlCurrentSubName()
        let s:currline = line('.')
        let s:currcol = col('.')
        normal $ 
        let [s:line, s:column] = searchpos('^\s*sub\s\+\zs\(\w\+\)','bcW')
        if (s:line != 0)
            let s:subname = expand('')
        else
            let s:subname = '(not in sub)'
        endif
        call cursor(s:currline, s:currcol)
        return s:subname
    endfunction
    
    

    There may be a better way of doing this witho…

  • Andrew commented on Show Perl subname in vim statusline

    I played with your script for about an hour and made an improvement. This will display 'N/A' if you're outside the subroutine. If you have a history of your closing brace indent not matching your sub declaration indent you may want to alter the $indent portion. Have fun!

    .vimrc
    
    syntax on
    setlocal laststatus=2
    setlocal statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}%h\ \ \ Position:\ %p%%\ %l/%L,%c
    if has("autocmd")
        autocmd BufReadPost * if &syntax == 'perl' | source ~/.vim/perl_current_subroutine | endif
    endif
    



    .vim…

  • john napiorkowski commented on 10 Years of Attending Perl Events

    Such a wonderful anniversary to have!

Subscribe to feed Responses to Comments from Marco Fontani

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.