Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: getting Log::Log4perl to install on windows strawberry perl

by haukex (Bishop)
on Dec 25, 2019 at 18:14 UTC ( #11110614=note: print w/replies, xml ) Need Help??


in reply to Re^2: getting Log::Log4perl to install on windows strawberry perl
in thread getting Log::Log4perl to install on windows strawberry perl

The file isn't a Perl script, it's basically a unified diff that is commonly fed into the patch program (originally written by Larry Wall) to apply the patches automatically. Typically, the filename is included in the diff output, so in this case I don't think patch can handle this format, but this patch is simple enough: it's telling you to insert the line "log4perl.appender.Logfile.mode = clobber" after the line "log4perl.appender.Logfile.layout = Log::Log4perl::Layout::SimpleLayout" (as indicated at the top, look at line number 448), and we can infer from the context in this thread that it's referring to t/026FileApp.t in the Log::Log4perl distro.

Replies are listed 'Best First'.
Re^4: getting Log::Log4perl to install on windows strawberry perl
by Aldebaran (Deacon) on Jan 02, 2020 at 03:24 UTC
    we can infer from the context in this thread that it's referring to t/026FileApp.t in the Log::Log4perl distro.

    Thx, haukex, I had to read all of that very carefully and serially in order to follow along. [I hadn't patched anything before.] A little more context with the new t/026FileApp.t here:

    ######################################################### # Print a header into a newly opened file ######################################################### $data = qq( log4perl.category = DEBUG, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = ${testfile}_5 log4perl.appender.Logfile.header_text = This is a nice header. log4perl.appender.Logfile.layout = Log::Log4perl::Layout::SimpleLayo +ut ); Log::Log4perl->init(\$data); open FILE, "<${testfile}_5" or die "Cannot open ${testfile}_5"; $content = join '', <FILE>; close FILE; is($content, "This is a nice header.\n", "header_text"); # same with syswrite unlink "${testfile}_5"; $data = qq( log4perl.category = DEBUG, Logfile log4perl.appender.Logfile = Log::Log4perl::Appender::File log4perl.appender.Logfile.filename = ${testfile}_5 log4perl.appender.Logfile.header_text = This is a nice header. log4perl.appender.Logfile.syswrite = 1 log4perl.appender.Logfile.layout = Log::Log4perl::Layout::SimpleLayou +t log4perl.appender.Logfile.mode = clobber ); Log::Log4perl->init(\$data);

    I made mistakes on the way to get this, in particular changing the critical line

     log4perl.appender.Logfile.mode = clobber

    in Log4perl.pm . I've always wondered how to make changes in the .pm's that are installed on my machine. It seemed like the wrong way to have to change permissions on the file, but I did it, because, hey, we're using force here, right? I added the line and summarily got an error when opening a cpan client window.

    After patching the right file and executing:

    C:\Users\tblaz\Documents\evelyn\my_repos\Log-Log4perl-1.49>cpanm . --> Working on . Configuring Log-Log4perl-1.49 ... OK Building and testing Log-Log4perl-1.49 ... OK Successfully installed Log-Log4perl-1.49 1 distribution installed C:\Users\tblaz\Documents\evelyn\my_repos\Log-Log4perl-1.49>

    , Log4perl.pm was restored to what it was before I started messing with it. I still get a complaint about the Terminal Size, but there is no mention of Log4perl being uninstalled:

    Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call + didn't work. The COLUMNS and LINES environment variables didn't work +. at C:\Strawberry\perl\vendor\lib/Term/ReadLine/readline.pm line 410 +. cpan shell -- CPAN exploration and modules installation (v2.26) Enter 'h' for help. cpan>

    Thanks all for comments,

      I've always wondered how to make changes in the .pm's that are installed on my machine.

      Well, it's possible to patch them directly where they are installed in the @INC paths, but as you've discovered those changes are easily clobbered by a reinstall. So when patching something it's usually better to do so in the distributions before installation. But even in that case there are some chances for conflicts, for example, if you don't change the version number, there is a potential for confusion about whether the patched version is installed or not; and if you simply increment the version number, there is a chance for conflict when the module gets an update by the author. There are several different approaches, listing them all is probably too much, best to cross that bridge if and when you get to it and ask about it then :-) In regards to the question in this thread, note it's about modifying one of the test scripts that don't actually get installed, they only get run before installation to verify that the module was compiled ok on your machine.

      Update:

      Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call didn't work. The COLUMNS and LINES environment variables didn't work.

      See Re: Unable to debug due to terminal problem (read) and Re: Problems starting the debugger

        I finally have a script that deals with the terminal and cpan opening up with the need to overwrite a lockfile. This is a grandchild of portableshell.bat that is recommended for beginning strawberry perl on windows. I have alternated between using set TERM=dumb and commenting it out. Also, I don't want the script erasing the value of PERL5LIB, so I comment that out as well.

        @echo off rem set env variables rem set TERM=dumb set LINES=40 set COLUMNS=80 set PERL_JSON_BACKEND=JSON::XS set PERL_YAML_BACKEND=YAML rem avoid collisions with other perl stuff on your system rem set PERL5LIB= set PERL5OPT= set PERL_MM_OPT= set PERL_MB_OPT= perl -e "printf("""Perl executable: %%s\nPerl version : %%vd\n""", $ +^X, $^V)" 2>nul if ERRORLEVEL==1 echo.&echo FATAL ERROR: 'perl' does not work; check i +f your strawberry pack is complete! echo. chcp 65001 cd C:\Users\tblaz\Documents\evelyn\ dir cpan | echo y

        Thanks all for comments.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11110614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2020-11-30 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?