f



Is there a perl package, or data in a form easily used by a perl script, that can be used to determine when to change to or from daylight savings time?

NB: I have seen information about using the system's settings, but
that is not relevant to this problem.

I have a number of DB tables that have datetime values defined WRT UTC
time.  If all users could/would work with UTC, there'd be no problem.
I have stored, in a users table, the users' specific timezones.  So
far so good.  I can use Date::Manip to convert from UTC to each user's
timezone easily.  That is great!

However, in many localities, there is a need to switch to and from a
daylight savings time, and I can use the time zones defined in
Date::Manip to specify which users would be using daylight savings
time, but the problem is that using something like "EST5EDT" in either
$from or $to Date_ConvTZ($date1,$from,$to1); does nothing (i.e. the
value returned is identical to $date1).  In some respects, I was not
very surprised: unless there was some kind of database hidden in the
bowels of Date::Manip, it couldn't know when to switch to or from
daylight savings time based on the value of $date1.  I would not have
a problem creating my own function to do the converstion (dispatching
to Date_ConvTZ using, in the above example, either EST or EDT
depending on the value of the date to be converted), but the problem
is to know when to use EST and when to use EDT (or CET vs CEST, or CST
vs CDT, MST vs MDT, &c.).  The date on which the change happens is
different in different time zones (e.g. compare CET#CEST vs EST#EDT).
And I'd need this to be correct even though conventions on use of
daylight savings times are subject to change (as in the US a year or
two back).

So, is there a package that you can recommend that handles this
cleanly, or is there a database/flat data file that can be easily
loaded into an RDBMS such as MySQL, PostgreSQL, MS SQL Server, that I
could use to solve this?  I have downloaded and installed a large
number of time related packages using PPM (Activestate Perl 5.10.0 on
Windows XP), but none of the ones I have examined address this
particular issue.  I am so frustrated in my search on this that until
I find an adequate solution, the policy we've adopted is to put the
onus on the client to tell us whether or not he wants reports using
daylight savings times, and if so, when the transitions to and from
daylight savings time happens.  I would be grateful if someone could
point me to an option that is more user friendly.

Thanks

Ted
0
11/6/2008 10:00:36 PM
comp.lang.perl.misc 33233 articles. 2 followers. brian (1246) is leader. Post Follow

23 Replies
1039 Views

Similar Articles

[PageSpeed] 33

Ted Byers wrote:
> NB: I have seen information about using the system's settings, but
> that is not relevant to this problem.

Could the subject be a little longer???

> 
> I have a number of DB tables that have datetime values defined WRT UTC
> time.  If all users could/would work with UTC, there'd be no problem.
> I have stored, in a users table, the users' specific timezones.  So
> far so good.  I can use Date::Manip to convert from UTC to each user's
> timezone easily.  That is great!
> 
> However, in many localities, there is a need to switch to and from a
> daylight savings time, and I can use the time zones defined in
> Date::Manip to specify which users would be using daylight savings
[...]

It's saving daylight, so there's only one 's' in daylight saving time.

Lots of help/discussions/people who can help at:

http://datetime.perl.org/
0
J
11/6/2008 10:13:35 PM
[A complimentary Cc of this posting was sent to
Ted Byers 
<r.ted.byers@gmail.com>], who wrote in article <ebcdea05-d888-49b5-85d7-af75cd4996b8@d36g2000prf.googlegroups.com>:
> However, in many localities, there is a need to switch to and from a
> daylight savings time, and I can use the time zones defined in
> Date::Manip to specify which users would be using daylight savings
> time, but the problem is that using something like "EST5EDT" in either
> $from or $to Date_ConvTZ($date1,$from,$to1); does nothing (i.e. the
> value returned is identical to $date1).  In some respects, I was not
> very surprised: unless there was some kind of database hidden in the
> bowels of Date::Manip, it couldn't know when to switch to or from
> daylight savings time based on the value of $date1.

There is a notion of "timezone".  A timezone uniquely determines the
mapping GMT --> local time.  "EST5EDT" is not a timezone.

E.g., on this computer, I do

   >echo $TZ
   US/Pacific

It is a function of kernel/CRT library to have a database of
timezones.  On capable systems, you should do

   $ENV{TZ} = 'US/Pacific';
   POSIX::settz();			# sp?  tzset()?
   print scalar localtime time;

and get the correct local time.

Hope this helps,
Ilya
0
Ilya
11/7/2008 1:25:41 AM
On Nov 6, 8:25=A0pm, Ilya Zakharevich <nospam-ab...@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> Ted Byers
> <r.ted.by...@gmail.com>], who wrote in article <ebcdea05-d888-49b5-85d7-a=
f75cd499...@d36g2000prf.googlegroups.com>:
>
> > However, in many localities, there is a need to switch to and from a
> > daylight savings time, and I can use the time zones defined in
> > Date::Manip to specify which users would be using daylight savings
> > time, but the problem is that using something like "EST5EDT" in either
> > $from or $to Date_ConvTZ($date1,$from,$to1); does nothing (i.e. the
> > value returned is identical to $date1). =A0In some respects, I was not
> > very surprised: unless there was some kind of database hidden in the
> > bowels of Date::Manip, it couldn't know when to switch to or from
> > daylight savings time based on the value of $date1.
>
> There is a notion of "timezone". =A0A timezone uniquely determines the
> mapping GMT --> local time. =A0"EST5EDT" is not a timezone.
>
True.  But Date::Manip uses it as a convention for indicating that the
machine uses both EST and EDT.  It works OK when I am working on times
relevant to my local machine.  But my current problem is that the
times in question are stored in a database in UTC times, and really
have nothing to do with the timezone that applies to the server
running the DB.  It is in the midwest US while the institution that is
the source of the data is in central Europe and we have clients on,
for example, the west coast of the US.

> E.g., on this computer, I do
>
> =A0 =A0>echo $TZ
> =A0 =A0US/Pacific
>
> It is a function of kernel/CRT library to have a database of
> timezones. =A0On capable systems, you should do
>
> =A0 =A0$ENV{TZ} =3D 'US/Pacific';
> =A0 =A0POSIX::settz(); =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0# sp? =
=A0tzset()?
> =A0 =A0print scalar localtime time;
>
> and get the correct local time.
>
> Hope this helps,
> Ilya


What you suggest is applicable to various tasks on my own machine, but
actually I already have that working already.  My problem involves
converting times that apply to one institution on the other side of
the planet into timezones that are on the other side of this
continent.  I don't see how working wih my own local time helps.

Thanks anyway Ilya
0
Ted
11/7/2008 2:09:01 AM
On Nov 6, 5:13=A0pm, "J. Gleixner" <glex_no-s...@qwest-spam-no.invalid>
wrote:
> Ted Byers wrote:
> > NB: I have seen information about using the system's settings, but
> > that is not relevant to this problem.
>
> Could the subject be a little longer???
>

I could try to get it longer, but my fingers would get too tired.  ;-)
>
>
> > I have a number of DB tables that have datetime values defined WRT UTC
> > time. =A0If all users could/would work with UTC, there'd be no problem.
> > I have stored, in a users table, the users' specific timezones. =A0So
> > far so good. =A0I can use Date::Manip to convert from UTC to each user'=
s
> > timezone easily. =A0That is great!
>
> > However, in many localities, there is a need to switch to and from a
> > daylight savings time, and I can use the time zones defined in
> > Date::Manip to specify which users would be using daylight savings
>
> [...]
>
> It's saving daylight, so there's only one 's' in daylight saving time.
>
> Lots of help/discussions/people who can help at:
>
> http://datetime.perl.org/

OK Thanks.  I'll take a look there and see what progress I can make.

Thanks

Ted
0
Ted
11/7/2008 2:12:43 AM
Ted Byers schreef:
> Ilya Zakharevich:

>> $ENV{TZ} = 'US/Pacific';
>> POSIX::settz(); # sp? tzset()?
>> print scalar localtime time;
>>
>> and get the correct local time.
>
> What you suggest is applicable to various tasks on my own machine, but
> actually I already have that working already.  My problem involves
> converting times that apply to one institution on the other side of
> the planet into timezones that are on the other side of this
> continent.  I don't see how working wih my own local time helps.

Huh? Just put a different timezone string in $ENV{TZ}, right?

-- 
Affijn, Ruud

"Gewoon is een tijger."

0
Dr
11/7/2008 8:05:31 AM
"Dr.Ruud" <rvtol+news@isolution.nl> wrote in message 
news:gf10hd.29k.1@news.isolution.nl...
> Ted Byers schreef:
>> Ilya Zakharevich:
>
>>> $ENV{TZ} = 'US/Pacific';
>>> POSIX::settz(); # sp? tzset()?
>>> print scalar localtime time;
>>>
>>> and get the correct local time.
>>
>> What you suggest is applicable to various tasks on my own machine, but
>> actually I already have that working already.  My problem involves
>> converting times that apply to one institution on the other side of
>> the planet into timezones that are on the other side of this
>> continent.  I don't see how working wih my own local time helps.
>
> Huh? Just put a different timezone string in $ENV{TZ}, right?

Yes but is there some 'authorative source' of what all the different 
timezones are and the daylight times for those zones and when they switch 
back and forth?

P 

0
Peter
11/7/2008 9:42:05 AM
Peter Wyzl wrote:
> is there some 'authorative source' of what all the different 
> timezones are and the daylight times for those zones and when they 
> switch back and forth?
> 

Since those things are a matter of political whim I doubt there is a 
source I would be happy labelling authoritative for the whole planet.

Try
http://www.twinsun.com/tz/tz-link.htm

-- 
RGB
0
RedGrittyBrick
11/7/2008 10:51:46 AM
Peter Wyzl schreef:

> but is there some 'authorative source' of what all the different
> timezones are and the daylight times for those zones and when they
> switch back and forth?

I use DateTime::TimeZone which uses Olson. Good enough for me. 
http://search.cpan.org/search?query=timezone&mode=module 

-- 
Affijn, Ruud

"Gewoon is een tijger."
0
Dr
11/7/2008 11:26:00 AM
On Fri, 07 Nov 2008 10:51:46 +0000, RedGrittyBrick <RedGrittyBrick@spamweary.invalid> wrote:

>
>Peter Wyzl wrote:
>> is there some 'authorative source' of what all the different 
>> timezones are and the daylight times for those zones and when they 
>> switch back and forth?
>> 
>
>Since those things are a matter of political whim I doubt there is a 
>source I would be happy labelling authoritative for the whole planet.
>
>Try
>http://www.twinsun.com/tz/tz-link.htm

Its the alias for $GOD

sln

0
sln
11/7/2008 11:39:59 AM
On Nov 7, 3:05=A0am, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> Ted Byers schreef:
>
> > Ilya Zakharevich:
> >> $ENV{TZ} =3D 'US/Pacific';
> >> POSIX::settz(); # sp? tzset()?
> >> print scalar localtime time;
>
> >> and get the correct local time.
>
> > What you suggest is applicable to various tasks on my own machine, but
> > actually I already have that working already. =A0My problem involves
> > converting times that apply to one institution on the other side of
> > the planet into timezones that are on the other side of this
> > continent. =A0I don't see how working wih my own local time helps.
>
> Huh? Just put a different timezone string in $ENV{TZ}, right?
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."

Actually no.  This is to interact with a database on a server that
serves a web application.  Messing with the environment settings on
the server for the timezone is guaranteed to fail.  For example, there
could be simultaneous requests for data applicable to different
locations.  Something like the function Date_ConvTZ($date,$from,$to)
in Date::Manip is required instead but which would make use of the
olson database you mentioned in another post to know when either
timezone should  use daylight saving time.

Since you said you use DateTime::TimeZone, can you tell me an example
of how to use it to take a date that, say, ParseDate($string), from
Date::Manip, would return and convert it from one timezone to another
using Olson's database to taking daylight saving time into account (in
effect making something like Date_ConvTZ that would work with the
EST5EDT that Date::Manip uses in other functions).

Thanks

Ted
0
Ted
11/7/2008 1:42:06 PM
On Nov 7, 6:39=A0am, s...@netherlands.com wrote:
> On Fri, 07 Nov 2008 10:51:46 +0000, RedGrittyBrick <RedGrittyBr...@spamwe=
ary.invalid> wrote:
>
> >Peter Wyzl wrote:
> >> is there some 'authorative source' of what all the different
> >> timezones are and the daylight times for those zones and when they
> >> switch back and forth?
>
> >Since those things are a matter of political whim I doubt there is a
> >source I would be happy labelling authoritative for the whole planet.
>
> >Try
> >http://www.twinsun.com/tz/tz-link.htm
>
> Its the alias for $GOD
>
> sln

That gives you the olson data that Dr Ruud mentioned.  I have
downloaded that and am presently trying to figure out how to use it.
found a couple scripts in the timezone project: parse_olson and
update_from_latest_olson. I can't use the latter since it is written
explicitly using programs and paths found on Unix and not, normally,
on Windows, but parse_olson looks like it may work for me.  I'll know
later today if it does.  But I am still looking through the
documentation for DateTime::TimeZone to see how to use it to convert,
e.g., a time from UTC to "EST5EDT" (as defined in Date::Manip), using
either EST or EDT on the right dates.

Thanks

Ted
0
Ted
11/7/2008 1:50:34 PM
"Peter Wyzl" <placebo@petergreen.id.au> wrote:
>Yes but is there some 'authorative source' of what all the different 
>timezones are and the daylight times for those zones and when they switch 
>back and forth?

Impossible. If it were by country then at least you would have a chance.
But there are so many special rules and exceptions, in particular in the
US where even individual counties deviate from their state, not to
mention indian reservations that do or do not, etc, etc. It's just plain
a mess.

jue
0
J
11/7/2008 2:55:40 PM
[A complimentary Cc of this posting was sent to
Peter Wyzl
<placebo@petergreen.id.au>], who wrote in article <N3UQk.11775$sc2.8565@news-server.bigpond.net.au>:
> >> What you suggest is applicable to various tasks on my own machine, but
> >> actually I already have that working already.  My problem involves
> >> converting times that apply to one institution on the other side of
> >> the planet into timezones that are on the other side of this
> >> continent.  I don't see how working wih my own local time helps.
> >
> > Huh? Just put a different timezone string in $ENV{TZ}, right?
> 
> Yes but is there some 'authorative source' of what all the different 
> timezones are and the daylight times for those zones and when they switch 
> back and forth?

As I said, your kernel/CRTL should already contain such a database.  I
would try to follow links starting with

  man tzset

to find a way to query the names of the zones...

Hope this helps,
Ilya
0
Ilya
11/7/2008 7:30:32 PM
"Ilya Zakharevich" <nospam-abuse@ilyaz.org> wrote in message 
news:gf250o$1bnc$1@agate.berkeley.edu...
> [A complimentary Cc of this posting was sent to
> Peter Wyzl
>>
>> Yes but is there some 'authorative source' of what all the different
>> timezones are and the daylight times for those zones and when they switch
>> back and forth?
>
> As I said, your kernel/CRTL should already contain such a database.  I
> would try to follow links starting with
>
>  man tzset
>
> to find a way to query the names of the zones...

If I wasn't one of the large % of users who don't have a kernel as such, 
that might be helpful.

P 

0
Peter
11/7/2008 11:19:48 PM
On Nov 7, 6:26=A0am, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> Peter Wyzl schreef:
>
> > but is there some 'authorative source' of what all the different
> > timezones are and the daylight times for those zones and when they
> > switch back and forth?
>
> I use DateTime::TimeZone which uses Olson. Good enough for me.http://sear=
ch.cpan.org/search?query=3Dtimezone&mode=3Dmodule
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."

I have downloaded the Olson timezone data, and executed the script
"parse-olson.pl".  It created a directory called lib that contains the
timezone data transformed into *.pm files in a number of directories.
I have perl installed in C:\Perl.  Do I just copy the files and
folders created by parse_olson.pl into C:\Perl\site, over-writing
what's already there?

Thanks

Ted
0
Ted
11/8/2008 12:08:20 AM
[A complimentary Cc of this posting was sent to
Peter Wyzl
<placebo@petergreen.id.au>], who wrote in article <o24Rk.12858$sc2.2859@news-server.bigpond.net.au>:

> If I wasn't one of the large % of users who don't have a kernel as such, 

And who do you think runs your Perl?  Maybe the BIOS?  ;-)

Anyway, POSIX::tzset will run tzset() function of the CRTL of (your?)
compiler.  Its documentation may also contain a list...

(But probably tzset() is very crippled on Win*...)

Yours,
Ilya

0
Ilya
11/8/2008 9:09:29 AM
On Sat, 8 Nov 2008 09:09:29 +0000 (UTC),
	Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
> [A complimentary Cc of this posting was sent to
> Peter Wyzl
><placebo@petergreen.id.au>], who wrote in article
><o24Rk.12858$sc2.2859@news-server.bigpond.net.au>:
>
>> If I wasn't one of the large % of users who don't have a kernel as such, 
>
> And who do you think runs your Perl?  Maybe the BIOS?  ;-)
>
> Anyway, POSIX::tzset will run tzset() function of the CRTL of (your?)
> compiler.  Its documentation may also contain a list...

THis is the second time you've used the (presumably) acronym CRTL. What
exactly do you mean by that? I don't know the term, and Google,
Wikipedia freedictionary and the hacker's dictionary also don't seem to
help.

Martien
-- 
                        | 
Martien Verbruggen      | Make it idiot proof and someone will make a
                        | better idiot.
                        | 
0
Martien
11/8/2008 10:13:54 AM
On Sat, 08 Nov 2008 21:13:54 +1100, Martien Verbruggen wrote:

> THis is the second time you've used the (presumably) acronym CRTL. What
> exactly do you mean by that? I don't know the term, and Google,
> Wikipedia freedictionary and the hacker's dictionary also don't seem to
> help.

C RunTime Library, aka CRT.

M4
0
Martijn
11/8/2008 2:38:56 PM
Ted Byers schreef:
> Dr.Ruud:
>> Peter Wyzl:

>>> but is there some 'authorative source' of what all the different
>>> timezones are and the daylight times for those zones and when they
>>> switch back and forth?
>>
>> I use DateTime::TimeZone which uses Olson. Good enough for
>> me.http://search.cpan.org/search?query=timezone&mode=module
>
> I have downloaded the Olson timezone data, and executed the script
> "parse-olson.pl".  It created a directory called lib that contains the
> timezone data transformed into *.pm files in a number of directories.
> I have perl installed in C:\Perl.  Do I just copy the files and
> folders created by parse_olson.pl into C:\Perl\site, over-writing
> what's already there?

I have no clue what you are trying to achieve, or rather mess up, so I
can't anwer that question.
But if you want to install specific Perl modules on a Windows system in
a clean way, just use the latest ActiveState or the Vanilla Perl tools.

-- 
Affijn, Ruud

"Gewoon is een tijger."

0
Dr
11/9/2008 10:27:07 AM
On Nov 9, 5:27=A0am, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
> Ted Byers schreef:
>
> > Dr.Ruud:
> >> Peter Wyzl:
> >>> but is there some 'authorative source' of what all the different
> >>> timezones are and the daylight times for those zones and when they
> >>> switch back and forth?
>
> >> I use DateTime::TimeZone which uses Olson. Good enough for
> >> me.http://search.cpan.org/search?query=3Dtimezone&mode=3Dmodule
>
> > I have downloaded the Olson timezone data, and executed the script
> > "parse-olson.pl". =A0It created a directory called lib that contains th=
e
> > timezone data transformed into *.pm files in a number of directories.
> > I have perl installed in C:\Perl. =A0Do I just copy the files and
> > folders created by parse_olson.pl into C:\Perl\site, over-writing
> > what's already there?
>
> I have no clue what you are trying to achieve, or rather mess up, so I
> can't anwer that question.
> But if you want to install specific Perl modules on a Windows system in
> a clean way, just use the latest ActiveState or the Vanilla Perl tools.
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."

All I'm after is to make sure the timezone data I have is up to date.
I routinely use ActiveState's PPM to install packages, and I use CPAN
as a fallback option when the package I'm after isn't in a PPM
repository.  The documentation for DateTime::TimeZone doesn't say
which version of the Olson data it uses, so I can't be sure it uses
the current Olson data unless someone can confirm that.

Thanks

Ted
0
Ted
11/11/2008 9:47:58 PM
Ted Byers schreef:

> The documentation for DateTime::TimeZone doesn't say
> which version of the Olson data it uses, so I can't be sure it uses
> the current Olson data unless someone can confirm that.

DateTime::TimeZone::Catalog->OlsonVersion() 

-- 
Affijn, Ruud

"Gewoon is een tijger."
0
Dr
11/12/2008 11:04:47 PM
On 2008-11-07 14:55, J�rgen Exner <jurgenex@hotmail.com> wrote:
> "Peter Wyzl" <placebo@petergreen.id.au> wrote:
>>Yes but is there some 'authorative source' of what all the different 
>>timezones are

These are notoriously incompatible between systems. For Linux just find
all files below /usr/share/zoneinfo. For Windows, there is probably some
API to get this information.

>>and the daylight times for those zones and when they switch 
>>back and forth?

For converting between UTC and some timezone, you don't have to know
that. Just tell the system which timezone to use. 

> Impossible. If it were by country then at least you would have a chance.
> But there are so many special rules and exceptions, in particular in the
> US where even individual counties deviate from their state, not to
> mention indian reservations that do or do not, etc, etc. It's just plain
> a mess.

That's why the Linux (or rather glibc) timezone system uses city names
as keys. So I use the "Europe/Vienna" timezone, and you would presumably
use the "Europe/Berlin" timezone (you may not live in Berlin, but AFAIK
all of Germany uses the the same DST rules - if the Bavarians had a
different system, there would be a "Europe/Munich" timezone. If there
are two different rules for different parts of a city, that can be
easily extended (for example, if the GDR used a different system than
the FRG, there could be a "Europe/East-Berlin" timezone).

	hp

0
Peter
11/15/2008 5:48:22 PM
On 2008-11-07 13:42, Ted Byers <r.ted.byers@gmail.com> wrote:
> On Nov 7, 3:05�am, "Dr.Ruud" <rvtol+n...@isolution.nl> wrote:
>> Ted Byers schreef:
>>
>> > Ilya Zakharevich:
>> >> $ENV{TZ} = 'US/Pacific';
>> >> POSIX::settz(); # sp? tzset()?
>> >> print scalar localtime time;
>>
>> >> and get the correct local time.
>>
>> > What you suggest is applicable to various tasks on my own machine, but
>> > actually I already have that working already. �My problem involves
>> > converting times that apply to one institution on the other side of
>> > the planet into timezones that are on the other side of this
>> > continent. �I don't see how working wih my own local time helps.
>>
>> Huh? Just put a different timezone string in $ENV{TZ}, right?
>
> Actually no.  This is to interact with a database on a server that
> serves a web application.  Messing with the environment settings on
> the server for the timezone is guaranteed to fail.

The environment of a unix machine is a per-process property. Changing
the environment of one process doesn't affect other processes at all.

> For example, there could be simultaneous requests for data applicable
> to different locations.

That would only be a problem if these requests are served by the same
process and this process interleaves processing of these requests.

	hp
0
Peter
11/15/2008 5:53:53 PM
Reply:

Similar Artilces:

Problem in passing values to perl script using another perl script
hi i have two perl scripts user.pl and user_database.pl user.pl #script store in /home/bob directory -------------------------------- #!/usr/bin/perl print"Enter the user name"; $name = <STDIN>; print "$name"; ---------------------------------- user_database.pl # script store in /home/bob directory ---------------------------------- #!/usr/bin/perl $user_name = "BOB"; system("perl /home/bob/user.pl"); -------------------------------- # output after running user_database.pl Enter the user name It asked me to e...

deisng perl perl programmibng langs in perl
then liberate big war zones with notes on their download pages. -r www.thevoid1.net/ ...

how can i convert my perl script to be a perl module?
Hello, how can i convert my perl script to be a perl module? Have i just rename it to log2db.pm ? #log2db.pl use DBI; use File::Tail; my $fname = $ARGV[0]; #$fname = '/var/log/syslog'; my $host = $ENV{'HOSTNAME'}; my $dbh = DBI->connect("DBI:mysql:database=testdb;host=rettung", "log4", "l12345", {'RaiseError' => 1}); my $table = 'log4perl'; my @fields = qw( log_timestamp level1 method message ); my $fields = join(', ', @fields); my $sql = "INSERT into $table ($fields) values (?,?,?,?)"; my $sth = $dbh->p...

build_dir/perl uses /usr/lib/perl !?
I'm doing a re-installation of Perl 5.8.2-2, because the currently installed version has threads enabled, which I don't want. When I do make test, 2 tests fail. Not surprisingly, these tests also fail when I run them individually using: bash-2.05b$ LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH; export LD_LIBRARY_PATH; cd t; ./perl harness <test_file> The first failing test (run/fresh_perl.t) fails with the error: /home/knight/build/perl-5.8.2/perl: relocation error: /usr/lib/perl/5.8.2/auto/NDBM_File/NDBM_File.so: undefined symbol: Perl_Gthr_key_pt which suggests that the perl...

how can i run a perl script using expect?
hi everybody i want to run one perl script with three inputs inside the expect script i dont know how to automatically run the perl script with three inputs ..... can u please guide me asap.... thanx n adv sk sk schreef: > hi everybody > i want to run one perl script with three inputs inside the expect > script > i dont know how to automatically run the perl script with three inputs > .... > > can u please guide me asap.... > > thanx n adv > sk You would start the Perl script in much the same way as any other program, via the exp_spawn command. You can then use exp_send to send the input that is required to the child process. Regards, Arjen In article <1152102586.319909.80080@j8g2000cwa.googlegroups.com>, Arjen Markus <arjen.markus@wldelft.nl> wrote: > >sk schreef: > >> hi everybody >> i want to run one perl script with three inputs inside the expect >> script >> i dont know how to automatically run the perl script with three inputs >> .... >> >> can u please guide me asap.... >> >> thanx n adv >> sk > >You would start the Perl script in much the same way as any >other program, via the exp_spawn command. > >You can then use exp_send to send the input that is required >to the child process. . . . Depending on what you mean by "three inputs", there might well be an easier, perhaps much easier, "pure-Tcl" sol...

can i use libwww-perl to fill in blanks on page that uses javascript?
Hi, Pretty facile question maybe: I'm not sure I understand if the libwww-perl library's ways of using the HTTP protocol will provide me the ability to fill in a javascript section of a web page just as it does with normal forms. Here's the snippet of code from the site. I'm interesting in automatically 'filling in' (the latitude/longitude ranges). I want to change them from the defaults of -180,180,-90,90. This code appears on the site as blanks to manually enter in latitude/longitude ranges; it's next to a click-drag map to do the same that I'm not using. function jsLoad() { if (document.applets.length>0) { it_is_loaded=true; document.map.positionTool(0, -180.0, 180.0, -90.0, 90.0); } } "Erick" <erick@cook.rm-this-word.met.edu> writes: > Pretty facile question maybe: I'm not sure I understand if the > libwww-perl library's ways of using the HTTP protocol will provide me the > ability to fill in a javascript section of a web page just as it does with > normal forms. Well, usually what ultimately goes to the HTTP server is still a simple HTML form submission even if there's client side JS to construct it. Perhaps you shoulsd use a web scraping proxy. -- \\ ( ) . _\\__[oo .__/ \\ /\@ . l___\\ # ll l\\ ###LL LL\\ ...

Can perl start another perl script and then exit?
I need to have a perl script start another script and then exit, returning completed header information to a web page. The other program will continue running on the server processing some pdf files, and when done it will set a flag. The web page, once it initiates the 1st program (which starts the background program) and receive the status from the 1st program (using flash) will then start a 3rd program, which checks for the "done flag", if it isn't set it will tell the web page (flash) to try again. This will continue to the 2nd program is complete. So, can I start a 2nd scri...

perl script invoking a chain of other perl scripts ....
Hi , this question deals with a perl script that calls other perl scripts using 'exec' or 'system' call. I think it is a mute point and of no concern but I decided to ask just to be sure. Bascially I have something like this : Calling script file ---> #!/usr/bin/perl ..... ..... ..... my $cdpat2 = 'C:\Program Files'; my $cdpat1 = 'C:\DIR1 my $cdpat3 = 'C:\DIR2\STUFF\bin'; exec ("CalledScript1.pl $cdpath1 $cdpath2 $cdpath3"); exec ("CalledScript2.pl $cdpath1 $cdpath2 $cdpath3"); The question I have is that, do I need to worry about t...

Running a Perl script from another Perl script
Hi all, I have two scripts: 1/ parser.pl which parses a text file and stuffs the relevant data into a mySQL DB - works fine no probs there 2/ importer.pl which I want to run through all the relevant files in a directory and run them through parser.pl I've got importer.pl to the stage where it can run through a directory and select the correct files to be processed, but I'm not sure how to pass each file over to parser.pl. I also need it to wait until parser.pl has finished processing a file before it passes it another file to process. I've read the fantastic Perl Cookbook but ...

Use of Java script to validate form fields in Perl
Hi All, I am trying to use Java script to validate the form fields. The code is written in Perl and it is having a .pm extension for this form also there is a index.pl file which is containing the "Save" button and the form is posting the data to index.pl file and then it again comes to the methods written in the .pm file which is validating the form using server side code and submit that. But I am not able to get that where to do the Java script validation that will validate the form in the client side. Here I am having some codes that will give some idea about my form. <code&g...

A question about Perl: using perl command line to replace strings...
I have a quick question, how to change a string "abcd" to another string "xyabcd" in all the *.m (text) files under current directory? I defintely can write a perl script to do this. But I remember there is a most simple way of doing this using Perl. It is just "Perl xxxxxxxxxxxxxxxx" a command line with some options... It just escaped my memory, anybody knows how to do that please give me a hand! Thanks a lot. "lucy" <losemind@yahoo.com> wrote in news:ch550l$j1t$1@news.Stanford.EDU: > I have a quick question, how to change a string...

Using Expect to spawn a perl process which spawns another perl process
Hi, I'm using exp_spawn in TCL to spawn a perl script. This is my TCL: package require Expect cd "C:\\path_to_perl_script" set exp::winnt_debug 1 exp_spawn perl perlscript.perl And perlscript.perl looks like this: #!/usr/local/bin/perl use strict; use warnings; use Win32::Process; print "\nTest started.. sleeping 5 secs\n"; sleep 5; print "\nRunning new perl script..\n"; my $perl = $^X; my $probj; my $cmd = sprintf "perl test.perl"; Win32::Process::Create($probj, $perl, $cmd, 0, 0, "."); print "\nScript done!\n&...

Trouble running Perl script from within a Perl script
Hi, I'm using Perl 5.10.1 on Ubuntu Linux 11.04. I want to run a Perl script B from within Perl script A. I can run Perl script B fine from the bash shell, but when I try and run it within Perl script A, it fails to execute with a "No such file or directory " error. I'm hoping someone might have some advice about what I'm overlooking. Here's how I create and spawn Perl script B ... my $cmd = "perl /opt/scripts/selenium/generate_test_suite.pl \"$ {project} USA Tests - ${module}\" \"$destTestDir\" \"$testSuiteFile\" "; runShellCommand( $cmd ); sub runShellCommand { my $cmd = shift; print "running command $cmd ...\n"; open(F, "$cmd") or die "Can't execute command \"$cmd\": $!"; while (<F>) { print; } close(F); print "done.\n\n"; } Thanks, - Dave On 07/28/11 15:52, laredotornado@zipmail.com wrote: > Hi, > > I'm using Perl 5.10.1 on Ubuntu Linux 11.04. I want to run a Perl > script B from within Perl script A. I can run Perl script B fine from > the bash shell, but when I try and run it within Perl script A, it > fails to execute with a "No such file or directory " error. I'm > hoping someone might have some advice about what I'm overlooking. > > Here's how I create and spawn Perl script B ... > > > my $cmd = "perl /opt/scripts/selenium/gener...

perl -e "use Tk" failed after installing perl tk
Now I want to debug perl script through ptkdb under Windows XP. I installed perl tk 804.028 using the below command first because ptkdb depends on perl tk. ppm install Tk But some errors pop out when the command(perl -e "use Tk") exec after installing perl tk, " Can't locate Tk.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/ lib .) at -e line 1. BEGIN failed--compilation aborted at -e line 1. " ActivePerl: Build 1004 Perl: 5.10.0 On 19 mai, 15:30, Erik <zhengfen...@gmail.com> wrote: > Now I want to debug perl script through ptkdb under Windows XP. > > I installed perl tk 804.028 using the below command first because > ptkdb depends on perl tk. > =A0 =A0 =A0 =A0 =A0 ppm install Tk > > But some errors pop out when the command(perl -e "use Tk") exec =A0after > installing perl tk, > > " > Can't locate Tk.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/ > lib .) at -e > =A0line 1. > BEGIN failed--compilation aborted at -e line 1. > " > > ActivePerl: Build 1004 > Perl: 5.10.0 Try ppm install http://www.bribes.org/perl/ppm/Tk.ppd On 5=D4=C219=C8=D5, =CF=C2=CE=E710=CA=B137=B7=D6, genom...@gmail.com wrote: > On 19 mai, 15:30, Erik <zhengfen...@gmail.com> wrote: > > > > > Now I want to debug perl script through ptkdb under Windows XP. > > > I installed perl tk 804.028 using ...

Japanese forms using perl
Hi I am trying to make a form page in Japanese. Problem is in the conversion. Error pages, Confirmation and submitted email version shows un recognisable characters. Has anyone have a form which uses some sort of form.pl and works in Japanese language. I am doing this for a friend who speaks Japanese. So Language is not a problem . Problem is in the character encoding and conversion to screen and email format. If you do have , could you please let me work with it? Thanks FO This has nothing to do with Perl. Try to set the encoding to UTF-8, or Japanese Encoding like EUC-JP, or SHIFT-JIS. On Thu, 1 Jul 2004 18:25:12 +1000 "fo" <somewhere@downunder.com.au> wrote: > Hi I am trying to make a form page in Japanese. Problem is in the > conversion. > Error pages, Confirmation and submitted email version shows un > recognisable characters. > > > Has anyone have a form which uses some sort of form.pl and works in > Japanese language. I am doing this for a friend who speaks Japanese. > So Language is not a problem . Problem is in the character encoding > and conversion to screen and email format. > > If you do have , could you please let me work with it? > > Thanks > > FO > > Thanks but tried all that without any success. "Vito Corleone" <corleone@godfather.com> wrote in message news:20040702105004.4e9e2e3d.corleone@godfather.com... > This has nothing to do with Perl. Try to set...

using ftp from perl script
Hi I need to use ftp from perl script. below is the script. #!/opt/perl-5.600/bin/perl use strict; use Carp; use Socket; use FileHandle; use File::Basename; use File::Path; use Sybase::DBlib; print "FTP sequence initiated\n"; my $host = 'destination.remoste.host.com'; my $usr = ''user_name'; my $pass = 'passwd'; my $file = 'ftpfile.txt'; `ftp -n $host >/home/apariv/perl_learning/ftp.log <<END_SCRIPT`; `user $usr`; `$pass`; `lcd /home/apariv/perl_learning`; `put $file`; `quit`; #END_SCRIPT the script runs fine w/o any error.ftp.log file...

CGI: Execute a perl script inside another perl script
Hello, I am using perl scripts as CGI. What I want to do is to call another perl script where I only set environment variables (envCGI.pl). If I set these variables in my initial perl script, it works well (I get my HTML page) but if I call the other perl script, I get: [12/Jan/2005:10:43:22] failure ( 632): for host 10.70.176.104 trying to POST /surcouf.cgi, cgi_scan_headers reports: HTTP4044: the CGI program C:\Perl\bin\perl.exe did not produce a valid header (program terminated without a valid CGI header. Check for core dump or other abnormal termination). Here is my perl script: #!C:...

problem calling perl script from SOAP server perl script
Hi I am trying to call a perl script from SOAP server side perl script, but no luck. following is the SOAP server perl script where I call other perl script. read_query function writes to a file okay, but does nothing for the two system calls after that. Any ideas? thanks in advance #!/usr/bin/perl use lib '../lib'; use SOAP::Transport::HTTP; SOAP::Transport::HTTP::CGI -> dispatch_to('predictor') -> handle; package predictor; sub read_query{ my $file=$_[0]; open (fileOUT, "> dBDataFiles/$file"); foreach $line (@_) { print fileOUT &q...

Perl vs. perl
this is for T. do you know the difference between Perl (the language) and perl (the program)? let's hear you explain the difference. uri On 08/13/2015 08:07 PM, Uri Guttman wrote: > > this is for T. do you know the difference between Perl (the language) > and perl (the program)? let's hear you explain the difference. > > uri > Hi Uri, Homework! Homework! Why! Why! Why! K-I-D-S T-H-E-S-E D-A-Y-S! Wait! This is a test! Test! Test! I didn't know there was going to be a test! I over slept! My dog ate my paper! I went to Publik skool! AAAAHHHHHHHHHHHHH!!!!! Okay, I am up to this. I will take a whack at this. The only letter that is different is the "p" and the "P". p=80= 0x50=0101 0000 P=112=0x70=0111 0000 So the only difference is one bit. What? Heard that joke before? Don't like the quality of my jokes? Remember what you paid to read it! What? You want a better answer? Okay, try this one: <code> #!/usr/bin/perl use strict; use warnings; use diagnostics; use constant tab => chr ("9"); my @homework = qx ( perldoc perlfaq1 | col -b ); my $eof=scalar @homework; my $line=0; my $start=(-100); my @answer; my$FixMe; my $AnswerLine = 0; if ( index ( $^O, "linux" ) == (-1) ) { die "This bit of tomfoolery only works in Linux\n", "Cowardly exiting. Bummer Dude!\n\n"; } ...

using Perl
I generate an email using feedback data from our website in a cgi. The email is sent using sendmail on the ISP. I use a template form I found on the web and it works. BUT I really have no explanation for the required fields and or labels needed. Recommendation on where to find this info? ALSO, I want to send out the email in HTML format. Everything I have tried simply sends the HTML coding along as text. Got ideas? Frank FJRusso@Yahoo.com Frank J. Russo wrote: > I use a template form I found on the web and it works. BUT I really have no > explanation for the required fields and or labels needed. > > Recommendation on where to find this info? Probably on the web site you found this CGI or the template form. Or in a perl newsgroup, but don't forget to mention the name of this mail generating script as without this no really helpful hints can be given. > ALSO, I want to send out the email in HTML format. Everything I have tried > simply sends the HTML coding along as text. Got ideas? First, HTML formatting has not been the best invention in the long history of email. Second, lots of users tend to turn off HTML rendering in their clients. Third, very few libraries handle HTML mail generation the proper way and therefore cause more trouble than they're helpful. But as said, try your luck in some perl newsgroup. -- Marco Senft http://www.t2g.ch/ ...

Using Perl to get data from website
Previously, I have written a perl script to access data from this URL: http://www.bangkokflightservices.com/our_cargo_track.php Some sample: MAWB - Master Airwaybill Number 724-26332482 724-61480672 724-61441122 and this was the final URL: http://203.151.118.123:8090/showc_track.php?m_prefix=724&m_sn=26332482&h_prefix=HWB&h_sn= But, now there is a change on the website and I couldn't extract through the same script. One change I noticed is the URL has changed to: <iframe src="http://203.151.118.123:8090/showc_track.php? m_prefix=724&m_sn=26332482&h_prefix=HWB&h_sn=&ecy=e076438db64c6190f7b9689a379b7f7093368f1652d14db65fee1ab916713f3f5f4030f53369cb1f669614312c4748899c272f4d976a2b299274a21ad80fc072b1bab2ab1c181d08c670188722e51ec162f9ae337e3f2f132c88d249133815558d241ce8a4e9b3fa75c144268b9e901037c2c7257142ee42ff9b2bf2767f57ed62b94fd938ea4dd2b28c53fea6af74be&ch= " frameborder="0" scrolling="yes" height="700" width="100%"> </iframe> How can I programmatically obtain data for a list of MAWBs. Here is a sample script that I wrote which previously worked: #!/usr/bin/perl while (<>) { chomp; $mprefix = substr($_, 0, 3); $msn = substr($_, 4, 8); if (length($mprefix) ne 3) { next; } $currurl = 'http://203.151.118.123:8090/showc_track.php? m_prefix=' . $mprefix . '&m_sn=' . $msn . '&h_prefix=HWB&h_sn=&ecy=e076438db64c6...

Search using a variable in a Perl Script
I am searching "myfile.txt" which looks like this: Perl.1234 HTML.1234 PHP.1234 CGI.1234 I am trying to print a single line based on a variable name, such as "Perl" or "HTML". Maybe if I show you my code it will make more sense: my $value = param ('incoming_parameter') (e.g. 'Perl') open (LOG, "myfile.txt"); while (<LOG>){ if(/$value/){ <-Search for the word "Perl"??? print $_; <-If matched, print the current line. } } With an 'incoming_parameter' of "Perl", it should...

Question on using perl in a cgi script
This is a question about using perl in cgi. If this is not the proper perl forum, my apologies. I want to build a cgi script using perl that will continously loop through the following: a) read from a line from a one line file b) draw something on the screen based on that value (using gd) I can do this for one iteration of the loop. But how do I update the browser screen for multiple iterations? For other restrictions, I can not reload the entire page each time the script goes through the loop. I can only update the drawing (Step b). Thanks in advance for your help. q-rious <mittra@juno.com> writes: > This is a question about using perl in cgi. If this is not the proper > perl forum, my apologies. > > I want to build a cgi script using perl that will continously loop > through the following: > > a) read from a line from a one line file b) draw something on the > screen based on that value (using gd) > > I can do this for one iteration of the loop. But how do I update the > browser screen for multiple iterations? For other restrictions, I can > not reload the entire page each time the script goes through the > loop. I can only update the drawing (Step b). > You can't do that with static HTML and CGI, period. The only way to do this is using some sort of client side code to repeatedly GET the CGI script and use the output to update the page. The obvious candidate is JavaScript. Mart -- "We will need a lo...

how to use clearcase commands in perl script
Hi, Presently I am having a requirement to use clearcase commands in a perl script. The requirement is given below. 1)I will set my view manually from the command line in the unix prompt. 2)Afterwards from the perls script I have to set the configspecs A and shuld have to go to the where source code presents. 3) I will do some operations over here 4) Setting the other configspecs B and goes to the source code where it presents. 5) Doing some required tasks 6)Again setting back the config specs A In this one from step 2 to step 6 I have to perform in the perls script. I am ...

Web resources about - Is there a perl package, or data in a form easily used by a perl script, that can be used to determine when to change to or from daylight savings time? - comp.lang.perl.misc

Five points determine a conic - Wikipedia, the free encyclopedia
In Euclidean, non-projective geometry , just as two (distinct) points determine a line (a degree-1 plane curve), five points determine a conic ...

SocialCode Studies Top 500 Facebook Pages To Determine Best Practices For Engagement
... provider SocialCode examined engagement with Facebook posts from the social network’s top 500 pages from Aug. 1 through Oct. 20 to determine, ...

Facebook uses random sampling to determine app ratings and avoid manipulation
With its new App Center , Facebook ranks applications by star ratings, but unlike Apple and Android’s app platforms, the social network relies ...

Twitter Blog: Let your Tweets determine the 2012 Sprite Slam Dunk champi
Twitter Blog Let your Tweets determine the 2012 Sprite Slam Dunk champion 3366100333679041124 Thursday, February 23, 2012 This Saturday, four ...

How does the NYT determine which articles have comments? - Quora
On the The New York Times website, some articles have comment sections, and others don't. It seems like in general higher profile articles have ...

How to determine what Herbs and Spices go best with what dishes - YouTube
Grandma Storn's Herb Wheel is the essential tool for cooking delicious, healthy meals using Herbs and Spices!

Spring, spin and swing: Five factors to determine the 2015 Ashes
Osman Samiuddin cites the state of English pitches and spin effectiveness as among his five factors that will decide the 2015 Ashes series.

Embattled destroyer project to determine fate of local shipbuilding
The Abbott government has announced a rejig of the troubled Air Warfare Destroyer project that will serve as a test case for the future of naval ...

NSW election: small parties will determine who will be Premier
In 2011, voters brought about the political evisceration of the ALP after 16 long years in government. We witnessed some of the biggest swings ...

NFL, San Francisco 49ers, Houston Texans: Jarryd Hayne’s key dates to determine NFL future, starting ...
JARRYD Hayne will take his first competitive snap against NFL opposition this Sunday at 10am (AEST) when the San Francisco 49ers take on the ...

Resources last updated: 3/29/2016 6:23:20 AM