[WM] [Q] get_metadata

Chris ckolumbus.gmx.de
Thu Nov 1 00:35:01 GMT 2001


On Thu, Nov 01, 2001 at 10:35:40AM +1100, Justin Mason wrote:
> 
> > I hope that I'm not too annoying, but as I like the power of WebMake it's fun
> > for me to play around with it. This result in man questions, as you might
> > notice :-).
> 
> No problem -- it's interesting to see which bits I've forgotten to
> document enough, and I'm sure others are finding it illuminating too ;)

Thank you!

> 
> > 	  my $myup = $pg2->get_metadata("up");
> > does not woerk.
> 
> Yes, someone else asked about the get_metadata() method.  I think,
> fundamentally, I need to fix it so it will work properly; in some
> circumstances it will not return metadata unless the content item has
> been read :(

> 
> >          my $myup = $pg2->{main}->quiet_curly_meta_subst
> >                                  ($HTML::WebMake::Main::SUBST_META,
> >                                  $pg2->{name}.".up");
> 
> BTW you could also subst the string '$['.$pg2->{name}.'.up]' -- the
> two are equivalent.

It seem's not to work in my case. Here's the code which actually imitates
some part of the 'sitemap'. It tries to find all contents which refer to 
the current on as 'up'. Now I'm trying to solve the problem by better
understanding how to use the alredy built sitemap :-).

---------------------------------- snip ------------------------------------
<template name=all_sub_sections>
<{perl

        my $curname = get_current_main_content();

        $_ = "|";
        foreach my $pg (content_matching ("*.txt")) {

          my $pg2 = get_content_object($pg);
          $pg =~ s/.txt//;

          my $title = $pg2->get_title();

          my $myup  = '${'.$pg2->{name}.'.up}';
#         my $myup  = $pg2->{main}->quiet_curly_meta_subst
#                                 ($HTML::WebMake::Main::SUBST_META,
#                                 $pg2->{name}.".up");

          if ( $myup =~ $curname ) {
                  $_ .= "<a href=\$($pg)> $title </a> | ";
          }
        }
        $_;
}>
</template>
---------------------------------- snap ------------------------------------

> 
> > It seems to be a problem of "up" being not a builtin metadata object defined
> > in Metadata.pm.
> > Is this behaviour intedend or not?
> 
> no, it is not; firstly, you will probably get a warning along those lines,
> but it's a red herring.  (The development version at the moment includes a
> fix for that anyway.)
> the real problem is the get_metadata() method not working in an intuitive
> way.  To make sense (!!) it should operate exactly the same as the
> quiet_curly_meta_subst() above.

I think I'm missing the deep insight in the internals of WebMake to understand
that. But maybe I'll find out :-).

Regards,
Chris




More information about the Webmake-talk mailing list