[17810] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5230 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 4 16:36:25 2001

Date: Thu, 4 Jan 2001 13:36:01 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <978644161-v9-i5230@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 4 Jan 2001     Volume: 9 Number: 5230

Today's topics:
        getline is getting many! god_of_pain@my-deja.com
    Re: getline is getting many! (Tad McClellan)
    Re: getline is getting many! <tony_curtis32@yahoo.com>
    Re: getting output from net::telnet <mcnuttj@nin.iats.missouri.edu>
        Groovy non-profit needs CGI help <office@sports4kids.org>
    Re: Groovy non-profit needs CGI help (Monte Phillips)
    Re: Groovy non-profit needs CGI help <feldspar@ix.netcom.com>
    Re: Groovy non-profit needs CGI help (Eric Bohlman)
    Re: Groovy non-profit needs CGI help <mischief@velma.motion.net>
        Hash in DB_File <jhiller@online-testing.net>
    Re: Hash in DB_File (mountainarts)
    Re: Hash in DB_File (Garry Williams)
    Re: Hash in DB_File (Garry Williams)
    Re: Hash in DB_File (Anno Siegel)
        Having trouble with simple cookie script. (Loans2001)
    Re: Having trouble with simple cookie script. (Garry Williams)
    Re: Having trouble with simple cookie script. <fozz@iodynamics.com>
        help about time difference <wstsoi@netvigator.com>
    Re: help about time difference arjenwiersma@my-deja.com
    Re: help about time difference (Garry Williams)
        Help connection to mysql <kf4dmb@net-magic.net>
    Re: Help connection to mysql francesc_guasch@my-deja.com
    Re: help with no strict 'refs' (Anno Siegel)
    Re: help with no strict 'refs' (Richard Zilavec)
    Re: help with no strict 'refs' (Martien Verbruggen)
    Re: help with no strict 'refs' <tzz@heechee.beld.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 30 Dec 2000 16:21:26 GMT
From: god_of_pain@my-deja.com
Subject: getline is getting many!
Message-Id: <92l222$fgb$1@nnrp1.deja.com>

I have a Perl script that I am using in my cgi on two of my web sites.
It reads lines from a text file one at a time then does some thing. For
about a year now they have been working great. The other day for some
reason it started doing funny things. It will getline for the first few
lines just fine then about 10 lines in it will decide to get the next 20
or so lines as if it was one line. It is as if it is not seeing the 0x0A
at the end of each line. By the way these are running from Red Hat 6.1 &
RH 6.2 with Apache web server.

I have looked at the files with a hex editor and they do have the 0x0A
at the end of each line like they always have. I am continuing to test
this phenomenon to find some pattern as to why it is doing this.

If you have seen this or have an idea why it is happening please let me
know.
--


Sent via Deja.com
http://www.deja.com/


------------------------------

Date: Sat, 30 Dec 2000 10:34:23 -0500
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: getline is getting many!
Message-Id: <slrn94s03v.3sk.tadmc@magna.metronet.com>

god_of_pain@my-deja.com <god_of_pain@my-deja.com> wrote:

>It will getline for the first few
>lines just fine then about 10 lines in it will decide to get the next 20
>or so lines as if it was one line.

>If you have seen this or have an idea why it is happening please let me
>know.


Does your program (or modules) muck about with the value
of Perl's $/ special variable?

Perl's variables are documented in:

   perldoc perlvar


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 30 Dec 2000 11:39:36 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: getline is getting many!
Message-Id: <87r92pq04n.fsf@limey.hpcc.uh.edu>

>> On Sat, 30 Dec 2000 16:21:26 GMT,
>> god_of_pain@my-deja.com said:

> I have a Perl script that I am using in my cgi on two of my web
> ...

All you've said is: there's a problem.

Noone knows what your code looks like.  Noone can help.

Can you write a small example program with a small test data set that
exhibits this behaviour?  If so, post it.  Show the code, the data,
what output it produces, what output you expected, and how these last
2 are different.

hth
t
-- 
Eih bennek, eih blavek.


------------------------------

Date: 30 Dec 2000 01:11:08 GMT
From: Justin McNutt <mcnuttj@nin.iats.missouri.edu>
Subject: Re: getting output from net::telnet
Message-Id: <92jcnc$6ep$1@dipsy.missouri.edu>

Garry Williams <garry@ifr.zvolve.net> wrote:
> On Wed, 20 Dec 2000 18:28:48 GMT, entropy <xuvetyn@my-deja.com> wrote:
>>having a small problem w/ net::telnet.

> That's Net::Telnet on my system.  

>>my @lines = $t->cmd("/local/apache/bin/apachectl start");
>>print @lines;
>>
>>returns nothing (yes, the command works and returns output when run
>>manually from the command-line.
>>
>>any thoughts?

> What does the dump_log or input_log contain?  That should make it
> clear where you're going wrong.  I suspect that the prompt is arriving
> before the output, but that's a guess.  Net::Telnet will tell you so
> you don't have to guess.  

Also, check what the Input Record Separator and the Output Record
Separator are set to.  These can affect how Net::Telnet interprets the
incoming stream.

Further, it's not a bad idea to do $t->buffer_empty from time to time, to
make sure your input buffer isn't full of stuff you don't need.  Best when
done just before you enter your next command.  This has solved several
problems in my scripts where a command returns a lot of data.

A corollary to that when parsing large amounts of data returned from a
telnet session is that you may have to check that the buffer is full,
flush it, and continue parsing.  This is all related to the Input Record
Separator and the Output Record Separator I mentioned above.

And, of course, 'perldoc Net::Telnet' should be enlightening, combined
with test scripts where you make use of both the dump log and the output
log.

--J


------------------------------

Date: Tue, 02 Jan 2001 14:09:23 -0800
From: Sports4Kids <office@sports4kids.org>
Subject: Groovy non-profit needs CGI help
Message-Id: <3A525193.F0852CFB@sports4kids.org>

Anyone out there interested in helping out a non-profit? 

www.sports4kids.org   (We work with elementary schools in low-income
areas to offer youth sports and recreation) 

Check out the "Clearinghouse"  www.sports4kids.org/clearinghouse.html

It has a little hiccup to it - it sends you to an old page which then
works fine.  I'm hoping someone can help me eliminate that intermediate
hiccup.  I think it's relatively straight forward, but I am completely
clueless when it comes to CGI stuff.

You can email or call me at 510-893-4180

Many thanks!

Jonas
Sports4Kids


------------------------------

Date: Tue, 02 Jan 2001 22:48:27 GMT
From: montep@hal-pc.org (Monte Phillips)
Subject: Re: Groovy non-profit needs CGI help
Message-Id: <3a525942.25646527@news.hal-pc.org>

On Tue, 02 Jan 2001 14:09:23 -0800, Sports4Kids
<office@sports4kids.org> wrote:

>Anyone out there interested in helping out a non-profit? 
>
>www.sports4kids.org   (We work with elementary schools in low-income
>areas to offer youth sports and recreation) 
>
>Check out the "Clearinghouse"  www.sports4kids.org/clearinghouse.html

I ABSOLUTELY LOVE IT!!!!
These idiots have a webpage so the poor people can find out where the
sports programs for their kids are.  DUH!  If they are poor, it's a
wee bit unlikely they have a goddam computer and an expensive phone
line for internet crap.

Also has it dawned on you clueless idiots that it ain't sports that
help kids its EDUCATION, real education.  You know where they learn to
read, write and add 2 + 2 and get 4 each time.  

I'm becoming convinced these 'do-gooders' are merely creating jobs for
themselves with the well meant donations of charitable people who work
hard for their money.

oh well enough on the soap box   sorry all!





------------------------------

Date: Tue, 02 Jan 2001 23:30:03 -0400
From: Antaeus Feldspar <feldspar@ix.netcom.com>
Subject: Re: Groovy non-profit needs CGI help
Message-Id: <3A529CBB.CD17B1D3@ix.netcom.com>

Monte Phillips wrote:
> 
> On Tue, 02 Jan 2001 14:09:23 -0800, Sports4Kids
> <office@sports4kids.org> wrote:
> 
> >Anyone out there interested in helping out a non-profit?
> >
> >www.sports4kids.org   (We work with elementary schools in low-income
> >areas to offer youth sports and recreation)
> >
> >Check out the "Clearinghouse"  www.sports4kids.org/clearinghouse.html
> 
> I ABSOLUTELY LOVE IT!!!!
> These idiots have a webpage so the poor people can find out where the
> sports programs for their kids are.  DUH!  If they are poor, it's a
> wee bit unlikely they have a goddam computer and an expensive phone
> line for internet crap.

	Obviously (and I don't mean this as a compliment) it has been a long
time since you've been in a public library.  Most of them have Internet
terminals for the patrons now, precisely so that people can have access
to information even if they're low-income.

> Also has it dawned on you clueless idiots that it ain't sports that
> help kids its EDUCATION, real education.  You know where they learn to
> read, write and add 2 + 2 and get 4 each time.

	Right, and so the fact that real classroom education is an undeniable
good thing means everything which is not Real Classroom Education is a
bad thing.  Speaking of real education, yours clearly never included
formal logic or identifying fallacies. 
	
> I'm becoming convinced these 'do-gooders' are merely creating jobs for
> themselves with the well meant donations of charitable people who work
> hard for their money.

	How very wise of you, to wait until you have proof before making
accusations like that.

> oh well enough on the soap box   sorry all!

	Well, at least it was really on-topic and constructive and all.


------------------------------

Date: 3 Jan 2001 08:52:14 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: Groovy non-profit needs CGI help
Message-Id: <92up7u$7sk$1@bob.news.rcn.net>

Monte Phillips <montep@hal-pc.org> wrote:
> I ABSOLUTELY LOVE IT!!!!
> These idiots have a webpage so the poor people can find out where the
> sports programs for their kids are.  DUH!  If they are poor, it's a
> wee bit unlikely they have a goddam computer and an expensive phone
> line for internet crap.

Where I come from, we have these places called "public libraries" that
often provide Web access...

> Also has it dawned on you clueless idiots that it ain't sports that
> help kids its EDUCATION, real education.  You know where they learn to
> read, write and add 2 + 2 and get 4 each time.  

There was this dude named Ben who wrote something about all work and no
play...


------------------------------

Date: Wed, 03 Jan 2001 18:15:27 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Groovy non-profit needs CGI help
Message-Id: <t56r1v6vfip346@corp.supernews.com>

Eric Bohlman <ebohlman@omsdev.com> wrote:
> Monte Phillips <montep@hal-pc.org> wrote:
>> I ABSOLUTELY LOVE IT!!!!
>> These idiots have a webpage so the poor people can find out where the
>> sports programs for their kids are.  DUH!  If they are poor, it's a
>> wee bit unlikely they have a goddam computer and an expensive phone
>> line for internet crap.

A computer capable of using the net could cost as little as $200.
A phone line can cost as little as $15-$20 with no long distance
service. I'd say someone who can afford that is not necessarily
middle class. A phone line is almost necessary these days.

> Where I come from, we have these places called "public libraries" that
> often provide Web access...

Very true. Some even provide free dial-up accounts to the poor. 
Case in point, Kansas City's public library.

>> Also has it dawned on you clueless idiots that it ain't sports that
>> help kids its EDUCATION, real education.  You know where they learn to
>> read, write and add 2 + 2 and get 4 each time.  

Education, in the US at least, rarely teaches teamwork because of the
specter of cheating on schoolwork. It also isn't that great at other
social skills. These are important things in the real working world.
Judging from your attitude, this may be a problem in you workplace.

> There was this dude named Ben who wrote something about all work and no
> play...

Mr. Franklin, I presume? A very smart man. It's also true for kids the
same as adults that all desk work and no physical extertion, besides
making one dull, makes one flabby and lethargic.

Chris

--
Christopher E. Stith

Try not. Do, or do not. The Force is binary. -- Yoda, The Empire Strikes Back (paraphrased)



------------------------------

Date: Sat, 30 Dec 2000 00:57:33 GMT
From: Jordan Hiller <jhiller@online-testing.net>
Subject: Hash in DB_File
Message-Id: <3A4D33A6.5B80C6A5@online-testing.net>

Hi,

I have a DB_File DBM and I am trying to use hashes in the DBM, but they
appear to be empty. Here is my test script:

#!/usr/bin/perl
print "Content-type: text/html\n\n";

use DB_File;
dbmopen(%dbmfile,"test",0666) or print "Can't open dbm file: $!";

# Write - I uncommented this and ran it once to set a value,
# and then I ran it again to see if it could retrieve the value
#$dbmfile{'xyz'}->{'name'} = 'something';

# Read - doesn't print anything
print $dbmfile{'xyz'}->{'name'};

dbmclose(%dbmfile);

Is this even possible, or am I doing something wrong?

Thanks,
--Jordan Hiller


------------------------------

Date: Sat, 30 Dec 2000 01:26:14 GMT
From: mountainarts@altavista.com (mountainarts)
Subject: Re: Hash in DB_File
Message-Id: <3a4d3967.16008688@news.dreamsoft.com>

Jordan Hiller <jhiller@online-testing.net> wrote:

>Hi,
>
>I have a DB_File DBM and I am trying to use hashes in the DBM, but they
>appear to be empty. Here is my test script:
>
>#!/usr/bin/perl
>print "Content-type: text/html\n\n";
>
>use DB_File;
>dbmopen(%dbmfile,"test",0666) or print "Can't open dbm file: $!";
>
># Write - I uncommented this and ran it once to set a value,
># and then I ran it again to see if it could retrieve the value
>#$dbmfile{'xyz'}->{'name'} = 'something';
>
># Read - doesn't print anything
>print $dbmfile{'xyz'}->{'name'};
>
>dbmclose(%dbmfile);
>
>Is this even possible, or am I doing something wrong?
>
>Thanks,
>--Jordan Hiller


almost right! 
try this
#!/usr/bin/perl -w
use strict;
use DB_File;

my %dbmfile;

dbmopen(%dbmfile,"test",0666) || die "Can't open dbm file: $!";

$dbmfile{'xyz'} = 'something';

# Read - doesn't print anything
print $dbmfile{'xyz'};

dbmclose(%dbmfile);

hope this helps
mountainarts


------------------------------

Date: Sat, 30 Dec 2000 02:36:13 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Hash in DB_File
Message-Id: <xSb36.475$ld.31696@eagle.america.net>

On Sat, 30 Dec 2000 00:57:33 GMT, Jordan Hiller
<jhiller@online-testing.net> wrote:

>I have a DB_File DBM and I am trying to use hashes in the DBM, but they
>appear to be empty. Here is my test script:
>
>#!/usr/bin/perl

If you started your program with this: 

 #!/usr/bin/perl -w
 use strict;

you would not have needed to post this question.  Perl (actually perl)
would have told you what the problem was.  

>print "Content-type: text/html\n\n";

You should also be using the CGI module.  See the CGI manual page.  

>use DB_File;
>dbmopen(%dbmfile,"test",0666) or print "Can't open dbm file: $!";

This from the dbmopen() section of the perlfunc manual page: 

     dbmopen HASH,DBNAME,MASK
             [This function has been largely superseded by the
             `tie' function.]

And this from the DB_File manual page: 

    SYNOPSIS
      use DB_File ;

      [$X =] tie %hash,  'DB_File', [$filename, $flags, 
                      $mode, $DB_HASH] ;

So you should be doing this instead of dbmopen: 

  tie(my %dbmfile, "DB_File", "test", O_RDWR, 0666, $DB_HASH)
    or die "Can't open dbm file: test: $!";

(But this is not related to your problem -- it's just a style issue
since dbmopen is *not* deprecated.)  

># Write - I uncommented this and ran it once to set a value,
># and then I ran it again to see if it could retrieve the value
>#$dbmfile{'xyz'}->{'name'} = 'something';

So you are assigning a reference to a hash ( { name => 'something' } )
to the value of the 'xyz' key in the %dbmfile hash.  Since the DB_File
module will store *strings* as values for the keys, the reference will
be "stringified".  It will no longer be a reference.  (See "How can I
store a multidimensional array in a DBM file?" in the perlfaq4 manual
page.  It's terse, but it plainly says that you cannot do what you are
attempting.)  

When you later attempt to dereference this value, it's no longer a
reference!  It's a string.  It will look something like: 

    $ perl -le 'print \%h'
    HASH(0x11cbac)
    $

># Read - doesn't print anything
>print $dbmfile{'xyz'}->{'name'};

Here's where perl would have told you of the error had you enabled
warnings and used strict.  

You are attempting to use a symbolic reference.  It doesn't exist, so
(since you allowed this bad practice) the hash it refers to has no key
named 'name'.  

Even enabling warnings (without strictures) would have given a hint of
the problem.  

>dbmclose(%dbmfile);

This from the dbmclose() section of the perlfunc manual page: 

     dbmclose HASH
             [This function has been largely superseded by the
             `untie' function.]

So you should use this instead of dbmclose():

  untie(%dbmfile);  

(This is only a style issue.)  

>Is this even possible, 

Yes.  You must serialize the hash in order to store it as a value
associated with a DB_File key.  See the FAQ reference above and the
Storable manual page for possible approaches.  

>or am I doing something wrong?

Yes.  You didn't enable warnings and use strict so that you could help
yourself before posting.  

-- 
Garry Williams


------------------------------

Date: Sat, 30 Dec 2000 02:51:16 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Hash in DB_File
Message-Id: <E4c36.479$ld.31342@eagle.america.net>

On Sat, 30 Dec 2000 01:26:14 GMT, mountainarts
<mountainarts@altavista.com> wrote:

>Jordan Hiller <jhiller@online-testing.net> wrote:

>>I have a DB_File DBM and I am trying to use hashes in the DBM, but they
>>appear to be empty.           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

[ snip ]

>almost right! 
>try this
>#!/usr/bin/perl -w
>use strict;
>use DB_File;
>
>my %dbmfile;
>
>dbmopen(%dbmfile,"test",0666) || die "Can't open dbm file: $!";
>
>$dbmfile{'xyz'} = 'something';
>
># Read - doesn't print anything
>print $dbmfile{'xyz'};
>
>dbmclose(%dbmfile);

I think you missed his point.  I think he wants to store a _hash_ as
the value for a key in a DB_File -- *not* a string.  

-- 
Garry Williams


------------------------------

Date: 4 Jan 2001 14:38:47 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Hash in DB_File
Message-Id: <9321tn$3id$1@mamenchi.zrz.TU-Berlin.DE>

Garry Williams <garry@zvolve.com> wrote in comp.lang.perl.misc:
>On Sat, 30 Dec 2000 01:26:14 GMT, mountainarts
><mountainarts@altavista.com> wrote:
>
>>Jordan Hiller <jhiller@online-testing.net> wrote:
>
>>>I have a DB_File DBM and I am trying to use hashes in the DBM, but they
>>>appear to be empty.           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
>[ snip ]
>
>>almost right! 
>>try this
>>#!/usr/bin/perl -w
>>use strict;
>>use DB_File;
>>
>>my %dbmfile;
>>
>>dbmopen(%dbmfile,"test",0666) || die "Can't open dbm file: $!";
>>
>>$dbmfile{'xyz'} = 'something';
>>
>># Read - doesn't print anything
>>print $dbmfile{'xyz'};
>>
>>dbmclose(%dbmfile);
>
>I think you missed his point.  I think he wants to store a _hash_ as
>the value for a key in a DB_File -- *not* a string.  

That, and dbmopen() is deprecated in favor of tie(), and has been for,
uh, how many years?

Anno


------------------------------

Date: 02 Jan 2001 02:15:29 GMT
From: loans2001@aol.com (Loans2001)
Subject: Having trouble with simple cookie script.
Message-Id: <20010101211529.02484.00006521@ng-fr1.aol.com>

Hello,

I get an error message every time.  The program runs from a url link with the
path to this program plus the ?id=12345  as the query string.  Every time I run
this from the webpage with the query string link, I get an error. Malformed
header from script.  I keep checking the netscape cookies.txt file for my
cookie.  I see nothing there different than from before.  Could someone please
shed some light?


#!usr/bin/perl
$string=$ENV{'QUERY_STRING'};
print $string;
($key, $value) = split(/=/, $ENV{'QUERY_STRING'});
print $key, $value;
print "Content-type: text/html", "\n";
print "Set-Cookie: $key=$value; expires=Sat, 26-Aug-01 15:45:30 GMT;
path=/; domain=mortgage-pros.com",  "\n\n";

Thanks,


Scot 

ALso,

Will this read the cookie?

sub parse-client-cookies
{
	local (*COOKIE_DATA) = @_;
	
	local (@key_value_pairs, $key_value, $key, $value);
	
	@key_value_pairs = split (/;\s/, $ENV{'HTTP_COOKIE'});

	foreach $key_value (@key_value_pairs)  {

		($key, $value) = split (/=/, $key_value);

		$key  =~ tr/+/ /;
		$value =~ tr/+/ /;

		$key =~   s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;
		$value =~ s/%([\dA-Fa-f][\dA-Fa-f])/pack ("C", hex ($1))/eg;

		if (defined($FORM_DATA{key})) {
			$FORM_DATA{$key} = join ("\0", $FORM_DATA{$key}, $value);
		}  else  {
		$FORM_DATA{$key} = $value;
		}
	}
}




------------------------------

Date: Tue, 02 Jan 2001 03:32:18 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Having trouble with simple cookie script.
Message-Id: <6Zb46.491$Dm5.21645@eagle.america.net>

On 02 Jan 2001 02:15:29 GMT, Loans2001 <loans2001@aol.com> wrote:
>Hello,
>
>I get an error message every time.  
>
>#!usr/bin/perl
>$string=$ENV{'QUERY_STRING'};
>print $string;
>($key, $value) = split(/=/, $ENV{'QUERY_STRING'});
>print $key, $value;
>print "Content-type: text/html", "\n";
>print "Set-Cookie: $key=$value; expires=Sat, 26-Aug-01 15:45:30 GMT;
>path=/; domain=mortgage-pros.com",  "\n\n";

That's funny.  I don't get any error when I run this code.  It must
not be a Perl problem at all.  

    $ perl
    #!usr/bin/perl
    $string=$ENV{'QUERY_STRING'};
    print $string;
    ($key, $value) = split(/=/, $ENV{'QUERY_STRING'});
    print $key, $value;
    print "Content-type: text/html", "\n";
    print "Set-Cookie: $key=$value; expires=Sat, 26-Aug-01 15:45:30 GMT;
    path=/; domain=mortgage-pros.com",  "\n\n";
    Content-type: text/html
    Set-Cookie: =; expires=Sat, 26-Aug-01 15:45:30 GMT;
    path=/; domain=mortgage-pros.com

    $ 

-- 
Garry Williams


------------------------------

Date: Mon, 01 Jan 2001 20:59:10 -0700
From: "Doran Barton" <fozz@iodynamics.com>
Subject: Re: Having trouble with simple cookie script.
Message-Id: <92rjhq$3so$1@news.xmission.com>

In article <20010101211529.02484.00006521@ng-fr1.aol.com>, "Loans2001"
<loans2001@aol.com> wrote:

> Hello,
> 
> I get an error message every time.  The program runs from a url link
> with the path to this program plus the ?id=12345  as the query string. 
> Every time I run this from the webpage with the query string link, I get
> an error. Malformed header from script.  I keep checking the netscape
> cookies.txt file for my cookie.  I see nothing there different than from
> before.  Could someone please shed some light?

I almost ALWAYS get this error ("Malformed header...") when I fgorget to
output a valid HTTP header in my CGI script. Make sure you're doing this.

Also... if you use CGI.pm, your parsing of cookies (and CGI variables)
will be much simplified. Take advantage of what the Perl community has to
offer and use a CPAN module to save yourself stress.

-=Fozz

-- 
------------------------------------------------------------------------------
fozz@iodynamics.com -- Doran L. Barton - Chief Super Hero, Iodynamics LLC
    "A good messenger expects to get shot." -- Larry Wall


------------------------------

Date: Wed, 3 Jan 2001 04:02:08 +0800
From: "Lucas" <wstsoi@netvigator.com>
Subject: help about time difference
Message-Id: <92tbfv$t4s2@imsp212.netvigator.com>

I want to compare the time difference of 2 times with
format like 2000/12/4/12:30 and 2001/01/02/2:54,


How could I get the time differences?
Thanks a lot




------------------------------

Date: Tue, 02 Jan 2001 21:51:39 GMT
From: arjenwiersma@my-deja.com
Subject: Re: help about time difference
Message-Id: <92tih7$ksc$1@nnrp1.deja.com>

Hi,

> I want to compare the time difference of 2 times with
> format like 2000/12/4/12:30 and 2001/01/02/2:54,

use the Date::Parse module... it has several parsing routines...

HTH

Arjen


Sent via Deja.com
http://www.deja.com/


------------------------------

Date: Tue, 02 Jan 2001 22:22:04 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: help about time difference
Message-Id: <gws46.1034$Dm5.29525@eagle.america.net>

On Wed, 3 Jan 2001 04:02:08 +0800, Lucas <wstsoi@netvigator.com> wrote:
>I want to compare the time difference of 2 times with
>format like 2000/12/4/12:30 and 2001/01/02/2:54,
>
>
>How could I get the time differences?

Convert them into Epoch seconds and then take the absolute value of
their difference.  (thus yielding the difference in seconds.)  See the
following manual pages: 

 Time::Local
 perlfunc (abs)

-- 
Garry Williams


------------------------------

Date: Wed, 03 Jan 2001 22:40:32 -0500
From: kf4dmb <kf4dmb@net-magic.net>
Subject: Help connection to mysql
Message-Id: <rsr75tcvnljaajp0h44u0pshmei71aq8do@4ax.com>

I have a script that for the life of me I can figure out whats wrong ,
I access the database , There are two Test Items in there , It sends
out two Emails , But no data from the DB


Here is the Code 




#!/usr/bin/perl
# use time::local;

# require "/var/www/cgi-bin/subparseform.lib";
# &Parse_Form;
use DBI;
# $time = timelocal($sec,$min,$hours,$mday,$mon,$year);

@days = ("Sunday","Monday","Tuesday","Wednesday","Thursday",
         "Friday","Saturday");
@months = ("January","February","March","April","May","June",
            "July","August","September","October","November",
            "December");

($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) = 
localtime(time);
$year = $year + 1900;
# print "Today is $days[$wday], $months[$mon] $mday, $year.\n";

$today_n = $days[$wday];


--More--(29%)





  if ( $today_n ne "Sunday") {

  


      if ($today_n ne "Saturday"){   

###################################
#connect to DB
#############################
my $database = "VHD";
my $data_source = "DBI:mysql:$database";
my $username = "john";
my $password = "doe";

$dbh =DBI ->connect($data_source, $username, $password) or die "cant
connect to
$data_source : my $dbh-> errstr\n";

--More--(56%)


my $sth1 = $dbh -> prepare("select * from routines");
$sth1 -> execute or die " unable to execute query ";
# $sth1 -> finish;


my $array_ref = $sth1 -> fetchall_arrayref();

   foreach $row(@$array_ref){ 


$tech = $row[7];
print "$tech";
$prob = $row[2];

$cat = $row[3];
$subcat = $row[4];
$sub2 = $row[5];
$code = "netpdtc";

--More--(72%)
open(MAIL, "|/usr/lib/sendmail -t")|| 
  &ErrorMail;

#print MAIL
"To:joyce.sofge\@somewhare.com\nFrom:jim.flaherty\@somewhare.com\n";

print MAIL
"To:jim.flaherty\@somewhare.com\nFrom:jim.flaherty\@somewhare.com\n";

print MAIL "Subject:a request\n\n";
print MAIL "adpso:  $tech\n\n";



print MAIL "Please assign to Tech: $tech\n\n";

print MAIL "$time\n\n";

print MAIL "First Catagory:  $cat\n"; 
print MAIL "Second CAT:  $subcat\n";
print MAIL "Third Cat 2: $sub2\n\n\n";     

print MAIL "Problem: $prob\n\n";
close(MAIL);

--More--(99%)
}

}
}


------------------------------

Date: Thu, 04 Jan 2001 10:30:29 GMT
From: francesc_guasch@my-deja.com
Subject: Re: Help connection to mysql
Message-Id: <931jc6$v10$1@nnrp1.deja.com>

In article <rsr75tcvnljaajp0h44u0pshmei71aq8do@4ax.com>,
  kf4dmb <kf4dmb@net-magic.net> wrote:
> I have a script that for the life of me I can figure out whats wrong ,
> I access the database , There are two Test Items in there , It sends
> out two Emails , But no data from the DB
>
> Here is the Code
>
> #!/usr/bin/perl

Add this to help debug your program.

#!/usr/bin/perl -w
use strict

> # use time::local;
>
> # require "/var/www/cgi-bin/subparseform.lib";
> # &Parse_Form;
> use DBI;
> # $time = timelocal($sec,$min,$hours,$mday,$mon,$year);
>
> @days = ("Sunday","Monday","Tuesday","Wednesday","Thursday",
>          "Friday","Saturday");
> @months = ("January","February","March","April","May","June",
>             "July","August","September","October","November",
>             "December");
>
> ($sec,$min,$hr,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
> $year = $year + 1900;
> # print "Today is $days[$wday], $months[$mon] $mday, $year.\n";
>
> $today_n = $days[$wday];
>
> --More--(29%)
>
>   if ( $today_n ne "Sunday") {
>
>       if ($today_n ne "Saturday"){
>
> ###################################
> #connect to DB
> #############################
> my $database = "VHD";
> my $data_source = "DBI:mysql:$database";
> my $username = "john";
> my $password = "doe";
>
> $dbh =DBI ->connect($data_source, $username, $password) or die "cant
> connect to
> $data_source : my $dbh-> errstr\n";


this will help see better error messages.

$data_source : $DBI::errstr\n";

>
> --More--(56%)
>
> my $sth1 = $dbh -> prepare("select * from routines")
#remove ; in former line and add:
    or die $DBI::errstr;

> $sth1 -> execute or die " unable to execute query ";
$sth1->execute
  or die $DBI::errstr;

> # $sth1 -> finish;
>
> my $array_ref = $sth1 -> fetchall_arrayref();
>
>    foreach $row(@$array_ref){
>
> $tech = $row[7];
> print "$tech";
> $prob = $row[2];
>
> $cat = $row[3];
> $subcat = $row[4];
> $sub2 = $row[5];
> $code = "netpdtc";
>
> --More--(72%)
> open(MAIL, "|/usr/lib/sendmail -t")||
>   &ErrorMail;
>
> #print MAIL
> "To:joyce.sofge\@somewhare.com\nFrom:jim.flaherty\@somewhare.com\n";
>
> print MAIL
> "To:jim.flaherty\@somewhare.com\nFrom:jim.flaherty\@somewhare.com\n";
>
> print MAIL "Subject:a request\n\n";
> print MAIL "adpso:  $tech\n\n";
>
> print MAIL "Please assign to Tech: $tech\n\n";
>
> print MAIL "$time\n\n";
>
> print MAIL "First Catagory:  $cat\n";
> print MAIL "Second CAT:  $subcat\n";
> print MAIL "Third Cat 2: $sub2\n\n\n";
>
> print MAIL "Problem: $prob\n\n";
> close(MAIL);
>
> --More--(99%)
> }
>
> }
> }
>


Sent via Deja.com
http://www.deja.com/


------------------------------

Date: 29 Dec 2000 15:21:58 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: help with no strict 'refs'
Message-Id: <92ia6m$q8f$1@mamenchi.zrz.TU-Berlin.DE>

Richard Zilavec <rzilavec@tcn.net> wrote in comp.lang.perl.misc:
>On Thu, 28 Dec 2000 16:41:18 GMT, rgarciasuarez@free.fr (Rafael
>Garcia-Suarez) wrote:
>
>>In this particular case, it seems that hard references are OK, because
>>you're reading predefined variables, that look external. Pay attention
>>to package scoping issues : %ENV will be looked up in the main package,
>>the other hashes in the current one.
>
>Hmmmm, this does lead to a problem, I was hoping to access the main
>package hashes, can this be done?

Yes, if your hashes *are* in the main package.  Variables declared
via my() aren't in any package, so they aren't accessible through
the %main::hash syntax.

>In the main program:
>
>use SomePackage;
>my $test = "testing 123";

"my" makes $test a lexical (as opposed to package-) variable.

>In the package:
>print $main::test . "\n";

$main::test doesn't exist.

>This fails, but I'm assuming there must be away to access $test in the
>package SomePackage.

Declare $test with our() (or "use vars" for older Perls), or use
it fully qualified to begin with.

Anno


------------------------------

Date: Sat, 30 Dec 2000 06:01:23 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: help with no strict 'refs'
Message-Id: <3a4d787d.377116489@news.tcn.net>

On 29 Dec 2000 15:21:58 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
Siegel) wrote:

>Declare $test with our() (or "use vars" for older Perls), or use
>it fully qualified to begin with.

I can't seem to find what our() does.  I looked through the perldocs
and serveral books, etc...  nothing?!?  My regular websites are being
back matches on hours, resourses... 


--
 Richard Zilavec
 rzilavec@tcn.net


------------------------------

Date: Sat, 30 Dec 2000 17:15:55 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: help with no strict 'refs'
Message-Id: <slrn94qvcr.6lr.mgjv@martien.heliotrope.home>

On Sat, 30 Dec 2000 06:01:23 GMT,
	Richard Zilavec <rzilavec@tcn.net> wrote:
> On 29 Dec 2000 15:21:58 GMT, anno4000@lublin.zrz.tu-berlin.de (Anno
> Siegel) wrote:
> 
>>Declare $test with our() (or "use vars" for older Perls), or use
>>it fully qualified to begin with.
> 
> I can't seem to find what our() does.  I looked through the perldocs
> and serveral books, etc...  nothing?!?  My regular websites are being
> back matches on hours, resourses... 

our is new in perl 5.6.0, described in perlfunc. If you still have an
older perl, you should upgrade soon. In the meantime, get the Perl
source distribution, and read the pod documents distributed with it.

The following _SHOULD_ have the latest documentation, but doesn't. It's
old crud.

http://www.perl.com/pub/v/documentation

All the web resources that claim to have the Perl documentation are out
of date and old that I know of. I'd prefer it if they just took that
stuff down, instead of acting as if it's current. You could have a look
at ActiveState's documentation on-line: www.activestate.com.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | I'm just very selective about what I
Commercial Dynamics Pty. Ltd.   | accept as reality - Calvin
NSW, Australia                  | 


------------------------------

Date: 30 Dec 2000 02:02:41 -0500
From: Ted Zlatanov <tzz@heechee.beld.net>
Subject: Re: help with no strict 'refs'
Message-Id: <m3d7eav1bi.fsf@heechee.beld.net>

mgjv@tradingpost.com.au (Martien Verbruggen) writes:

> The following _SHOULD_ have the latest documentation, but doesn't. It's
> old crud.
> 
> http://www.perl.com/pub/v/documentation
> 
> All the web resources that claim to have the Perl documentation are out
> of date and old that I know of. I'd prefer it if they just took that
> stuff down, instead of acting as if it's current. You could have a look
> at ActiveState's documentation on-line: www.activestate.com.

Try http://www.perldoc.com - I have had no problems with outdated docs
there.

-- 
Teodor Zlatanov <tzz@iglou.com>
"Brevis oratio penetrat colos, longa potatio evacuat ciphos." -Rabelais


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----


------------------------------

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V9 Issue 5230
**************************************


home help back first fref pref prev next nref lref last post