Skip Menu |

This queue is for tickets about the Linux-Distribution CPAN distribution.

Report information
The Basics
Id: 97638
Status: resolved
Priority: 0/
Queue: Linux-Distribution

People
Owner: Nobody in particular
Requestors: PTROST [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.21
Fixed in: 0.22



Subject: version for CentOS 7 returns undef
[ptrost@server linux-geek]$ perl use warnings; use strict; use Linux::Distribution; my $linux = Linux::Distribution->new; my $distro = ucfirst $linux->distribution_name(); my $version = $linux->distribution_version(); print "Distro: $distro, Version: $version\n"; On CentOS: Use of uninitialized value $version in concatenation (.) or string at - line 7. Distro: Centos, Version: On ubuntu: Distro: Ubuntu, Version: 14.04 The issue is that on CentOS 7 the file /etc/centos-release has 'Core' instead of 'Final', so the regex pattern isn't matching: CentOS Linux release 7.0.1406 (Core) 'centos' => '^CentOS(?: Linux)? release (.+)(?:\s\(Final\))', Adding an pipe with Core solved it for me: 'centos' => '^CentOS(?: Linux)? release (.+)(?:\s(\(Final\))|\(Core\))', Interestingly, there's extra spaces at the end of the stock /etc/centos-release file, so I also had to trim the version output. Post change: print "Distro: $distro, Version: $version\n"; Distro: Centos, Version: 7.0.1406
On Wed Jul 30 19:59:34 2014, PTROST wrote: Show quoted text
> On CentOS: > Use of uninitialized value $version in concatenation (.) or string at > - line 7. > Distro: Centos, Version:
Thanks for the report, I fixed this in https://github.com/chorny/Linux-Distribution/commit/e1c948988f54d9be8c70ad9079cf748dcfa33667 there is no new release on CPAN yet. I asked CHORNY to make one, I don't have PAUSE permissions but I can push to the git repo. -- Mike