A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Git set upstream

git branch --set-upstream-to

Or in later versions:

git branch --set-upstream

Thanks

Automatically generated diagrams of Perl code


  • Use UML::Sequence to diagram your method calls - Looks cool but couldn't get the module's tests to pass.
  • Write your own code to produce a Graphviz spec file - Good choice if you want a data structure diagrammed, e.g. State transitions.
  • SchemaSpy works well for database tables.
Untried:
  • UML::Class::Simple - class diagrams, not methods?
  • Devel::Diagram - class diagrams, not methods?
  • Devel::DProfPP

How are my Perl modules being loaded?

Large legacy system?
Confused about how your modules are being loaded?
Getting errors because they are loaded in the wrong order?

Try Devel::TraceUse

Emacs for a vi user

In the past I've exclusively used vi, but now I want to use Emacs as I've heard it has some useful modes, for example 'font-lock-keywords' mode which is one way to easily highlight certain keywords in a program's console output. I don't want to mess around compiling specialised text highlighting programs, and they're not in my standard repos. Emacs is much more likely to already be available wherever I need it.

Emacs commands:
  • To exit: C-x C-c
  • Turn on syntax highlighting: M-x font-lock-mode

Key:
C = Ctrl
M = Meta (Alt)

Thanks to the rest of the web

UPDATE: It turns out font-lock-keywords can easily be implemented in a 3 line bash script. Call it "highlight":

    # Usage: tail -f error.log | highlight "error"
    RED="$(tput setaf 1)"
    RESET="$(tput setaf 7)"
    sed "s/$1/$RED$1$RESET/"

But I would still like to see the Perl debugger integrated into Emacs

Colouring terminal output


Thanks to StackOverflow

UPDATE: You can actually do this yourself with pretty much any programming language that has an ANSI colours library.