New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cpanfile #26

Open
wants to merge 5 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@1nickt

1nickt commented Oct 18, 2017

Add a cpanfile to manage dependencies.

[594] ► perlbrew use 5.26.1t

[595] ► perl -Mthreads -E 1

[596] ► cpanfile-dump cpanfile
Time::HiRes
Tk
WWW::Mechanize
XML::LibXML

[597] ► perlbrew use 5.26.1c

[598] ► perl -Mthreads -E 1
This Perl not built to support threads
Compilation failed in require.
BEGIN failed--compilation aborted.

[599] ► cpanfile-dump cpanfile
MCE::Hobo
MCE::Shared
Time::HiRes
Tk
WWW::Mechanize
XML::LibXML
@1nickt

This comment has been minimized.

Show comment
Hide comment
@1nickt

1nickt Oct 18, 2017

@choroba I wanted to use an eval to test whether the perl is threaded, as I am not sure that the string has always been or always will be the same, but I could not get the check to work right when under Perlbrew:

[685] ► perl -Mthreads -E 1

[686] ► cat cpanfile 
use feature 'say';
say $];
say eval { require 'threads'; 1 } ? 1 : 0;
__END__

[687] ► cpanfile-dump cpanfile 
5.022001
0

[688] ► which cpanfile-dump 
/home/nick/perl5/perlbrew/perls/perl-5.26.1t/bin/cpanfile-dump

[689] ► /home/nick/perl5/perlbrew/perls/perl-5.26.1t/bin/cpanfile-dump cpanfile 
5.026001
0

# WTF?

1nickt commented Oct 18, 2017

@choroba I wanted to use an eval to test whether the perl is threaded, as I am not sure that the string has always been or always will be the same, but I could not get the check to work right when under Perlbrew:

[685] ► perl -Mthreads -E 1

[686] ► cat cpanfile 
use feature 'say';
say $];
say eval { require 'threads'; 1 } ? 1 : 0;
__END__

[687] ► cpanfile-dump cpanfile 
5.022001
0

[688] ► which cpanfile-dump 
/home/nick/perl5/perlbrew/perls/perl-5.26.1t/bin/cpanfile-dump

[689] ► /home/nick/perl5/perlbrew/perls/perl-5.26.1t/bin/cpanfile-dump cpanfile 
5.026001
0

# WTF?
@marioroy

This comment has been minimized.

Show comment
Hide comment
@marioroy

marioroy Oct 18, 2017

@1nickt, another way.

my $has_threads;

BEGIN {
    eval 'use threads';
    $has_threads = $INC{'threads.pm'} ? 1 : 0;
}

marioroy commented Oct 18, 2017

@1nickt, another way.

my $has_threads;

BEGIN {
    eval 'use threads';
    $has_threads = $INC{'threads.pm'} ? 1 : 0;
}
@1nickt

This comment has been minimized.

Show comment
Hide comment
@1nickt

1nickt Oct 18, 2017

Thanks @marioroy !

( I had an error in my eval syntax too )

1nickt commented Oct 18, 2017

Thanks @marioroy !

( I had an error in my eval syntax too )

@choroba choroba added the enhancement label Sep 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment