Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Offline cpan used by strawberry perl

by Dirk80 (Pilgrim)
on Jan 31, 2020 at 13:56 UTC ( [id://11112178]=perlquestion: print w/replies, xml ) Need Help??

Dirk80 has asked for the wisdom of the Perl Monks concerning the following question:

I'm using Strawberry Perl (64-bit) Portable 5.30.1.1-64bit in a Windows 7 OS here. I used minicpan to download the cpan to a local directory D:\Perl\strawberry\cpan\sources.

My portable strawberry perl is in the directory D:\Perl\strawberry. I had a look at the Config.pm located in D:\Perl\strawberry\perl\lib\CPAN

I only adapted the path in the following lines:

if ( -d 'D:\\Perl\\strawberry\\cpan\\sources' ) { # If we are on fake Hotel/Airport wireless, # prefer the minicpan to the poisoned wireless. eval { require LWP::Online; }; unless ( $@ ) { if ( LWP::Online::online() ) { push @urllist, q[file:///D:/Perl/strawberry/cpan/sources/]; } else { unshift @urllist, q[file:///D:/Perl/strawberry/cpan/sources/]; } } }

After opening the portableshell.bat, I enter cpan and then the cpan-shell appears. Then I tried to install a module via install Text::Trim and it worked fine.

Some days later I tried again to install a module. But it did not work. The cpan-shell complained that it could not find 01mailrc.txt.gz although it was there. And then was using LWP to try to download it instead of using my local one.

After some investigation I could discover that the cpan-shell always tries to download this file again if its date is not of today. So I changed the code in the Config.pm at the beginning as follows:

use File::Touch; my @file_list = ( q[D:/Perl/strawberry/cpan/sources/authors/01mailrc.txt.gz], q[D:/Perl/strawberry/cpan/sources/modules/02packages.details.txt.gz] +, q[D:/Perl/strawberry/cpan/sources/modules/03modlist.data.gz] ); touch(@file_list);

It worked again. But this cannot be the right way to do it.

How do I have to config cpan properly that it uses my offline cpan although in the net there would be a newer cpan-archive? I just want to use the cpan-archive I downloaded via minicpan offline.

Then I have seen that there exists a per user config for cpan too, i.e. /.cpan/CPAN/MyConfig.pm. In my case this file is not present at the moment. Should I use it?

I know that this is a common topic and already often discussed. But nevertheless I was not able to find a good solution for my case. Thank you for your help!

Replies are listed 'Best First'.
Re: Offline cpan used by strawberry perl
by Aldebaran (Curate) on Jan 31, 2020 at 18:50 UTC
    After some investigation I could discover that the cpan-shell always tries to download this file again if its date is not of today.

    I read your post last night without much idea on what one might do about it. And I'm intrigued about what one might do with strawberry perl on USB. What types of things does a person do with such a stick, I wonder?

    This morning, I was working on my own cpan "problems," and I got this from STDOUT:

    MIYAGAWA/App-cpanminus-1.7044.tar.gz /usr/bin/make -- OK The current configuration of allow_installing_outdated_dists is 'ask/y +es', but for this option we would need 'CPAN::DistnameInfo' installed +. Please install 'CPAN::DistnameInfo' as soon as possible. As long as + we are not equipped with 'CPAN::DistnameInfo' this option does not t +ake effect Running make test for MIYAGAWA/App-cpanminus-1.7044.tar.gz

    Then I ran o conf and saw this:

    cpan[1]> o conf $CPAN::Config options from /home/hogan/.cpan/CPAN/MyConfig.pm: commit [Commit changes to disk] defaults [Reload defaults from disk] help [Short help about 'o conf' usage] init [Interactive setting of all options] allow_installing_module_downgrades undef allow_installing_outdated_dists undef

    , and I see that your values are the same. If cpan believes that old modules are alright, it might not think it had to go change it.

    Hope this helps,

    (if not, I still have 2 strikes)

      Thanks alot. Sounds good. Installing CPAN::DistnameInfo and setting afterwards option allow_installing_outdated_dists to yes.

      But I have to wait until Monday morning to try it. The computer with this configuration is at work. This is the reason for the portable strawberry perl and offline cpan. I'm not able to use online cpan and I have no rights to install something. So this is a good way for me to use perl for automating things at this computer. At home I have a Linux.

        The computer with this configuration is at work. This is the reason for the portable strawberry perl and offline cpan. I'm not able to use online cpan and I have no rights to install something. So this is a good way for me to use perl for automating things at this computer. At home I have a Linux.

        I see the angle on it now. I claim that perl makes windows bearable. I've had partial successes with strawberry perl on windows. It's a non-native environment and shows it every now and then. But it's also the OS for my mom, so I would be advantaged to show up with such a stick if I'm gonna touch her computer at all. Should it be FAT32 partitioned?

Re: Offline cpan used by strawberry perl
by Anonymous Monk on Jan 31, 2020 at 14:32 UTC

    hi

    have you use o conf from cpan shell to add paths to urllist?

      Yes, I now tried to use o conf. But my problem remains. If the 01mailrc.txt.gz has an older date than today, it tries to fetch it via LWP. And this fails. And I want always to use my offline-cpan archive independent of having a connection to internet or not.

      Here the errors:

      cpan> install Text::Trim Could not find 'D:\Perl\strawberry\cpan\sources\authors\01mailrc.txt.g +z' Fetching with LWP: file:///D:/Perl/strawberry/cpan/sources/authors/01mailrc.txt.gz LWP failed with code[404] message[File `D:\Perl\strawberry\cpan\source +s\authors\01mailrc.txt.gz' does not exist] Could not find 'D:\Perl\strawberry\cpan\sources\authors\01mailrc.txt.g +z'

      But the file exists. It just has a date of 27th of January instead of today. Cpan then renames my local file to e.g. 01mailrc.txt.gz.bak4400.

      Here my configuration:

      cpan> o conf $CPAN::Config options from D:\Perl\strawberry\perl\lib/CPAN/Config.pm: commit [Commit changes to disk] defaults [Reload defaults from disk] help [Short help about 'o conf' usage] init [Interactive setting of all options] allow_installing_module_downgrades undef allow_installing_outdated_dists undef applypatch [] auto_commit [1] build_cache [50] build_dir [D:\Perl\strawberry\cpan\build] build_dir_reuse [0] build_requires_install_policy [yes] bzip2 [ ] cache_metadata [1] check_sigs [0] cleanup_after_install undef colorize_debug undef colorize_output [0] colorize_print [bold green] colorize_warn [bold red] commandnumber_in_prompt [0] commands_quote undef connect_to_internet_ok [1] cpan_home [D:\Perl\strawberry\cpan] curl [] dontload_hash undef dontload_list undef ftp [] ftp_passive [1] ftp_proxy [] ftpstats_period undef ftpstats_size undef getcwd [cwd] gpg [] gzip [ ] halt_on_failure [1] histfile [D:\Perl\strawberry\cpan\histfile] histsize [1000] http_proxy [] inactivity_timeout [0] index_expire [1] inhibit_startup_message [0] keep_source_where [D:\Perl\strawberry\cpan\sources] load_module_verbosity [none] lynx [] make [D:\Perl\strawberry\c\bin\gmake.exe] make_arg [] make_install_arg [UNINST=1] make_install_make_command [D:\Perl\strawberry\c\bin\gmake.exe] makepl_arg [] mbuild_arg [] mbuild_install_arg [--uninst 1] mbuild_install_build_command undef mbuildpl_arg [] ncftp [] ncftpget [] no_proxy [] pager [C:\Windows\system32\more.COM] password undef patch [D:\Perl\strawberry\c\bin\patch.exe] patches_dir undef perl5lib_verbosity [none] plugin_list undef prefer_external_tar [0] prefer_installer [MB] prefs_dir [D:\Perl\strawberry\cpan\prefs] prerequisites_policy [follow] proxy_pass undef proxy_user undef randomize_urllist undef recommends_policy [1] scan_cache [atstart] shell [C:\Windows\system32\cmd.exe] show_unparsable_versions [0] show_upload_date [1] show_zero_versions [0] suggests_policy [0] tar [ ] tar_verbosity [none] term_is_latin [1] term_ornaments [1] test_report [0] trust_test_report_history [0] unzip [] urllist 0 [file:///D:/Perl/strawberry/cpan/sources/] 1 [http://cpan.strawberryperl.com/] 2 [http://www.cpan.org/] urllist_ping_external undef urllist_ping_verbose undef use_prompt_default [0] use_sqlite [1] username undef version_timeout [15] wait_list undef wget [] yaml_load_code [0] yaml_module [YAML::XS]

        Trim your urllist ?

        And/or

        Tickle this value

        index_expire [1] index_expire refetch index files after this many days

        CPANPLUS doesn't have a days, only a yes/no no_update

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11112178]
Approved by choroba
Front-paged by haukex
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found