Gossamer Forum
Quote Reply
GT::Date problem?
Hi. I'm having a bit of a weird problem with the GT::Date module. I have the following script;

Code:
#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use strict;
use lib '/home/linkssql/public_html/cgi-bin/dev2/admin';
use Links qw/$CFG/;
use GT::Date;

local $SIG{__DIE__} = \&Links::fatal;

Links::init('/home/linkssql/public_html/cgi-bin/dev2/admin');
Links::init_user();


print "Content-type: text/html \n\n";
print "GT::Date: " . GT::Date::date_get() . "<BR>";
print "Localtime: " .localtime . "<BR>";
print "Time: " . time;

This prints out;

2002-06-02

In SSH, however, if I type;

Quote:
ssh: date
ssh: Mon June 2 14:21:45 GMT 2003
ssh:


As you can see, the year seems to be incorrect Unimpressed

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] GT::Date problem? In reply to
I ran the code from the shell, and it worked fine for me.

I also ran it from the web, and it ran fine.

Has to be something on your system not set up right.

All I changed was the path to admin.


PUGDOG´┐Ż Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] GT::Date problem? In reply to
It works fine on my server too. It only seems to have a problem on my clients site. Could it have something to do with the fact that its the German version, or a German server setup?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [pugdog] GT::Date problem? In reply to
Mmm...weird. It doesn't seem to be a problem with GT::Date, but more with the way their version of Perl handles it.

I have;

Code:
my $date1 = GT::Date::date_get();

my @exploded = split("-",$date1);

print "<BR><BR>1: " . $exploded[0]++ . "<BR>";
my $year = $exploded[0];
print "2: " . $year++ . "<BR>";

That prints out;

1: 2003
2: 2004

Ho wcome $exploded[0]++ does not increment the number? Is it because of modifying an array reference, rather than a variable? On the clients server it does stuff like

1: 1--
2: 2--

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] GT::Date problem? In reply to
Change:

$exploded[0]++

to

++$exploded[0]

Tongue
Quote Reply
Re: [Paul] GT::Date problem? In reply to
Whats the difference? I always thought ++$var aznd $var++ were the same? Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] GT::Date problem? In reply to
Nooo far from it.

++$var - PRE Increment
$var++ - POST Increment

Example:

Code:
my $var = 1;
my $new = $var++;

...$var is now 2 but $new is 1.

Code:
my $var = 1;
my $new = ++$var;

..$var and $new are both 2.
Quote Reply
Re: [Paul] GT::Date problem? In reply to
Aaahh...I see! I never knew that was a feature.

Thanks

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!