RE: writing to CSV file

2005-03-11 Thread Thomas Bätzler
SG Edwards [EMAIL PROTECTED] asked:
 I have a program that extracts variables from a list of 
 flatfiles and I want to insert these variables into a 
 PostreSQL database.
 
 I was planning on creating a CSV file with a line allocated 
 for each file which can then be inserted into the database 
 using the COPY command.
 
 Is the best way to do this?!
 
 How do I output my variables (accession, display_id, desc) to 
 CSV file?

Wouldn't it be much easier to do away with the intermediate
CSV file and write to the database directly? Using DBI with
the DBD::Pg driver that should be quite easy.

HTH,
Thomas

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: writing to CSV file

2005-03-11 Thread Marco Antonio Manzo
On Fri, 2005-03-11 at 10:25 +, SG Edwards wrote:
 
 Hi,
 
 I have a program that extracts variables from a list of flatfiles and I want 
 to
 insert these variables into a PostreSQL database.
 
 I was planning on creating a CSV file with a line allocated for each file 
 which
 can then be inserted into the database using the COPY command.
 
 Is the best way to do this?!
 
 How do I output my variables (accession, display_id, desc) to CSV file?
 
 ta
 

DBD::CSV might help you.

Regards,

-- 
Marco Antonio Manzo Bañuelos
[EMAIL PROTECTED]
http://www.unixmonkeys.com/amnesiac/



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: writing to a file

2004-05-20 Thread Wiggins d Anconia
 Hi
 
 I have a very simple cgi script that I have put onto a webserver. I want
 to write to a log file when it is run. My problem is that the open file
 command always fails (and I get the openFailed message in my browser).
 (even if i try opening for input it fails). I have created the file called
 log.dat in the same folder as the script (cgi-bin) and set attributes to
 read/write using chmod.
 
 Is there any easy way I can find out why the file cant be opened (is it
 permissions?). 

You can get further help on what you need to know by using the $!
variable in your exit code. $! is a special variable (perldoc perlvar)
that tells you the reason why a particular action fails. See below.

Do I need to fully qualify the filepath? if so how do I do
 that? Is it because I'm not allowed to have log files in the cgi-bin
 folder?
 

Shouldn't, depends, possibly but not necessarily.

 Any help for an absolute beginner appreciated.
 steve
   
 
 #!/usr/local/bin/perl
 

use strict; #always
use warnings; #usually

 $Msg = ;

my $Msg = '';

 
 if( ! open (LOGFILE,  log.dat) ){
$Msg = OpenFailed;

$Msg = Open failed: $!;

$Msg will now include the human readable version of why the open fails.

 }
 else {
   $Msg = OpenWorked;
   #print LOGFILE $Msg;
   close (LOGFILE) ;
 }
 
 print Content-type: text/html\n\n;
 
 print EOF;
 HTML
 
 HEAD
 TITLEResult/TITLE
 /HEAD
 BODY
 TABLE DIR=LTR BORDER
 CAPTION$Msg/CAPTION
 TR
 TD$Msg/TD
 /BODY
 /HTML
 EOF
 

Give it a shot and see if that helps, if not post again...

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: writing to a file

2004-05-20 Thread Gottron, Shirley A
Also, the first line,

 #!/usr/local/bin/perl

What if the server isn't a UNIX server, but an IIS server? Doesn't this line
have to change?



-Original Message-
From: Wiggins d Anconia [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 20, 2004 10:28 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: writing to a file


 Hi
 
 I have a very simple cgi script that I have put onto a webserver. I want
 to write to a log file when it is run. My problem is that the open file
 command always fails (and I get the openFailed message in my browser).
 (even if i try opening for input it fails). I have created the file called
 log.dat in the same folder as the script (cgi-bin) and set attributes to
 read/write using chmod.
 
 Is there any easy way I can find out why the file cant be opened (is it
 permissions?). 

You can get further help on what you need to know by using the $!
variable in your exit code. $! is a special variable (perldoc perlvar)
that tells you the reason why a particular action fails. See below.

Do I need to fully qualify the filepath? if so how do I do
 that? Is it because I'm not allowed to have log files in the cgi-bin
 folder?
 

Shouldn't, depends, possibly but not necessarily.

 Any help for an absolute beginner appreciated.
 steve
   
 
 #!/usr/local/bin/perl
 

use strict; #always
use warnings; #usually

 $Msg = ;

my $Msg = '';

 
 if( ! open (LOGFILE,  log.dat) ){
$Msg = OpenFailed;

$Msg = Open failed: $!;

$Msg will now include the human readable version of why the open fails.

 }
 else {
   $Msg = OpenWorked;
   #print LOGFILE $Msg;
   close (LOGFILE) ;
 }
 
 print Content-type: text/html\n\n;
 
 print EOF;
 HTML
 
 HEAD
 TITLEResult/TITLE
 /HEAD
 BODY
 TABLE DIR=LTR BORDER
 CAPTION$Msg/CAPTION
 TR
 TD$Msg/TD
 /BODY
 /HTML
 EOF
 

Give it a shot and see if that helps, if not post again...

http://danconia.org


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




RE: writing to a file

2004-05-20 Thread Wiggins d Anconia
Please bottom post...

 Also, the first line,
 
  #!/usr/local/bin/perl
 
 What if the server isn't a UNIX server, but an IIS server? Doesn't
this line
 have to change?
 

Careful, Unix is an OS type, IIS is an application software group.

It is my understanding (which could be very wrong) that IIS/Perl will
just ignore the line, IIS will have a pre-registered handler for the
script call, then Perl should recognize the line for what it is and skip
it, (with the small exception that flags provided on the line may be
included, such as -T).

Please test this before taking my word for it though :-)...

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: writing to a file

2004-05-20 Thread William McKee
On Thu, May 20, 2004 at 09:02:18AM -, PerlDiscuss - Perl Newsgroups and mailing 
lists wrote:
 Is there any easy way I can find out why the file cant be opened (is it
 permissions?).

Yes, print the error message that Perl provides in $!. For example,

eval {
open (LOGFILE,  log.dat) || die Can't open log.day for writing: $!;
}
if ($@) {
$Msg = $@;
}


 Do I need to fully qualify the filepath?  if so how do I do that? Is
 it because I'm not allowed to have log files in the cgi-bin folder?

I don't think so if it's in the same directory as the cgi script. These
questions all depend on how your ISP has configured the webserver.


HTH,
William

-- 
Knowmad Services Inc.
http://www.knowmad.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: writing output to file

2004-04-22 Thread Manfred . Beilfuss
Hi Graeme,



   
   
Graeme McLaren   
   
[EMAIL PROTECTED]An: [EMAIL PROTECTED]

tmail.com  Kopie: 
   
Thema:  writing output to file 
   
22.04.2004 10:47   
   
   
   
   
   




Morning all, I've got a problem where I need to write the output of a
program to a file such as:

/opt/www/htdig/bin/rundig -vv  output

This prints the output to the screen, how to I write this to a file?
And to the file in my place !
Isn't your question a bit off-topic??

Cheers,

Graeme

_









-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Re: writing output to file

2004-04-22 Thread Graeme McLaren
I would say file handling is a beginner topic so i wouldn't consider it off 
topic, apologies if it is.

Problem solved anyway

Graeme :)





From: [EMAIL PROTECTED]
To: Graeme McLaren [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
Subject: Re: writing output to file
Date: Thu, 22 Apr 2004 10:56:11 +0200
MIME-Version: 1.0
Received: from onion.perl.org ([63.251.223.166]) by mc2-f26.hotmail.com 
with Microsoft SMTPSVC(5.0.2195.6824); Thu, 22 Apr 2004 01:56:49 -0700
Received: (qmail 18074 invoked by uid 1005); 22 Apr 2004 08:56:40 -
Received: (qmail 18055 invoked from network); 22 Apr 2004 08:56:39 -
Received: from x1.develooper.com (63.251.223.170)  by onion.develooper.com 
with SMTP; 22 Apr 2004 08:56:39 -
Received: (qmail 21073 invoked by uid 225); 22 Apr 2004 08:56:39 -
Received: (qmail 21062 invoked by alias); 22 Apr 2004 08:56:38 -
Received: from Unknown (HELO mail.dvag.com) (212.211.201.40)  by 
la.mx.develooper.com (qpsmtpd/0.27.1) with ESMTP; Thu, 22 Apr 2004 01:56:38 
-0700
Received: from PTFW201.dvag.com (PTVS02 [10.100.21.12])by mail.dvag.com 
(8.12.10+Sun/8.12.10) with SMTP id i3M8u9bo001944;Thu, 22 Apr 2004 10:56:09 
+0200 (CEST)
Received: from  ([10.61.10.142]) by PTFW201; Thu, 22 Apr 2004 10:56:11 
+0200 (CEST)
X-Message-Info: JGTYoYF78jEHjJx36Oi8+YDSEg8qKPPD
Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
List-Post: mailto:[EMAIL PROTECTED]
List-Help: mailto:[EMAIL PROTECTED]
List-Unsubscribe: mailto:[EMAIL PROTECTED]
List-Subscribe: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
X-Spam-Status: No, hits=0.3 required=7.0tests=NO_REAL_NAME
X-Spam-Check-By: la.mx.develooper.com
X-Mailer: Lotus Notes Release 5.07a  May 14, 2001
Message-ID: [EMAIL PROTECTED]
X-MIMETrack: Serialize by Router on Notes02/DVAG(Release 5.0.8 |June 18, 
2001) at 22.04.2004 10:56:12
X-Spam-Rating: onion.develooper.com 1.6.2 0/1000/N
Return-Path: [EMAIL PROTECTED]
X-OriginalArrivalTime: 22 Apr 2004 08:56:51.0563 (UTC) 
FILETIME=[C0CC73B0:01C42847]

Hi Graeme,



Graeme McLaren
[EMAIL PROTECTED]An: [EMAIL PROTECTED]
tmail.com  Kopie:
Thema:  writing output to 
file
22.04.2004 10:47





Morning all, I've got a problem where I need to write the output of a
program to a file such as:

/opt/www/htdig/bin/rundig -vv  output

This prints the output to the screen, how to I write this to a file?
And to the file in my place !
Isn't your question a bit off-topic??

Cheers,

Graeme

_








--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response

_
Stay in touch with absent friends - get MSN Messenger 
http://www.msn.co.uk/messenger

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response



Re: Writing to a file

2002-02-16 Thread Briac Pilpré

On Sat, 16 Feb 2002 at 01:19 GMT, Naika - Ev1 wrote:
 I'm trying to write to a file from a 5 choice radio form and I keep
 getting this error
 Undefined subroutine main::param called at pollresults_rg.pl line 5.
 What does that mean?

 It means that the param() subroutine can't be found in the main package
 (your program). But in fact, you really want to use the CGI.pm param()
 subroutine (CGI::param). To be able to use it directly in your program,
 you must first import it with a statement like 'use CGI qw(param);' at
 the top of your script.

-- 
briac
  dynamic .sig on strike, we apologize for the inconvenience 


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




RE: Writing to a file

2002-01-31 Thread John Edwards



What OS are you running? I've included a script that uses Win32::OLE to
interface with Excel. You'll need to be on a Win32 machine, with Excel
installed.

There is also a module called Spreadsheet::WriteExcel which is platform
independant, but I have not had any experience using this.

HTH

John

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 17:46
To: PERL
Subject: Writing to a file


I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been limited
to outputting data to a JSP page but in this case I need to send it to a
excel file.  Does anyone know if there are examples out there that can show
me how to do this?

Thank you in advance

Lance


-- 
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.


 eventlog.zip  



eventlog.zip
Description: Binary data

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


RE: Writing to a file

2002-01-31 Thread Lance Prais

I am working on a Solaris box.  So I will try the winExcel, hopefully that
will solve this.

Thank You
Lance

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 7:50 AM
To: 'Lance Prais'; PERL
Subject: RE: Writing to a file




What OS are you running? I've included a script that uses Win32::OLE to
interface with Excel. You'll need to be on a Win32 machine, with Excel
installed.

There is also a module called Spreadsheet::WriteExcel which is platform
independant, but I have not had any experience using this.

HTH

John

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 17:46
To: PERL
Subject: Writing to a file


I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been limited
to outputting data to a JSP page but in this case I need to send it to a
excel file.  Does anyone know if there are examples out there that can show
me how to do this?

Thank you in advance

Lance


--
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.


 eventlog.zip


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




Re: Writing to a file

2002-01-31 Thread Bill Akins

There is a great article you can read about using
Spreadsheet::WriteExcel and Spreadsheet::ParseExcel modules.

It can be found here:
http://www-106.ibm.com/developerworks/linux/library/l-pexcel/

HTH!


 Lance Prais [EMAIL PROTECTED] 01/31/02 12:45PM 
I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been
limited
to outputting data to a JSP page but in this case I need to send it to
a
excel file.  Does anyone know if there are examples out there that can
show
me how to do this?

Thank you in advance

Lance


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




RE: Writing to a file

2002-01-31 Thread Timothy Johnson

 
Supposedly there's a module out there called Spreadsheet::WriteExcel, but I
haven't tried it yet.  That might also be worth a look.

-Original Message-
From: Lance Prais
To: John Edwards; PERL
Sent: 1/31/02 9:57 AM
Subject: RE: Writing to a file

I am working on a Solaris box.  So I will try the winExcel, hopefully
that
will solve this.

Thank You
Lance

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 7:50 AM
To: 'Lance Prais'; PERL
Subject: RE: Writing to a file




What OS are you running? I've included a script that uses Win32::OLE to
interface with Excel. You'll need to be on a Win32 machine, with Excel
installed.

There is also a module called Spreadsheet::WriteExcel which is platform
independant, but I have not had any experience using this.

HTH

John

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 17:46
To: PERL
Subject: Writing to a file


I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been
limited
to outputting data to a JSP page but in this case I need to send it to a
excel file.  Does anyone know if there are examples out there that can
show
me how to do this?

Thank you in advance

Lance


--
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.


 eventlog.zip


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



This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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




RE: Writing to a file

2002-01-31 Thread MECKLIN, JOE (ASI)

I have used Spreadsheet::WriteExcel and it works without a hitch for me,
though I just do barebones cell creation on a single worksheet, nothing
fancy at all.  Still, no one has complained at all about the end result not
being usable.



-Original Message-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 10:40 AM
To: 'Lance Prais '; 'John Edwards '; 'PERL '
Subject: RE: Writing to a file


 
Supposedly there's a module out there called Spreadsheet::WriteExcel, but I
haven't tried it yet.  That might also be worth a look.

-Original Message-
From: Lance Prais
To: John Edwards; PERL
Sent: 1/31/02 9:57 AM
Subject: RE: Writing to a file

I am working on a Solaris box.  So I will try the winExcel, hopefully
that
will solve this.

Thank You
Lance

-Original Message-
From: John Edwards [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 31, 2002 7:50 AM
To: 'Lance Prais'; PERL
Subject: RE: Writing to a file




What OS are you running? I've included a script that uses Win32::OLE to
interface with Excel. You'll need to be on a Win32 machine, with Excel
installed.

There is also a module called Spreadsheet::WriteExcel which is platform
independant, but I have not had any experience using this.

HTH

John

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: 31 January 2002 17:46
To: PERL
Subject: Writing to a file


I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been
limited
to outputting data to a JSP page but in this case I need to send it to a
excel file.  Does anyone know if there are examples out there that can
show
me how to do this?

Thank you in advance

Lance


--
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.


 eventlog.zip


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




This email may contain confidential and privileged 
material for the sole use of the intended recipient. 
If you are not the intended recipient, please contact 
the sender and delete all copies.

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

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




RE: Writing to a file

2002-01-31 Thread Bill Akins

For others who may want to see how module works...

Here is a snippet of code I used with the Write:Excel module...  Was
written and run on WinNT without Excel installed on the box.  It reads
in csv files into Excel file and then sets some limited formatting
(freeze panes and set column widths).  Thanks to Japhy for help with the
sequence on this script!

Preliminary stuff here...

($first) = @ARGV = grep !-d, glob C:/SMTPBeam/Stats/sm*.csv;  #Make a
list of the files to process

$FILE2 = C:/SMTPBeam/Stats/Stats for $mth-$yr.xls;  #Name output
file
my $workbook  = Spreadsheet::WriteExcel-new($FILE2);
my $worksheet = $workbook-addworksheet(Stats for $mth-$yr);
my $row = 0;

while () {#Read in the data to Spreadsheet
s///g; #Kill  appearing in source
s/^0/200/g;# Change year (ie: 05 to 2005) Had to do
some date trickery here so Excel wouldn't freak out  Original date
format was YYMMDD

if ($ARGV eq $first or $. !=1) # If first file, read all rows else skip
header on others
{chomp;
my @Fld = split(',', $_);

my $col = 0;
foreach my $token (@Fld) {
$worksheet-write($row, $col, $token);
$col++;
}
$row++;}
close ARGV if eof;

#Formatting Section
$worksheet-freeze_panes('B2'); # Using A1 notation, Column 1 and Row A
are frozen
$worksheet-set_column('A:B',  10); # Column  A-B   width set to 10
$worksheet-set_column('C:C',  05); # Columns C width set to 5
$worksheet-set_column('D:D',  07); # Columns D width set to 7
$worksheet-set_column('E:F',  35); # Columns E-F width set to 35
$worksheet-set_column('G:G',  10); # Columns G width set to 10
}

Do whatever you want with file here like mail it or FTP...

 John Edwards [EMAIL PROTECTED] 01/31/02 10:49AM 


What OS are you running? I've included a script that uses Win32::OLE
to
interface with Excel. You'll need to be on a Win32 machine, with Excel
installed.

There is also a module called Spreadsheet::WriteExcel which is
platform
independant, but I have not had any experience using this.

HTH

John

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]] 
Sent: 31 January 2002 17:46
To: PERL
Subject: Writing to a file


I have a question regarding writing to a file.

I have written a script and my experiences in perl thus far has been
limited
to outputting data to a JSP page but in this case I need to send it to
a
excel file.  Does anyone know if there are examples out there that can
show
me how to do this?

Thank you in advance

Lance


-- 
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.


 eventlog.zip  

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




RE: writing to a file

2001-12-28 Thread Lance Prais

Does anyone know how to grab the server time to include it in  a file?

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




RE: writing to a file

2001-12-28 Thread Johnson, Shaunn

Howdy:

You're not talking about something like THIS, are you?

[snip example]

open DATE, date +%H:%M;
$date=DATE;
chop $date;

[/snip example]


And as I look at it, I'm thinking that might not be right.
I just modified this (like two seconds ago from this:

[snip]

open DATE, date |;
$date=DATE;
chop $date;

[/snip]

So maybe I'm way off on what exactly it is you're looking to do ...


-X

-Original Message-
From: Lance Prais [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 28, 2001 8:29 PM
To: Lance Prais; [EMAIL PROTECTED]
Subject: RE: writing to a file


Does anyone know how to grab the server time to include it in  a file?

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



Re: Writing a log file?

2001-08-28 Thread Curtis Poe

--- John Way [EMAIL PROTECTED] wrote:
 Does anyone know how to get a perl script to write out each line of code to
 an output (log) file as it performs each line? (Other than a print
 statement after everyline) I've looked in the perlrun documentation, but
 could not find anything.

I don't know if this is possible.  If anyone has any suggestions for you, I'd be eager 
to see
them.

In the meantime, here's one thought:

use Devel::TraceMethods qw ( PackageOne PackageTwo );

This would allow you log all function calls.  If you have good, modular code, this can 
track
what's going on for you.  You can find this at:

http://theoryx5.uwinnipeg.ca/CPAN/data/Devel-TraceMethods/TraceMethods.html

You could also try Devel::DProf.

perl -d:DProf somescript.pl

Then, to dump a list of function calls:

dprofpp -U

See 'perldoc Devel::DProf' and 'perldoc dprofpp'.  These should be included with your 
Perl
distribution so there's nothing extra to download.

Also, you might here someone suggest that you write a script that will insert the 
print statements
for you.  This is likely to be problematic.  If the script is small, a script that 
inserts the
print statements could be hacked together, but then you'd have to go in and fine-tune 
it.  If your
script is large, it ain't gonna work.  Remember the old adage:  only Perl can parse 
perl.

If you wanted to try the latter route (the idea is to parse your script, grab each 
statements and
insert a print statement after it containing the statement), you should work up 
something with
Parse::RecDescent.  However, I think it is *very* unlikely that anyone is going to be 
successful
with this.  I only toss it out because I'm sure it's crossed *somebody's* mind.

Cheers,
Curtis Ovid Poe
 
 My objective is to get a file that can be checked in case of an error to
 see where the program blew up.
 Is there a better way to do accomplish this?
 I am trying to emulate the set verify command from VMS DCL
 
 Thanks,
 
 John Way
 
 
 
 
  Confidentiality Notice: ***
 Privileged/Confidential information may be contained in this message
 and is intended only for the use of the addressee.  Please advise
 immediately if you or your employer do not consent to Internet e-mail
 for messages of this kind.  If you are not the addressee, or person
 responsible for delivering to the person addressed, you may not copy or
 deliver this to anyone else.  If you receive this message by mistake,
 please notify the sender immediately by return e-mail.  Thank you.
 
 
 
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: Writing a log file?

2001-08-28 Thread Paul Johnson

On Tue, Aug 28, 2001 at 02:42:58PM -0400, John Way wrote:
 Does anyone know how to get a perl script to write out each line of code to
 an output (log) file as it performs each line? (Other than a print
 statement after everyline) I've looked in the perlrun documentation, but
 could not find anything.

Take a look at PERLDB_OPTS described in perldebug.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

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




Re: Writing a log file?

2001-08-28 Thread Curtis Poe

--- Randal L. Schwartz [EMAIL PROTECTED] wrote:
  John == John Way [EMAIL PROTECTED] writes:
 
 John  Confidentiality Notice: ***
 John Privileged/Confidential information may be contained in this message
 John and is intended only for the use of the addressee.  Please advise
 John immediately if you or your employer do not consent to Internet e-mail
 John for messages of this kind.
 
 You are under advisement that I do not consent to Internet e-mail for
 messages of this kind, meaning ones with meaningless drivel
 disclaimers on the end.

[snip]

I can see the flames coming already.  In an attempt to stop them before they start, 
notice that
the original email stated specifically Please advise immediately if you or your 
employer do not
consent to Internet e-mail for messages of this kind..  That's precisely what 
happened.

Cheers,
Curtis Ovid Poe


=
Senior Programmer
Onsite! Technology (http://www.onsitetech.com/)
Ovid on http://www.perlmonks.org/

__
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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




Re: Writing a log file?

2001-08-28 Thread Michael Fowler

On Tue, Aug 28, 2001 at 02:42:58PM -0400, John Way wrote:
 Does anyone know how to get a perl script to write out each line of code to
 an output (log) file as it performs each line? (Other than a print
 statement after everyline) I've looked in the perlrun documentation, but
 could not find anything.

I do not know of such a feature.  The Perl debugger gets close, but it's
interactive; perhaps you could get it to log to a file, I don't know.

 
 My objective is to get a file that can be checked in case of an error to
 see where the program blew up.
 Is there a better way to do accomplish this?
 I am trying to emulate the set verify command from VMS DCL

Perl does a run beforehand to compile the code to bytecode, and aborts if
any syntax errors are found; errors are printed with an accompanying line
number.  Any warning messages printed by perl itself include a line number. 
If an operation you're doing fails (say, an open call) you should print some
unique message to indicate what went wrong, with what data, that way you can
search back through the code to find the error message.  Other than that,
you can step through code line by line with the perl debugger (perldoc
perldebug).

I guess I'm not understanding why you need specifically this.  What kinds of
operations can blow up so drastically, without any trace of what operation
it is, or where it is?  What did this VMS DCL 'set verify' command do?  What
was it used for?


Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--

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




Re: Writing a log file?

2001-08-28 Thread Randal L. Schwartz

 John == John Way [EMAIL PROTECTED] writes:

John  Confidentiality Notice: ***
John Privileged/Confidential information may be contained in this message
John and is intended only for the use of the addressee.  Please advise
John immediately if you or your employer do not consent to Internet e-mail
John for messages of this kind.

You are under advisement that I do not consent to Internet e-mail for
messages of this kind, meaning ones with meaningless drivel
disclaimers on the end.

Email disclaimers are as unenforceable as shrink-wrap licenses.

Please stop putting them on your messages.  If you can't do that for
messages from Milliken.com, please get a hotmail/yahoo/whatever
free-mail-address for posting to this list.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[EMAIL PROTECTED] URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

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