[wellylug] Perl script help :)

Chris Hodgetts chris at hodgetts.geek.nz
Mon Jan 2 08:19:13 NZDT 2006


Thanks for that...

I think that the DateCalc is from the asterisk perl module..

Yeah, I can see where the PHP call is to do that but I just could not
work out the perl way to do it :)

Cheers

On Mon, 2006-01-02 at 05:52 +1300, michael at diaspora.gen.nz wrote:
> 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