[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: How to define an \<expire\> tag\?



Hello Fritz Zaucker, in a previous mail you wrote:

> >     | <define-tag expires>
> >     | <:{
> >     |      #   parse yy-mm-dd format into (dd, mm, yyyy)
> >     |      my @et = reverse(split(/-/, '%0')); 
> >     |      #   parse localtime into (dd, mm, yyyy)
> >     |      my @ct = (localtime(time()))[3..5]; $ct[1] += 1; $ct[2] += 1900;
> >     | 
> >     |      #   leave all standard locations
> >     |      #   (and implicitly enter "null" location)
> >     |      #   if already expired
> >     |      if (   $ct[0]+31*$ct[1]*395*$ct[2]
> >     |          >= $et[0]+31*$et[1]*395*$et[2]) {
> >     |          print '<<main..'
> >     |      }
> >     | }:>
> >     | </define-tag>
> > 
> > Isn't it a little bit better? ;_)
> 
> > Perhaps someone of you makes it even better. At least the if-statement?
> 
> I guess the 395 should be replaced by 365???  

Yes, was a typo.

> Anyway, this breaks for
> leap-years. How about using Timelocal instead? The problem is that
> this is (funnily) not a standard perl module either. But as I have it,
> I guess I'll use it.

You can use it for your <expire>-variant but the one included in the WML
distribution has to be written in a way it can work with WMLs stuff
out-of-the-box. The only prerequisit WML have to use is the standard Perl
distribution. So, distributed includes only can use modules of this standard
Perl distribution or modules which are part of WML's wml_common/ dir.

Greetings,
                                       Ralf S. Engelschall
                                       rse@engelschall.com
                                       www.engelschall.com
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com