packages-http icon indicating copy to clipboard operation
packages-http copied to clipboard

Meta-predicates not exported in html_write.pl

Open rrooij opened this issue 4 years ago • 2 comments

Certain meta-predicates like page/4 are defined in html_write.pl and used elsewhere (for instance, in http_header.pl). They are explicitly imported in http_head but not exported in html_write.

This results in socket connection errors when you run in a server in SWI Prolog with autoloading disabled:

ERROR: [Thread httpd@6363_4] http_header:status_page_hook/3: Unknown procedure: http_header:page/4

rrooij avatar Jan 31 '22 21:01 rrooij

!? From html_write.pl:

:- module(html_write,
          [ reply_html_page/2,          % :Head, :Body
            reply_html_page/3,          % +Style, :Head, :Body

                                        % Basic output routines
            page//1,                    % :Content
            page//2,                    % :Head, :Body
            ...

In html_header.pl:

:- autoload(html_write,
	    [ print_html/2, print_html/1, page/4, html/3,
	      html_print_length/2
	    ]).

page//2 is the same as page/4. Ok, it would be more elegant to use page//2 consistently but that is detail. The imports are generated automatically and this code doesn't yet handle DCGs separately.

Note that autoload/2 is interpreted as use_module/2 if autoloading is disabled.

JanWielemaker avatar Feb 01 '22 07:02 JanWielemaker

Thanks for explaining this. I didn't know about the two slashes. :smile:

The error still remains a mystery though! I'm trying to make a reproducible small example.

rrooij avatar Feb 01 '22 09:02 rrooij