Re: POSIX 'strftime' and time zones

2003-10-01 Thread fliptop
On Tue, 30 Sep 2003 at 23:57, David Gilden opined:

DG:How can I add two hours to offset for central time?

try date::calc

http://search.cpan.org/~stbey/Date-Calc-5.3/

you'll probably want to use the Add_Delta_Days() function.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: POSIX 'strftime' and time zones

2003-10-01 Thread Wiggins d'Anconia


On Tue, 30 Sep 2003 23:57:16 -0500, David Gilden [EMAIL PROTECTED] wrote:

 Quick question,
 
 the server is on west coast time (California)
 client is in Texas, central time (+2 hours)
 
 How can I add two hours to offset for central time?
 Thx,
 Dave
 
 
 #!/usr/local/bin/perl 
 use POSIX 'strftime';
 my $date = strftime('%A, %B %d, %Y %I:%M %p',localtime);
 print $date;
 

As fliptop said modules are groovy for this kind of thing, but if your needs aren't to 
great, you can use the old standby of adding the number of seconds in 2 hours to the 
time provided by 'time' which is the default to 'localtime'...

localtime( time() + (2*60*60) )

Of course for those of us in the back asswards state of Indiana or I suppose the rest 
of the world, this only works half the time when talking to someone that is in the 
other sets which is why a robust module is usually better at this kind of thing.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



uploadfiles

2003-10-01 Thread A L
I'm trying to write a CGI script to upload a file from a website.  I have the 
following HTML:
 
HTMLHEADTITLEUploading Files/TITLE/HEAD
BODY
FORM ACTION=cgi-bin/supload.cgi METHOD=post ENCTYPE=multipart/form-data
Pick a file to upload:
INPUT TYPE=file NAME=upload_file SIZE=100
INPUT TYPE=submit
/FORM
/BODY
/HTML
 
that refers to the following CGI:
 
 #!/usr/bin/perl -w 
use strict;
use CGI qw/:standard/
print Content-type: text/html\n\n;
 
print $query-filefield('uploaded_file');  
$filename = $query-param('uploaded_file');
$fh = $query-upload('uploaded_file'); 
while ($fh) {
  print; 
  }
I am reading the CGI.pm from Lincoln Stein's webpage.  But, it's too difficult for me 
to follow what I am supposed to do.  I just want to be able to load a file from a 
local drive while on the web, then, print out the loaded file's content to the web 
after it has been through CGI.  Am I making sense?  Any help would be appreciated.  I 
would also like help on the very basic idea of what I am trying to accomplish.  Thanks.
A




-
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

Re: uploadfiles

2003-10-01 Thread drieux
On Wednesday, Oct 1, 2003, at 08:12 US/Pacific, A L wrote:
[..]
that refers to the following CGI:

 #!/usr/bin/perl -w
use strict;
use CGI qw/:standard/
print Content-type: text/html\n\n;
print $query-filefield('uploaded_file');
there is the minor detail here that you did not
declare what a '$query' is ...
$filename = $query-param('uploaded_file');
$fh = $query-upload('uploaded_file');
while ($fh) {
  print;
  }
I am reading the CGI.pm from Lincoln Stein's webpage.
good choice.

 But, it's too difficult for me to follow what I am supposed to do.
I just want to be able to load a file from a local drive while on
the web, then, print out the loaded file's content to the web after
it has been through CGI.  Am I making sense?  Any help would be
appreciated.  I would also like help on the very basic idea of
what I am trying to accomplish.  Thanks.
I think your basic idea might be easier to see as two different
pieces of CGI code or one HTML file that calls a cgi script.
cgi_code_a sends to the browser the HTML that is the form
the user will fill in to find a file. In the 'action' attribute
for that form it will reference cgi_code_b.
Note this part could be a static html file.
cgi_code_b will then read the parameters passed to it,
and do the file up_load sequence and as you wish present
the information from the file.
minor note - if you peek into CGI.pm you will notice

'upload' ='END_OF_FUNC',
sub upload {
my($self,$param_name) = self_or_default(@_);
my $param = $self-param($param_name);
return unless $param;
return unless ref($param)  fileno($param);
return $param;
}
END_OF_FUNC
so you might want your code to be doing

my $fh = $query-upload('uploaded_file');
while ($fh)
{
#
# stuff we do with that reference to the uploaded file
#
}
unless you are really want to play with the $query-param()
and the other method calls...
HTH.

ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]