Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

HTML::Tidy - Tidyp install issues

by Anonymous Monk
on Aug 06, 2020 at 04:01 UTC ( [id://11120391]=perlquestion: print w/replies, xml ) Need Help??

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

Hello oh wise a great monks. I have spent a day on this without a solution so I am turning to you for help. I am trying to install HTML::Tidy on a Windows 10 server and am stuck! I know that tidyp is need so I'm trying to install Alien::Tidyp first as it searches the box for tidyp and if it's not there should install it. That's where I get this error:/

-c src/buffio.c -o src/buffio.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/clean.c -o src/clean.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/config.c -o src/config.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/entities.c -o src/entities.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/fileio.c -o src/fileio.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/istack.c -o src/istack.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/lexer.c -o src/lexer.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/localize.c -o src/localize.o gcc -Isrc -Iinclude -O2 -Wall -D_WIN32_WINNT=0x0500 -DSUPPORT_ACCESSIB +ILITY_CHECKS=1 -DSUPPORT_ASIAN_ENCODINGS=1 -DSUPPORT_UTF16_ENCODINGS= +1 -c src/mappedio.c -o src/mappedio.o In file included from src/mappedio.c:100: src/streamio.h:204:15: error: expected identifier or '(' before numeri +c constant #define CR 0xD ^~~ gmake: *** [C:\STRAWB~1\cpan\build\Alien-Tidyp-v1.4.7-7\patches\Makefi +le.mingw:45: src/mappedio.o] Error 1 ###ERROR### [512] during make ... at inc/My/Builder/Windows.pm line 3 +9. KMX/Alien-Tidyp-v1.4.7.tar.gz C:\Strawberry\perl\bin\perl.exe ./Build -- NOT OK Stopping: 'install' failed for 'Alien::Tidyp'. Failed during this command: KMX/Alien-Tidyp-v1.4.7.tar.gz : make NO

Please note I'm trying to install using CPAN. I even installed cpanm to try and get the pms thinking it might do something different. So I'm stuck my script uses Tidy::HTML but I can't get tidyp on the box so I can't install HTML::Tidy. I'm not doing anything too fancy with Tidy, here's my code:

my $contents_of_file = 1; @files = glob "$call_dir/*.html"; printf "Got %d files\n", scalar @files; my $tidy = HTML::Tidy->new( { tidy_mark => 1, #output_xhtml => 1, # yes #output_xhtml => 1, # yes add_xml_decl => 1, # no wrap => 76, error_file => 'errs.txt', char_encoding => 'utf8', indent_cdata => 1, clean => 1, fix_bad_comments =>1 }); for my $file (@files){ $$temp_var = read_file( $file ); if ( $$temp_var =~ m|^URL.*| ){ next } # this + is empty file for error message in output. my $tres = $tidy->parse( $file, $$temp_var ); print "Tidy file: $file, result is $tres\n"; open OUT,'>',$file or die "$!"; print OUT $tidy->clean( $file, $$temp_var ); print "cleaning " . $file. "\n"; close OUT; } $temp_var = undef;

I would be open to using another module that I could install that could do this. Up till 3AM last night trying to find a solution, not looking to go there again tonight

Thanks in advance for any help/insight!

The tired nub

PS - I also did take the time to install Cygwin thinking I could d/l the source and compile by I've got no clue what I'm doing there.

Replies are listed 'Best First'.
Re: HTML::Tidy - Tidyp install issues
by syphilis (Archbishop) on Aug 06, 2020 at 06:01 UTC
    In file included from src/mappedio.c:100: src/streamio.h:204:15: error: expected identifier or '(' before numeri +c constant #define CR 0xD

    For thoroughly sane and understandable reasons that I could not fathom, the one occurrence of CR in streamio.h needs to be changed to something else. (I chose CROWBAR)
    Then, of course, the 2 occurrences of CR in streamio.c, need to be changed to whatever symbol was used in streamio.h (ie for me, CROWBAR) .

    So:
    1) Locate your home_directory\.cpan\build\Alien-Tidyp-v1.4.7-0\build_src\tidy-1.04\src\streamio.h and home_directory\.cpan\build\Alien-Tidyp-v1.4.7-0\build_src\tidy-1.04\src\streamio.c files, and make the changes as stated above.
    2) Then cd to your home_directory\.cpan\build\Alien-Tidyp-v1.4.7-0 folder and run perl build. This will prompt you as to whether to use freshly unpacked source or not.
    Make sure you choose "No" (which is the default). If you choose yes, then you'll only have to make the same changes again.
    3) Then run perl build test, and if that succeeds (as happened for me on Windows 7), run perl build install.
    4) Then you should be set to run cpan -i HTML::Tidy again.

    Cheers,
    Rob

      Hi Rob, That for the reply. So I changed the line to: #define CROWBAR 0xD and CR in the other file to CROWBAR and still got errors. What am I doing wrong?

      Thanks, Tony

        Hi Rob, Got it working. I had several instances of Alien:Tidyp. I modified one and tried to build from the other! Once I cleaned things up and had only one your advice worked perfectly. I could have never figured it out without you. Big thanks! Tony

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-25 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found