user-pic

wickline

  • About: hmmm
  • Commented on Look @this_job twitter feed
    and if twitter's non-standard rss feed fails for you, try this scrubbed version: http://wickline.org/bird_bath/...
  • Posted duct tape to wickline

    Folks used to refer to perl as 'the duct tape of the internet'. It still totally is.

    I've started posting perl (and other) portland and/or telecommute jobs on twitter. I thought I'd also include these tweets in the 2pdx.com LinkedIn group. LI supports rss feed inclusion in the news for the…

  • Posted Look @this_job twitter feed to wickline

    I claimed a while ago that I maintained a list of pdx and telecommute jobs of potential interest to folks I know who are looking for new gigs. Well, I suck at maintaining that list. I'm going to try to make it easier to maintain by re-inventing the page as a twitter feed. The idea is that it is…

  • Posted orphaned public key to wickline

    So, I thought I'd contribute to moose.

    A week ago I joined #moose and nopasted a public key. Cats and kids jumped all over me and I didn't follow through. In the end, I think that nobody acted on that. Today I thought I'd get back to that while the kids were out of the house. I still had t…

  • Commented on whack-a-mole
    I wasn't aware of ProhibitExcessComplexity or the McCabe score, so thanks for the reference. Looking at the source for Perl/Critic/Utils/McCabe.pm, I can tell you that they're not measuring the same things, but the two scores are probably likely to correlate...
  • Posted whack-a-mole to wickline

    find the perl subroutine most in need of refactoring

    fix it

    repeat... virtuous whack-a-mole with https://github.com/wickline/whack

  • Posted Get a job to wickline

    I've started maintaining a list of interesting-looking jobs. You'll find mostly perl jobs here (with a pinch of ruby, python, and maybe even php). The jobs will tend to be telecommute, PDX, or "we will relocate you" jobs.

    http://wickline.org/jobs.htm…

  • Posted Job Hunting to wickline

    They say you should write what you know. Lately I've spent some time exploring the job market. I've been doing this to some extent for years as I worked to recruit new employees to Rentrak. In the past year, I've seen the volume of open positions explode as the economy starts to recover. This has…

  • Posted Old Job to wickline

    Perhaps "old job" isn't entirely accurate as I'm still working there for another week and change. I guess "current job" is more appropriate.

    Ron Savage asked what that job was. Well, I'm happy to share that. I'm working at Rentrak. Yes, ="http://www.rentrak.com/section/corporate/car…

  • Posted First Post to wickline

    I gave notice at my old job this weekend. It's a time of change. Perhaps one of the changes will be that I blog. Time will tell.

  • Commented on Show Perl subname in vim statusline
    from the snarky-but-true dept... Alternatively, use short enough subs that you can always see the sub name when editing the sub (and manually correct any files which don't fit this convention)....
Subscribe to feed Recent Actions from wickline

  • Fernando commented on Show Perl subname in vim statusline

    From the bike-shedding department, the lines:

     

      my @document = map { $curbuf->Get($_) } 0 .. $curbuf->Count;
      my ( $line_number, $column  ) = $curwin->Cursor;
    

     

    could become:

     

      my ( $line_number, $column  ) = $curwin->Cursor;
      $line = $curbuf->Get($line_number--)
        while $line_number >=0 && !/^\s* sub \s+ (\w+)/x;
    

     

    .. so you can avoid ->Get-ting all 8k lines when you need "only" 200 ;)

  • 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…

Subscribe to feed Responses to Comments from wickline

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.