[Orca-users] Re: Date_parse routine usage
Blair Zajac
blair at orcaware.com
Tue Sep 25 23:45:44 PDT 2001
Hi Mike,
I'd really recommend reading the new Perl 5 book or learning Perl online.
It's got some great new features beyond Perl 4. The my makes a lexical
variable that has scope, as in C or C++ variables. They are faster than
local's and make coding better.
Yes, the sub goes into the configuration file.
The parsedate routine is imported by the Time::ParseDate module. Check
out the Time::ParseDate manual page.
Best,
Blair
Mike Shannon wrote:
>
> Blair,
>
> thanks for the data
>
> I am a Perl 4 guy
> so some of the things you have here are new to me
> if it is okay could you explain some of them?
>
> the my command
> what parsesdate ($string) does...
>
> finally in the config file
> what does the parse_date comand look like
> (or are you saying put the sub right in the config file?)
>
> thanks!!
>
> mike
>
> --- In orca-discuss at y..., Blair Zajac <blair at o...> wrote:
> > Michael,
> >
> > It should look something like this:
> >
> > date_parse sub {
> > my $string = $_[0];
> > $string =~ s/_/ /g;
> > return parsedate($string);
> > }
> >
> > The date_parse routine should be called for each line.
> >
> > To debug this, try
> >
> > date_parse sub {
> > my $string = $_[0];
> > $string =~ s/_/ /g;
> > my $t = parsedate($string);
> > print "$_[0] => $t => ', scalar localtime($t), "\n";
> > }
> >
> > Blair
> >
> > Mike Shannon wrote:
> > >
> > > I would like to use the date_parse routine now available in 0.27b1
> > >
> > > I have a few questions about how to include do it though
> > >
> > > my data file has information like this
> > >
> > > 12-Sep-2001_00:00:10 20 5
> > > 12-Sep-2001_00:00:20 20 4
> > > 12-Sep-2001_00:00:30 20 3
> > > 12-Sep-2001_00:00:40 20 3
> > > 12-Sep-2001_00:00:50 20 3
> > > 12-Sep-2001_00:01:00 20 1
> > > 12-Sep-2001_00:01:10 20 1
> > > 12-Sep-2001_00:01:20 20 2
> > > 12-Sep-2001_00:01:30 20 2
> > > 12-Sep-2001_00:01:40 20 2
> > >
> > > this is a snapshot of license usage data starting at midnight
> > > and captured every 10 seconds. the second column is the total
> > > number of licenses, the 3rd the total used at the time of the
> > > snapshot
> > >
> > > I'd like to plot this
> > >
> > > the date_parse routine, should allow me to restructure the
> > > fist column time stamp into epoch time
> > >
> > > but
> > >
> > > I don't know how to tell orca that I have a parse routine
> > > - what/where the routine is
> > >
> > > do I write the routine to be called - like in a sort loop -
> > > so it is called everytime, and it's job is to return the
> > > epoch time - 1 line at a time?
> > >
> > > any help with this would be greatly appreciated
> > >
> > > mike
More information about the Orca-users
mailing list