Help w/Class::Date Date.xs

PERL

    Next

  • 1. Need help!
    it is my code: #! /usr/bin/perl -w use strict; my(@array,$match,$item,$found); @array=(-2,-3,-4,-4,5); foreach $item (@array) { if ($item>0) { print ref($item); $match = $item; $found = 1; last; } } if ($found) { print "the first positive item found in this array is:$match"; ####atteniton###the line is here### } else { print "unfound"; } and the code works quite well and it will print "the first positive item found in this array is 5",but if i change the $match into $item in the print line,i will get a problem. it seems that $item is undef.but i think $item should be 5 too , because "last" stop the loop and let $item equals 5 .. puzzled!
  • 2. Removing unnecessary data
    Hi Dear all, I have a data file for bus trajectories where bus location at each second along the route is given. The specified route for the bus is from origin (Point A) to Destination (Point B) , but sometimes bus has changed the route at a point (Point C) in between A and B and has gone in some other route. I want to remove these data lines relevant to A to C when the bus changes the route. In other words, I want to keep only the data where bus had completed the trajectory from Point A to B. Can some one please help me? I am still new to perl. Thanks in advance, Kind regards, Geetha
  • 3. code needed
    anyone have any code that will return the links and tags from web document downloaded using LWP? hal chicago

Help w/Class::Date Date.xs

Postby perl » Wed, 15 Oct 2003 13:30:17 GMT

Can someone help me with where to put the Date.xs file?

I just downloaded the Class-Date-1.1.7.tar.gz.

I figured out where to put the 2 files in /usr/lib/perl5/5.8.0/Class:
- Class::Date.pm
- Class::Date::Const.pm

- Date.xs -where shoud it go?

I ran th test in the t directory which look like a couple of test script.
It says ok but can't find the xs part:

"Cannot find the XS part of Class::Date,
   using strftime, tzset and tzname from POSIX module."

thanks,
-rkl


-----------------------------------------
eMail solutions by 
 http://www.**--****.com/ 

Re: Help w/Class::Date Date.xs

Postby perl » Thu, 16 Oct 2003 07:49:02 GMT

I downloaded the tar file. But I couldn't find out how to install it from
the README. From the various info in the readme I was able to install the
.pm files but not the xs. The Date class look like it's working but it
keeps showing the message about the XS part warning. The Date.xs is
sitting in my tmp dir. I looks like a C type of file.

So, please tell me how to install it.

fyi, I've never installed a cpan or any perl package, if there is such a
thing.

thanks,






-----------------------------------------
eMail solutions by 
 http://www.**--****.com/ 

Re: Help w/Class::Date Date.xs

Postby DStaal » Thu, 16 Oct 2003 07:58:45 GMT

--On Tuesday, October 14, 2003 15:49 -0700 " XXXX@XXXXX.COM " 




Sounds like it could be a C library that is being used.  There might 
be instructions with it on how to install, otherwise read on.


CPAN is Perl's package manager (among other things).  It is the 
absolute easiest way to install a Perl module.  I would suggest you 
type at the command line (you may need root/sudo access):

perl -MCPAN -e 'install Class::Date'

CPAN will probably ask all kinds of questions to set up initially. 
Answer as best you can.  Then it will go get the current version of 
the module, check to see if you have any dependencies, then 
compile/install as needed and appropriate.

Then you don't have to worry about all this.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------

Re: Help w/Class::Date Date.xs

Postby dzhuo » Thu, 16 Oct 2003 08:35:41 GMT




if a module does not came with its own installation procedures, 
try (as root):

[panda]$ mv date-class.tar.gz /tmp
[panda]$ cp /tmp
[panda]$ tar -zxf date-class.tar.gz
[panda]$ perl Makefile.PL
[panda]$ make
[panda]$ make test
[panda]$ make install
[panda]$ make clean
[panda]$ perl -MDate::Class -le 'print $INC{"Date/Class.pm"}'
[panda]$

large number of CPAN modules (Class::Date happen to be one of those) are 
packed/distributed by creating make file with MakeMaker which can be 
installed by the above procedures.

perldoc -q install

david
-- 
$_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$";
map{~$_&1&&{$,<<=1,$#.=qq~\x63\x68\x72\x28@_[$_..$||3])=>~}}0..s~.~~g-1;*_=*#,

goto=>print+eval

RE: Help w/Class::Date Date.xs

Postby tn » Thu, 16 Oct 2003 08:57:44 GMT

Hi,

I just took a look at this.  After downloading and unbundling
Class-Datge-1.1.7.tar.gz I found the Date.xs file that you mentioned.
There was no INSTALL file so I did the following:

 perl Makefile.PL # builds Makefile in which Date.xs is referenced
 make
 make install # no "test" target in this Makefile

The make ran the following command that shows Date.xs is used to build
Date.c  out the following that gives a clue about Date.xs:

/usr/bin/perl.exe /usr/lib/perl5/5.8.0/ExtUtils/xsubpp  -typemap
/usr/lib/perl5/5.8.0/ExtUtils/typemap  Date.xs > Date.xsc && mv Date.xsc
Date.c
Please specify prototyping behavior for Date.xs (see perlxs manual)

After this, Date.c is compiled into Date.o by gcc:

gcc -c   -DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -DUSEIMPORTLIB -O3
-DVERSION=\"1.1.7\" -DXS_VERSION=\"1.1.7\"
"-I/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE"   Date.c

Then Date.o is loaded into Date.dll:

LD_RUN_PATH="" ld2  -s -L/usr/local/lib Date.o  -o
blib/arch/auto/Class/Date/Date.dll
/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE/libperl.dll.a

And converted into a shared ar archive name libDate.dll.a:

gcc -shared -o  Date.dll -Wl,--out-implib=libDate.dll.a
-Wl,--export-all-symbols  -Wl,--enable-auto-import -Wl,--stack,8388608
-s -L/usr/local/lib Date.o
/usr/lib/perl5/5.8.0/cygwin-multi-64int/CORE/libperl.dll.a

Running "make install" installs Date.dll and libDate.dll.a into

/usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int/auto/Class/Date/

And

/usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int/auto/Class/

Running "man perlxs" says that XS is an interface format for creating
extensions of perl in C and C libraries.  

Based on this and looking inside Date.xs, it seem that the latter is
where the data types and structures and functions of Class::Date are
defined in a format that is used to generate C code that is compiled
into dynamic libs that are loaded into perl at runtime  to implement the
funtionality of this module.

-tristram


-----Original Message-----
From:  XXXX@XXXXX.COM  [mailto: XXXX@XXXXX.COM ] 
Sent: Tuesday, October 14, 2003 12:30 AM
To:  XXXX@XXXXX.COM 
Subject: Help w/Class::Date Date.xs


Can someone help me with where to put the Date.xs file?

I just downloaded the Class-Date-1.1.7.tar.gz.

I figured out where to put the 2 files in /usr/lib/perl5/5.8.0/Class:
- Class::Date.pm
- Class::Date::Const.pm

- Date.xs -where shoud it go?

I ran th test in the t directory which look like a couple of test
script. It says ok but can't find the xs part:

"Cannot find the XS part of Class::Date,
   using strftime, tzset and tzname from POSIX module."

thanks,
-rkl


-----------------------------------------
eMail solutions by 
 http://www.**--****.com/ 

-- 
To unsubscribe, e-mail:  XXXX@XXXXX.COM 
For additional commands, e-mail:  XXXX@XXXXX.COM 


RE: Help w/Class::Date Date.xs

Postby perl » Thu, 16 Oct 2003 11:13:54 GMT

Hanks alot for the install info. But I would like your opinion for the
following questions:

1 - Do you think that it will work without installing the XS? It seems to
be working fine but it is giving me a warning message all the time.

2 - DO I need to worry about it messing anything (kernel/perl
installation) if I were to compile and install this module?

thanks,
-rkl




-----------------------------------------
eMail solutions by
http://www.swanmail.com

RE: Help w/Class::Date Date.xs

Postby tn » Thu, 16 Oct 2003 12:45:00 GMT

Hi,

I suggest always taking a glance at the documentation that comes with
the module.  Most of that should be in the perldoc, so for Class::Date
you can run "perldoc Class::Date".  Sometimes it is useful also to look
in the source directory at the README and INSTALL files and examples if
any.  I paged through the perldoc Class::Date and found several
interesting pieces of information near the end.  It shows how to turn
off warnings about the missing XS part and some other interesting info
including where to get a binary version for Win32 -- see below.  There
should be no problem installing the module from sources since it will be
installed in a way that does not conflict with any other modules, and
loading its lib will only add uniquely identified functions to the
runtime perl process so they won't be mistaken for or overlap with
anything else.  Note also that there is a special mail group dedicated
to Date::Calc and the author has provided his email address.  If you're
really concerned about the Date::Calc installation messing things up,
you can make a backup copy of /usr/lib/perl5/ beforehand for later
regression if desired. 

-tristram

WORKING WITHOUT A C COMPILER
...
 You can use the $WARNINGS switch to switch off the complains about the
 missing XS part from your perl program:

        BEGIN { $Class::Date::WARNINGS=0; }
        use Class::Date;
        ...
     
SPEED ISSUES
    ...
    In general, if you really need fast date and datetime calculation,
don't
    use this module. As you see in the previous section, the focus of
    development is not the speed in 1.0. For fast date and datetime
    calculations, use Date::Calc module instead.

BUGS AND LIMITATIONS
    *   I cannot manage to get the timezone code working properly on
        ActivePerl 5.8.0 on win XP and earlier versions possibly have
this
        problem also....

SUPPORT
    Class::Date is free software. IT COMES WITHOUT WARRANTY OF ANY KIND.

    If you have questions, you can send it to the Class::Date mailing
list:

       XXXX@XXXXX.COM 

    You can subscribe to this list by a web-interface:

       http://www.**--****.com/ 

WIN32 notes
    You can get a binary win32 version of Class::Date from Chris
Winters'
    .ppd repository with the following commands...

AUTHOR
      dLux < XXXX@XXXXX.COM >



RE: Help w/Class::Date Date.xs

Postby perl » Thu, 16 Oct 2003 13:11:13 GMT

fyi, I'm on the redhat linux. Well ths this the first I saw about
Date::Calc. In any case, I have a pretty straight forward requirements and
will ask you or anyone familiar dates for recommendation. Taking into
consideration my requirements, what is the best date modules available
that you can recommend?

Requirements:

- increment date by sec,min,hour,day,month and year
- I'd would use the localtime if I can figure out how to calculate
incrementing by days and handling 28,29,30,31 days of the month.
- the ability to access and format the output as in localtime.

thanks,
-rkl




-----------------------------------------
eMail solutions by 
 http://www.**--****.com/ 

Re: Help w/Class::Date Date.xs

Postby perl » Thu, 16 Oct 2003 13:33:01 GMT

Your response is great!

Being new to the environment, simple and fundamental things can be
frustrating.  Your step-by-step instruction not only made it possible to
install but it gave me a clue into understanding how the perl/cpan are
structured/organized.

I just have a follow-up question. Is this the best date module or are
there more popular one?

thanks,
-rkl






-----------------------------------------
eMail solutions by 
 http://www.**--****.com/ 

Re: Help w/Class::Date Date.xs

Postby perl » Thu, 16 Oct 2003 13:43:05 GMT

> [panda]$ perl -MDate::Class -le 'print $INC{"Date/Class.pm"}'

Do you think you meant this?


thanks
-------------------







-----------------------------------------
eMail solutions by 
 http://www.**--****.com/ 

Re: Help w/Class::Date Date.xs

Postby dzhuo » Fri, 17 Oct 2003 07:52:27 GMT




i don't know what your needs are so i don't know what will be the best 
date/time module for you. my personal favorite date/time module is 
Date::Manip.

david
-- 
$_=q,015001450154015401570040016701570162015401440041,,*,=*|=*_,split+local$";
map{~$_&1&&{$,<<=1,$#.=qq~\x63\x68\x72\x28@_[$_..$||3])=>~}}0..s~.~~g-1;*_=*#,

goto=>print+eval

Similar Threads:

1.class DBI postgres date time format

How do I set up table class method to correctly format and write 
'updated'  column  date and time stamp to postgres?

I have table entry object that contains this - to inflate and deflate :

I think I need to add  "has_timestamp" 

.....

     22 __PACKAGE__->table('dhcpmac');
     23 __PACKAGE__->columns( Primary => qw/rowid/ );
     24 __PACKAGE__->columns( All => qw/rowid mac calnetuid updated 
updatedby dynhostname ishmael disable/ );
     25
     26 __PACKAGE__->has_a( updated => 'DateTime',
     27                     inflate => sub { 
DateTime::Format::Pg->parse_timestamptz(shift); },
     28                     deflate => sub { 
DateTime::Format::Pg->format_timestamptz(shift); } );

...

my CGI  does this :

...
#  retrieve old row data 
    301          my $delta_row = IST::DNSDB::dhcpmac->retrieve($old_rowid) ;
    302          my $old_mac = $delta_row->mac();
 ...
#  replace some of the data - including 'updated'
    305          $delta_row->mac($new_validated_mac);
    306              $delta_row->updated( "now()" );
..
    308          $delta_row->updatedby($calnetuid);
...
    313           $delta_row->update();
    314           $delta_row->commit();

( line 306 crashes with invalid SQL command line value, obviously, but 
what goes here? )

?

TIA,
Ken Uhl,
UC Berkeley
 

  

2.Comparing file dates with current date

I am trying to compare a file's modified timestamp with the current date.
 
I can use 'stat' to get the timestamp of the file but am not sure how to compare it to the localtime(). More importantly I want to be able to quantify the difference in days, month, hours and minutes. 
 
Any suggestions?
 

3.compare last access date of a file in windows to current date

Hi all,

  I am new to perl and am working on in a Windows 2000 enviroment. I
have the need to compare the last access time of a file to the system
date and if it is greater that 2 weeks prior to the system date write
that file to a text file that will be used to archive the file.

  Any help would be appreciated.
  Thanks
  matt

4.date --date : the perl way

I need to get the past 5(x) months for certaing calculations. What I 
have is listed below:

########################################
my $year, $month_str, $month_int;


foreach my $count (1..5) {
                 $year = `date --date '$count months ago' +"%Y"`;
                 chop($year);
                 $month_str =`date --date '$count months ago' +"%b"`;
                 chop($month_str);
                 $month_int =`date --date '$count months ago' +"%m"`;
                 chop($month_int);
                 print "\n $year:$month_str:$month_int";

}
########################################

This works as expected, the problem is I am using a shell command and I 
would like to move away from it. Is the perl module that is able to take
parameters juat like the 'date' command?

5.RFC: Date::Extract::P800Picture - gets YMDH encoded date from image filename

6. how to get tomorrow date using Date::CALC

7. Class::Date

8. okcupid dating - Free Online Dating



Return to PERL

 

Who is online

Users browsing this forum: No registered users and 68 guest