note
bart
What you seem to be wanting is a way to pass a date as a parameter, and use today only as a default. Or, pass a relative day offset, with 0 for today, -1 for yesterday and 1 for tomorrow, for example.
<p>It might be helpful if you didn't depend on the external program <c>date</c> to get the dateparts. Perl is perfectly capable of handling those dateparts itself, either [doc://localtime|on its own], or via [doc://POSIX#strftime|simple, standard modules], or via more [mod://Date::Calc|elaborate CPAN modules] (and that's just one example). The latter can be used for relative date calculations; on the latter you can get by calculating the [doc://time|times in seconds], but watch out for summer time, and thus days that are not 24 hours long. Calculating days relative to noon, on any day, is safe.
<p>To pass around the values, you need form variables (thus a HTML form, or equivalent), and form values processing on the server side, either via GET or POST; [mod://CGI|CGI.pm], which you are already using, will do fine.
<p>For the form values, you can use any button to set a hidden input using Javascript before submitting the form; or you can use ordinary links, where you convert the parameter values straight to an URL. (Ordinary <c><input name="d" value="x" type="submit"></c> isn't usable because of the mixup in HTML between the value in the form and the text on the button.)
<p>I could elaborate and give examples on all approaches, but just one solution is enough so you'd better let us know which approach you're thinking on taking.
1037038
1037038