> > I'm trying to use POD to document my application.  I have about 5
> > different doc files, and I'd like to create links between them when
> > they are translated from POD to HTML.  For example, in doc 
> file 1 I'd
> > like to say '...using the foo function, as described in <DOC FILE
> > 2>...', and have the link open doc file 2.  I read the POD
> > documentation, specifically the section on creating links with
> > L<...>, but the only examples I can find link to man pages.  I
> > couldn't find anything that described creating absolute or relative
> > links to other files. 
> > 
> > I tried a couple of different things, just to see what happened.  I
> > specified the base name only, the complete filename, and the full
> > path for DOC FILE 2 within the L<...> construct, but I keep getting
> > the following error: 
> > 
> > C:\perl\app1\docs\pod\pod2html_txt.pl: app1_example.pod: cannot
> > resolve L<C:\perl\app1\docs\pod\License.html> in paragraph 4. at
> > C:/ActivePerl/lib/Pod/Html.pm line 1562.
> > 
> > In this case, app1_example.pod contains
> > 'L<C:\perl\app1\docs\pod\License.html>' and the License.html file is
> > in the same directory as app1_example.pod.  (The pod2html_txt.pl
> > program simply calls pod2html for me.)
> 
> You need to add --htmlroot=. and --podpath=. to your pod2html call.

Do I also need --htmldir?  I would like the html output file placed in a
different directory.  (see below)

> If the file you want to link to is License.pod, then create 
> your link as
> L<License>

Thanks - that works.

> If you need to link to an external html file that isn't 
> derived from a .pod
> file, you have two choices:
> 
>    Absolute link:
> 
>       L<http://host/path/to/file.html>
> 
>    Relative link:
> 
>       =for html <A href="file.html">Text</A>
> 

Can the relative link contain path info (such as ..\..\file.html)?  (see
below)

I'll try to clarify what I'm trying to do.  I have two directories:
~\docs\pod and ~\docs\html.  I'd like to convert the pod files in ~\docs\pod
to html files in ~\docs\html, such that the links in ~\docs\html\file1.html
point to ~\docs\html\file2.html.  I would prefer to use relative links, but
the nice example given above seems to require hard-coding the html for each
link.  I assume from this that pod2html cannot create relative links.

So in summary, I want to call pod2html and say "here's a pod file that
contains links to another pod file - translate this into html, put the output
file in ..\html\, and make the links point to files within that same
directory".

I've made some progress on this, but it's still not working quite right.  In
retrospect, I should have posted the code for my pod2html call, since that
appears to be the biggest source of the problem (sorry!).  I didn't (and
still don't) understand the pod2html docs completely, so I'm trying to work
through them by experimenting.  My code looks like this:

use strict;
use warnings;

use Pod::Html;

my $file_base = 'testfile1';

my $pod_infile   = $file_base . '.pod';
my $html_outfile = $file_base . '.html';

my $podroot  = 'C:\perlcode\myapp\docs';
my $htmlroot = 'C:\perlcode\myapp\docs';
my $htmldir  = 'C:\perlcode\myapp\docs\html';
my $htmlpathfile = $htmldir . '\\' . $html_outfile;

pod2html( "--infile=$pod_infile",
                  "--outfile=$htmlpathfile",
                  "--header",
                  "--htmlroot=$htmlroot",
                  "--podroot=$podroot",
                  "--podpath=pod"
                 );

and the link in testfile1.pod is L<testfile2>.

When I run this, I get testfile1.html in ~\docs\html, but the link within it
is to ~\docs\pod\testfile2.html.  The only way I could get testfile1.html to
show up in ~\docs\html was to specify the complete path and filename in
--outfile.  I tried setting --htmldir as shown above and leaving
--outfile=$html_outfile (no path), but then testfile1.html ends up in
~\docs\pod.

If I change --podpath=pod to --podpath=html (in an attempt to correct the
link), I get the 'cannot resolve L<testfile2>' error again.

Any additional assistance is much appreciated.  I really appreciate you and
the other gurus on this list that take the time to help out us novices.

Thanks again,

Bob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to