summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2016-04-03 16:00:35 -0700
committerSean Whitton <spwhitton@spwhitton.name>2016-04-03 16:00:35 -0700
commit8ec11811b7c90bf465b08a426dd8187f6795dfe8 (patch)
tree3a9268b9597ae9b1d0622eae91d9884d05da84ea /lib
parent9b67c0ff6383289fc14cca71896d4ddd1f4ac1e6 (diff)
use "better" file IO when finding homepage
Diffstat (limited to 'lib')
-rw-r--r--lib/DhMakeELPA/Command/Packaging.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm
index c2a08df..11c6da6 100644
--- a/lib/DhMakeELPA/Command/Packaging.pm
+++ b/lib/DhMakeELPA/Command/Packaging.pm
@@ -28,16 +28,17 @@ sub extract_basic {
# of the binary package with the shortest name, then the second
# shortest etc. This might leave $self->homepage undefined
foreach my $bin (sort {length($a) <=> length($b)} keys %{$self->bins}) {
- # TODO rewrite using $self->_file_r ?
- my $fh;
- open $fh, '<', $self->main_dir . "/$bin.el";
- while (<$fh>) {
- if (/^;; URL: /) {
+ my $fh = $self->_file_r( $self->main_file("$bin.el") );
+ while (my $line = $fh->getline()) {
+ if ($line =~ /^;; URL: /) {
$self->homepage($');
last;
}
}
- close $fh;
+ $fh->close;
+ if (defined $self->homepage) {
+ last;
+ }
}
}