Re: Perl Help

2002-06-13 Thread David T-G

Links --

What a funny name you have...

...and then LinkS On WeB said...
% 
% using the stat function, say I was using $stat[9],
% which displays the time of the file, how would I make
% it just display the date. Month-DayofMonth-Year

Take the seconds that come out of stat and feed them to localtime and
interpret from there (months are 0 - 11; years are years since 1900):

  [zero] [4:27pm] ~>  touch 01020304 fooble

  [zero] [4:27pm] ~>  ls -lF fooble
  -rw-r--r--   1 davidtg 0 Wed Jan 02 03:04:00 2002 fooble 

  [zero] [4:27pm] ~>  perl -e '$mtime = (stat("./fooble"))[9]; \
(undef,$min,$hour,$day,$mon,$year) = (localtime($mtime)); \
print "Year is $year, Mon is $mon, Day is $day, \
Hour is $hour, Min is $min\n";'
  Year is 102, Mon is 0, Day is 2, Hour is 3, Min is 4

See

  perldoc -f stat
  perldoc -f localtime

and have fun :-)


HTH & HAND

:-D
-- 
David T-G  * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!




msg05380/pgp0.pgp
Description: PGP signature


RE: Perl Help

2002-06-13 Thread Bob Showalter

> -Original Message-
> From: LinkS On WeB [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, June 13, 2002 4:54 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
> [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Perl Help
> 
> 
> using the stat function, say I was using $stat[9],
> which displays the time of the file, how would I make
> it just display the date. Month-DayofMonth-Year

Pass the time from stat() to localtime(). This will break
out the separate month, day, and year components. You can
format these with sprintf() (or POSIX::strftime() for more
elaborate formatting possibilities).

Carefully read

   perldoc -f localtime

to get the details on the various fields returned.

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




RE: Perl help

2002-02-27 Thread John Edwards

What format log file? What format spreadsheet? What OS?

-Original Message-
From: Allison Ogle [mailto:[EMAIL PROTECTED]]
Sent: 27 February 2002 14:42
To: [EMAIL PROTECTED]
Subject: Perl help


Hi,

I am a beginner trying to write a program which will read information from a
log file and write it to a spreadsheet for easier viewing and organization
but I'm not sure how to do this or how to get started.  ANY help would be
appreciatd.  Please respond to [EMAIL PROTECTED]  Thanks so much,

Allison


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


--Confidentiality--.
This E-mail is confidential.  It should not be read, copied, disclosed or
used by any person other than the intended recipient.  Unauthorised use,
disclosure or copying by whatever medium is strictly prohibited and may be
unlawful.  If you have received this E-mail in error please contact the
sender immediately and delete the E-mail from your system.



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




Re: perl help 2!!

2001-06-07 Thread David Draley

Hello Gary –

Yes, my CGI generates the form on the fly.  Its like the script is run on 
load and processes the data immediately.  Maybe my code is wrong.  It’s 
driving me crazy!  Here is my code below.


thanks in advance -

--

#!/usr/bin/perl


#Evaluation Questions for survey
use DBI;
use DBD::mysql;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);

#Conntect to DB
my $dbh= DBI->connect("DBI:mysql:bookstore","usrname","psswd")
or die "Could not make connection to database.";
my $usertype= param('usertype');

print header;

list();
#starts from
sub list
{

print qq|


Evalutation Survey




 Survey 
Thank you for visiting my web site.

By participating in this survey the information you 
provide will be most useful in helping me complete the design of my 
site


PART ONE - Getting to know You and Your Computer Environment

 Currently, my position is .

Medical student

Resident

Fellow


THANK YOU very much for your help with this survey.  Please click 
Submit to send us your responses.  T


   







|;

answer();
}

#writes to DB
sub answer
{
$cmd = qq|insert into survey (usertype) values ("$usertype")|;
$dbh->do($cmd);
}

#end of program
---

>From: Gary Stainburn <[EMAIL PROTECTED]>
>To: "David Draley" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
>Subject: Re: perl help!!
>Date: Thu, 7 Jun 2001 11:03:20 +0100
>
>Hi David,
>
>I don't quite understand this one.  If your script works when the form
>is submitted, then your server/cgi-bin/perl seem to be set up correctly.
>
>Does the same CGI generate the form and accept it back?  If so, then
>them problem is in your CGI's logic.  I do the same thing here, and
>right at the top I check to see if the form's submit button's field
>exists.  If not, then the CGI's called for the first time and I simply
>generate the form and exit.
>
>If the submit button data does exist, then it's responding to the form,
>at which point I validate the form details.  Only after validating the
>data do I call the DB update routeines.
>
>If the CGI is not used to create the form in the first place, then I
>have no idea why it's getting called when someone clicks the refresh
>button.
>
>Gary
>On Wednesday 06 June 2001  8:16 pm, David Draley wrote:
> > is there a way to call a perl sub routines using a FORM when a
> > "submit" button is clicked?
> >
> > I am trying to push data to a mySQL database table and when my form
> > is loaded into the browser or is "refreshed" the browser runs through
> > my cgi script and pushes "null" values to the table.  Once the form
> > is filled and the user clicks the form "submit button" the form works
> > and pushes the correct values.
> >
> >
> > thanks
> > david
> >
> > _
> > Get your FREE download of MSN Explorer at http://explorer.msn.com
>
>--
>Gary Stainburn
>
>This email does not contain private or confidential material as it
>may be snooped on by interested government parties for unknown
>and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
>

_
Get your FREE download of MSN Explorer at http://explorer.msn.com




Re: perl help!!

2001-06-07 Thread Gary Stainburn

Hi David,

I don't quite understand this one.  If your script works when the form 
is submitted, then your server/cgi-bin/perl seem to be set up correctly.

Does the same CGI generate the form and accept it back?  If so, then 
them problem is in your CGI's logic.  I do the same thing here, and 
right at the top I check to see if the form's submit button's field 
exists.  If not, then the CGI's called for the first time and I simply 
generate the form and exit.

If the submit button data does exist, then it's responding to the form, 
at which point I validate the form details.  Only after validating the 
data do I call the DB update routeines.

If the CGI is not used to create the form in the first place, then I 
have no idea why it's getting called when someone clicks the refresh 
button.

Gary
On Wednesday 06 June 2001  8:16 pm, David Draley wrote:
> is there a way to call a perl sub routines using a FORM when a
> "submit" button is clicked?
>
> I am trying to push data to a mySQL database table and when my form
> is loaded into the browser or is "refreshed" the browser runs through
> my cgi script and pushes "null" values to the table.  Once the form
> is filled and the user clicks the form "submit button" the form works
> and pushes the correct values.
>
>
> thanks
> david
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 




RE: perl help!!

2001-06-06 Thread Kris Cook

First: are you certain that the values are getting to the Perl script from
the form (I'm assuuming it's a separate file).  I ask because I had this
problem last week; I wasn't properly extracting the parameters (using the
param function in CGI.pm), and it was happily supplying me with nulls in its
effort to cooperate.

Insert some print statements to display the data just to be sure.

I also had problems forgetting to encode some of my data (passed from
previous forms) in hidden fields, so it had a way to GET to the perl script.

Anyway, those were MY brain farts.  You may have been smart enough to figure
those out already.

> -Original Message-
> From: David Draley [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 06, 2001 2:16 PM
> To: [EMAIL PROTECTED]
> Subject: perl help!!
> 
> 
> is there a way to call a perl sub routines using a FORM when 
> a "submit"
> button is clicked?
> 
> I am trying to push data to a mySQL database table and when my form is
> loaded into the browser or is "refreshed" the browser runs 
> through my cgi
> script and pushes "null" values to the table.  Once the form 
> is filled and
> the user clicks the form "submit button" the form works and pushes the
> correct values.
> 
> 
> thanks
> david
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 



Re: perl help!!

2001-06-06 Thread Eduard Grinvald

The easiest way to be prepoluate the fields with something you know 
couln't be the input and check for that before pushing into the table, 
you'd have to do that for the actual form anyway (unless you allow for 
NULL names, let's say :) )

__END__
=sincerely, eduard grinvald
=email: [EMAIL PROTECTED]
=dev-email: [EMAIL PROTECTED]
=dev-site: r-x-linux.sourceforge.net
=icq:   114099136
=PGP
-BEGIN PGP PUBLIC KEY BLOCK-
Version: PGPfreeware 6.5.8 for non-commercial use 

mQGiBDr60ScRBADsdYfjVgLPiUU8kJvLx9rsONfx1K4wPAKLUCcFOyhmBvIT/EEY
pE2PVoOjosUdlkGGGFo9BLUi7UHoTrL7NyupJ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F5
-END PGP PUBLIC KEY BLOCK-
=cut


- Original Message -
From: "David Draley" <[EMAIL PROTECTED]>
Date: Wednesday, June 6, 2001 3:16 pm
Subject: perl help!!

> is there a way to call a perl sub routines using a FORM when a 
> "submit"button is clicked?
> 
> I am trying to push data to a mySQL database table and when my 
> form is
> loaded into the browser or is "refreshed" the browser runs through 
> my cgi
> script and pushes "null" values to the table.  Once the form is 
> filled and
> the user clicks the form "submit button" the form works and pushes the
> correct values.
> 
> 
> thanks
> david
> 
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com
> 
>