cpanminus를 사용하여 다른 소스의 CPAN 모듈 설치

  • cpanm from CPAN
  • cpanm from git
  • cpanm from local tarball
  • cpanm from remote tarball

  • 이 게시물에서는 내 모듈 중 하나인 CPAN 클라이언트cpanmAcme::Automatix을 사용할 것입니다(아무것도 하지 않음).

    CPAN의 cpanm

    The main way, install from CPAN:

    $ cpanm Acme::Automatix
    --> Working on Acme::Automatix
    Fetching http://www.cpan.org/authors/id/C/CO/CONTRA/Acme-Automatix-0.05.tar.gz ... OK
    Configuring Acme-Automatix-0.05 ... OK
    Building and testing Acme-Automatix-0.05 ... OK
    Successfully installed Acme-Automatix-0.05
    1 distribution installed
    

    This is the common way and recommended way, because as much as possible, modules have to hit the CPAN (to be indexed, shared and watched by cpantesters). But I will now show you some exotic/pragmatic methods.

    자식의 cpanm

    If the code is on github, you can install it almost the same way:

    $ cpanm https://github.com/thibaultduponchelle/Acme-Automatix.git
    Cloning https://github.com/thibaultduponchelle/Acme-Automatix.git ... OK
    --> Working on https://github.com/thibaultduponchelle/Acme-Automatix.git
    Configuring /tmp/CkMIR8CLw4 ... OK
    Building and testing Acme-Automatix-0.06 ... OK
    Successfully installed Acme-Automatix-0.06
    1 distribution installed
    

    Disclaimer: As I said (and I insist), do not use this feature as an excuse to do not release your code to CPAN. This would be an error. Your code won't be well shared, not integrated in the ecosystem of dependencies etc... In other words, not really visible, the CPAN is the source of truth!

    There was an experiment (그 이후로 포기됨) 인덱스 및 전달을 위한 github 기반 CPAN 클라이언트를 구축합니다.

    CPAN이 만들어진 이후 시간이 바뀌었고 이 실험을 탐색하기 위해 수행한 이점(예: 쉬운 패치, 유연성...)을 이해하지만 외부 플랫폼에 완전히 의존하기 전에 두 번 생각해야 할 수도 있습니다. CPAN , PyPiRubyGems 모두 현재 호스팅을 위해 인프라 공급자에 의존하지만 외부 플랫폼에 묶여 있지는 않습니다.

    로컬 tarball의 cpanm

    I don't have a tarball of Acme::Automatix, I will create one. First get the sources:

    $ git clone https://github.com/thibaultduponchelle/Acme-Automatix.git
    Cloning into 'Acme-Automatix'...
    remote: Enumerating objects: 131, done.
    remote: Counting objects: 100% (131/131), done.
    remote: Compressing objects: 100% (40/40), done.
    remote: Total 131 (delta 48), reused 131 (delta 48), pack-reused 0
    Receiving objects: 100% (131/131), 20.69 KiB | 3.45 MiB/s, done.
    Resolving deltas: 100% (48/48), done.
    

    Configure:

    $ cd Acme-Automatix
    $ perl Makefile.PL
    Generating a Unix-style Makefile
    Writing Makefile for Acme::Automatix
    Writing MYMETA.yml and MYMETA.json
    

    At this point we have a Makefile and we can run various make "target".
    Let's create the distribution tarball:

    $ make dist
    rm -rf Acme-Automatix-0.06
    "/usr/bin/perl" "-MExtUtils::Manifest=manicopy,maniread" \
        -e "manicopy(maniread(),'Acme-Automatix-0.06', 'best');"
    mkdir Acme-Automatix-0.06
    mkdir Acme-Automatix-0.06/t
    mkdir Acme-Automatix-0.06/.github
    mkdir Acme-Automatix-0.06/.github/workflows
    mkdir Acme-Automatix-0.06/lib
    mkdir Acme-Automatix-0.06/lib/Acme
    Generating META.yml
    Generating META.json
    tar cvf Acme-Automatix-0.06.tar Acme-Automatix-0.06
    Acme-Automatix-0.06/
    Acme-Automatix-0.06/META.yml
    Acme-Automatix-0.06/.github/
    Acme-Automatix-0.06/.github/workflows/
    Acme-Automatix-0.06/.github/workflows/build-and-upload.yml
    Acme-Automatix-0.06/lib/
    Acme-Automatix-0.06/lib/Acme/
    Acme-Automatix-0.06/lib/Acme/Automatix.pm
    Acme-Automatix-0.06/MANIFEST
    Acme-Automatix-0.06/Changes
    Acme-Automatix-0.06/Makefile.PL
    Acme-Automatix-0.06/README.md
    Acme-Automatix-0.06/META.json
    Acme-Automatix-0.06/t/
    Acme-Automatix-0.06/t/pod.t
    Acme-Automatix-0.06/t/pod-coverage.t
    Acme-Automatix-0.06/t/manifest.t
    Acme-Automatix-0.06/t/00-load.t
    rm -rf Acme-Automatix-0.06
    gzip -9f Acme-Automatix-0.06.tar
    Created Acme-Automatix-0.06.tar.gz
    

    As you can see my tarball contains .github/workflows/ things which is not very elegant (should be ignored) but not really a problem.

    Then you can install it with cpanm:

    $ cpanm Acme-Automatix-0.06.tar.gz 
    --> Working on Acme-Automatix-0.06.tar.gz
    Fetching file:///home/tduponchelle/Code/Acme-Automatix/Acme-Automatix-0.06.tar.gz ... OK
    Configuring Acme-Automatix-0.06 ... OK
    Building and testing Acme-Automatix-0.06 ... OK
    Successfully installed Acme-Automatix-0.06
    1 distribution installed
    

    원격 tarball에서 cpanm

    Put your tarball somewhere accessible in HTTP, in my case a github public repo

    그런 다음 URL을 사용하여 설치할 수 있습니다.

    $ cpanm https://github.com/thibaultduponchelle/messy-ci-workflows/raw/master/dirt/Acme-Automatix-0.06.tar.gz
    --> Working on https://github.com/thibaultduponchelle/messy-ci-workflows/raw/master/dirt/Acme-Automatix-0.06.tar.gz
    Fetching https://github.com/thibaultduponchelle/messy-ci-workflows/raw/master/dirt/Acme-Automatix-0.06.tar.gz ... OK
    Configuring Acme-Automatix-0.06 ... OK
    Building and testing Acme-Automatix-0.06 ... OK
    Successfully installed Acme-Automatix-0.06
    1 distribution installed
    


    결론



    이것으로 cpanm의 이국적인 소스 투어를 마칩니다... 👍

    다른 방법을 알고 있습니까?

    좋은 웹페이지 즐겨찾기