[wellylug] Perl script help :)

michael at diaspora.gen.nz michael at diaspora.gen.nz
Mon Jan 2 05:52:14 NZDT 2006


Chris Hodgetts writes:
>sub createwake
>{
>my $date = &UnixDate(DateCalc("today","+ ".$_[0]."minutes"), "%H%M");
>my $filename = sprintf("%s%04s.%s.call", $pending_dir, $date, $caller);
>        open(FILE, ">$filename");
>
>        printf FILE q{#

>The Perl script does not seem to do this, it creates the file with the
>current date and time thus calls you immediately back just before the
>call hangs up.

You need to insert a call to 'utime()' in there.  For example:

    my $filename = sprintf("%s%04s.%s.call", $pending_dir, $date, $caller);
    open(FILE, ">$filename");
    my $time = &UnixDate(DateCalc("today","+ ".$_[0]."minutes"), "%s");
    utime $time, $time, $filename;
    ...

(I'm presuming that the call to UnixDate will return a number in
seconds-since-the-epoch format.  I'm not sure which module DateCalc
is from.)

I'd also presume that the PHP version has a similar call...
    -- michael.




More information about the wellylug mailing list