Skip to content

Instantly share code, notes, and snippets.

@broquaint
Created January 20, 2010 16:25
Show Gist options
  • Save broquaint/281973 to your computer and use it in GitHub Desktop.
Save broquaint/281973 to your computer and use it in GitHub Desktop.
class Gitalist::Git::Repository {
...
use if $^O ne 'MSWin32', 'I18N::Langinfo', => qw/langinfo CODESET/;
BEGIN {
no strict 'subs';
*__owner = defined &langinfo
? method { map { decode(langinfo(CODESET), $_) } (getpwuid $self->path->stat->uid)[6,0] }
: method { return qw/OwnEr GroUp/ }
;
}
...
method _build_owner {
my ($gecos, $name) = $self->__owner;
$gecos =~ s/,+$//;
return length($gecos) ? $gecos : $name;
}
...
}
# Can't locate object method "__owner" via package "Gitalist::Git::Repository" at
C:\dev\code\perl\Gitalist\blib\lib/Gitalist/Git/Repository.pm line 255.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment