Re: Help with line length in script

2006-06-08 Thread Chris
On Thursday 08 June 2006 8:11 pm, Timothy Johnson wrote: > Here's the offending line: > > ### > $TXT .= swrite("@ @> @>",$rec, > $stats{virus}->{$rec}, $percent)."%\n" if $text; ### > > The @ part is telling format to print up to 21 > cha

RE: Help with line length in script

2006-06-08 Thread Timothy Johnson
Here's the offending line: ### $TXT .= swrite("@ @> @>",$rec, $stats{virus}->{$rec}, $percent)."%\n" if $text; ### The @ part is telling format to print up to 21 characters of $rec and truncate the rest, left justifying it. If you wa

Help with line length in script

2006-06-08 Thread Chris
I use a script that generates stats for clamav. It generates both txt and html output. The problem is that the line length in the txt and html output differ. For instance in the txt output it shows this: (the numbers differ because the files were generated at different times) Email.ScamS.Gen00

Re: Yet another OO question

2006-06-08 Thread Anthony Ettinger
On 6/8/06, Lawrence Statton <[EMAIL PROTECTED]> wrote: > > I would prefer it to return the old value: > > > > sub foo { I see...I i've been more or less looking at the current state $curr = $foo->bar(); $old = $curr; $curr = $foo->bar('new value'); -- Anthony Ettinger Signature: http://cho

RE: parsing a CSV file with more fields than column names

2006-06-08 Thread Timothy Johnson
-Original Message- From: RICHARD FERNANDEZ [mailto:[EMAIL PROTECTED] Sent: Thursday, June 08, 2006 2:37 PM To: beginners@perl.org Subject: RE: parsing a CSV file with more fields than column names >> Are you SURE that there might be commas in the other fields? >> I would hope that whoev

RE: parsing a CSV file with more fields than column names

2006-06-08 Thread RICHARD FERNANDEZ
> Are you SURE that there might be commas in the other fields? > I would hope that whoever made this file you're parsing would > have thought of this if they ever intended to later use the data. Good point. But I have no way of verifying that. These CSV files are provided to me by an outside sou

Re: modifying @INC permanently

2006-06-08 Thread Anthony Ettinger
On 6/8/06, Chad Perrin <[EMAIL PROTECTED]> wrote: > Yes. Recompile Perl setting the appropriate compile-time flags. More > importantly, though: Why? It is just easier to install your modules > in the standardly defined place for site-specific modules. By install do you mean cp myMod.pm to /

Re: modifying @INC permanently

2006-06-08 Thread Anthony Ettinger
You do not need logic to do that. It would seem better to use: use lib '/path/to/my/misplaced/perl-modules'; The point is to not have to specify a local path at all: use lib qw(/path); push(@inc, '/path'); Each script tests for OS: linux/sunos, and win32, and pushes the path to @INC ac

Re: modifying @INC permanently

2006-06-08 Thread Chad Perrin
On Thu, Jun 08, 2006 at 01:59:46PM -0700, Lawrence Statton wrote: > > Is there a way to modify @INC for the perl installation as a whole? > > Yes. Recompile Perl setting the appropriate compile-time flags. More > importantly, though: Why? It is just easier to install your modules > in the stand

RE: parsing a CSV file with more fields than column names

2006-06-08 Thread Timothy Johnson
-Original Message- From: RICHARD FERNANDEZ [mailto:[EMAIL PROTECTED] Sent: Thursday, June 08, 2006 2:04 PM To: beginners@perl.org Subject: RE: parsing a CSV file with more fields than column names > > Hello Rich > > Hi, Chris, thanks for your response > > >> >> See docs for perlfunc, s

RE: parsing a CSV file with more fields than column names

2006-06-08 Thread RICHARD FERNANDEZ
> Hello Rich Hi, Chris, thanks for your response > > See docs for perlfunc, specifically split. > > Especially, the form for split > 'split /PATTERN/,EXPR,LIMIT' > > By setting the limit, you will be able to solve the problem. > > Chris > The thing is I can't be sure that there will ne

Re: modifying @INC permanently

2006-06-08 Thread Lawrence Statton
> Is there a way to modify @INC for the perl installation as a whole? Yes. Recompile Perl setting the appropriate compile-time flags. More importantly, though: Why? It is just easier to install your modules in the standardly defined place for site-specific modules. > > All my scripts have log

Re: Yet another OO question

2006-06-08 Thread Lawrence Statton
> > I would prefer it to return the old value: > > > > sub foo { > > my $self = shift; > > my $old_foo = $self->{'foo'}; > > $self->{'foo'} = shift if @_ > 0; > > return $old_foo; > > } > > > > > > If you set a new value, why would you want your client to still be > using the old value? B

RE: modifying @INC permanently

2006-06-08 Thread Timothy Johnson
Win32 changes to the environment from within your script won't be permanent, so that won't work unless you do the system call that sets the environment variable permanently (and also the local one, because it won't reflect the changes to the system call until it is invoked again). Do you have the

Re: How to create a new browser window using CGI

2006-06-08 Thread chen li
> Hello , > > Hope this work. > > #!c:/Perl/bin/perl.exe > use warnings; > use strict; > use CGI; > > my $query_obj=CGI->new(); > > #creat webpage > print $query_obj->header; > print $query_obj->start_html('My First Webpage'); > if (!$query_obj->param){ > print > $query_obj->start_

RE: parsing a CSV file with more fields than column names

2006-06-08 Thread Timothy Johnson
As long as you're sure that there aren't any commas in your data, you could always do this: my @records = split(/,/,$line,17); This will limit your total records to 17, and will dump the rest into the 17th record. Then you can split the last record again if you want. If you have some comma

modifying @INC permanently

2006-06-08 Thread Anthony Ettinger
Is there a way to modify @INC for the perl installation as a whole? All my scripts have logic to push the same directory to @INC. It's rather repetative. I know I can export PERL_LIB environment variable, but I need something for all system users (including win32). -- Anthony Ettinger Signatu

Re: Yet another OO question

2006-06-08 Thread Anthony Ettinger
On 6/8/06, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: On Thu, 2006-08-06 at 10:56 -0700, Anthony Ettinger wrote: > i prefer the return once method: > > sub foo > { > my $self = shift; > if (@_ == 1) { $self->{'foo'} = shift; } > > return $self->{'foo'}; > } I would prefer it to re

Re: parsing a CSV file with more fields than column names

2006-06-08 Thread Chris Charley
- Original Message - From: ""RICHARD FERNANDEZ"" <[EMAIL PROTECTED]> Newsgroups: perl.beginners To: Sent: Thursday, June 08, 2006 11:17 AM Subject: parsing a CSV file with more fields than column names Hello All, I'm just trying to get some ideas for the best way to approach this...

Re: Yet another OO question

2006-06-08 Thread Mr. Shawn H. Corey
On Thu, 2006-08-06 at 10:56 -0700, Anthony Ettinger wrote: > i prefer the return once method: > > sub foo > { > my $self = shift; > if (@_ == 1) { $self->{'foo'} = shift; } > > return $self->{'foo'}; > } I would prefer it to return the old value: sub foo { my $self = shift; my $

Re: Pattern Matching

2006-06-08 Thread anu p
Hi, Sorry, it was working, found out the problem was due to something else. Thanks, Anu. --- anu p <[EMAIL PROTECTED]> wrote: > Hi, > > I have the following code snippet in which I open > two > files for read. > > For each line in file 1 (log.txt), I extract the > test > name, which is

Re: Yet another OO question

2006-06-08 Thread Anthony Ettinger
On 6/8/06, Ricardo SIGNES <[EMAIL PROTECTED]> wrote: * Graeme McLaren <[EMAIL PROTECTED]> [2006-06-08T05:44:05] > Hi all, I've just been reading a bit about accessor get/set methods. I > have a method: > > sub even{ >my $self = shift; >my $even = shift; > >$self->{_even} = $even if

Re: How to match a directory path?

2006-06-08 Thread sfantar
sfantar a écrit : Hello everybody As the path to a directory under Linux is like /file/file/file where file can be a word containing either - or _ . Which regexp can match this in the best way? I tried (/\w[-]?\w/)+ but it doesn't work well. Thanks in advance. Could this be a solution : htt

Re: Exec a script on one server that will exec other scripts on a different server..

2006-06-08 Thread Chad Perrin
On Thu, Jun 08, 2006 at 02:54:06PM +0200, William Paulsen (W) wrote: > > I'm trying to write a perl script that will run on one server but can > instruct either socker server deamon on another server to exec any one > of three applications on a different box. The reason for this is the > password

Re: How to match a directory path?

2006-06-08 Thread Dr.Ruud
sfantar schreef: > As the path to a directory under Linux is like /file/file/file where > file can be a word containing either - or _ . > Which regexp can match this in the best way? > I tried (/\w[-]?\w/)+ but it doesn't work well. You have two slashes in there, as if you want to match /file//

FW: Exec a script on one server that will exec other scripts on a different server..

2006-06-08 Thread William Paulsen \(W\)
From: William Paulsen (W) Sent: Thu 2006-06-08 14:54 To: beginners@perl.org Subject: Exec a script on one server that will exec other scripts on a different server.. Hi, I'm trying to write a perl script that will run on one server but can instruct either so

Pattern Matching

2006-06-08 Thread anu p
Hi, I have the following code snippet in which I open two files for read. For each line in file 1 (log.txt), I extract the test name, which is of format "dir/file" which is my pattern and search for the line with same pattern in file 2 (rg_table.txt). Somehow it's not working. open (TST_IN, "r

How to match a directory path?

2006-06-08 Thread sfantar
Hello everybody As the path to a directory under Linux is like /file/file/file where file can be a word containing either - or _ . Which regexp can match this in the best way? I tried (/\w[-]?\w/)+ but it doesn't work well. Thanks in advance. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

Re: Two perl installation

2006-06-08 Thread Tom Phoenix
On 6/8/06, Vijay Kumar Adhikari <[EMAIL PROTECTED]> wrote: How do I know which "perl" executable CGI is running If your sysadmin won't tell you, upgrade your sysadmin. :-) But you can use Inside to tell you about your CGI configuration, including which perl binary runs it: http://search.c

Re: How to create a new browser window using CGI

2006-06-08 Thread Prabu Ayyappan
On 6/8/06, chen li <[EMAIL PROTECTED]> wrote: Dear all, How can I add a line (lines) to the following script so that I can show the results on a new browser window after I press the submit button? Thanks, Li #!c:/Perl/bin/perl.exe use warnings; use strict; use CGI; my $query_obj=CGI->new()

parsing a CSV file with more fields than column names

2006-06-08 Thread RICHARD FERNANDEZ
Hello All, I'm just trying to get some ideas for the best way to approach this... I have a CSV file whose first line is a header. According to this header there should be 17 values per line. Unfortunately this is not the case. It seems that the first 16 header values match up with the first 16 va

Re: Two perl installation

2006-06-08 Thread sfantar
Vijay Kumar Adhikari a écrit : FC3 On 6/8/06, sfantar <[EMAIL PROTECTED]> wrote: Vijay Kumar Adhikari a écrit : > Thanks, but I am not using mod_perl. > > The problem is twofold. It works well when accessed from CGI. It > doesn't complain anything at all. When run in command line, it > generate

Re: Two perl installation

2006-06-08 Thread Vijay Kumar Adhikari
FC3 On 6/8/06, sfantar <[EMAIL PROTECTED]> wrote: Vijay Kumar Adhikari a écrit : > Thanks, but I am not using mod_perl. > > The problem is twofold. It works well when accessed from CGI. It > doesn't complain anything at all. When run in command line, it > generates that error. > > My questions a

Re: Two perl installation

2006-06-08 Thread sfantar
Vijay Kumar Adhikari a écrit : Thanks, but I am not using mod_perl. The problem is twofold. It works well when accessed from CGI. It doesn't complain anything at all. When run in command line, it generates that error. My questions are: 1) How do I know which "perl" executable CGI is running and

RE: Exec a script on one server that will exec other scripts on a different server..

2006-06-08 Thread Jerry DuVal
>Adding it would be an advantage, however right now I just need setup a >client side script that'll tell the server side to exec/run one of >three scripts on the other server. We have a similar situation. One thing we did on the boxes we could not add the key pairs was add a cron that ran a scrip

Re: Two perl installation

2006-06-08 Thread Vijay Kumar Adhikari
Thanks, but I am not using mod_perl. The problem is twofold. It works well when accessed from CGI. It doesn't complain anything at all. When run in command line, it generates that error. My questions are: 1) How do I know which "perl" executable CGI is running and 2) How do I fix that error with

Re: Two perl installation

2006-06-08 Thread sfantar
Vijay Kumar Adhikari a écrit : Hello, I was running an earlier version of perl and upgraded to the latest one. Now when I run perl from command line, I get an error like this [Thu Jun 8 18:57:18 2006] Importer_mysql.pl: install_driver(mysql) failed: Can't load '/usr/local/lib/perl5/site_perl/5.

ldif to CSV

2006-06-08 Thread Mihir Kamdar
hi, I am totally a beginner at perl. I have to write a perl script as following: I am given a ldif(ldap interchange format) file which contains all the information about all employees of my organization. I can use ldapsearch to extract information about one particular employee. I am also given a

RE: Exec a script on one server that will exec other scripts on a different server..

2006-06-08 Thread William Paulsen \(W\)
Adding it would be an advantage, however right now I just need setup a client side script that'll tell the server side to exec/run one of three scripts on the other server. tks William Gugulethu -Original Message- From: Jerry DuVal [mailto:[EMAIL PROTECTED] Sent: 08 June 2006 03:09 PM T

RE: Exec a script on one server that will exec other scripts on a different server..

2006-06-08 Thread Jerry DuVal
>-Original Message- >From: William Paulsen (W) [mailto:[EMAIL PROTECTED] >Sent: Thursday, June 08, 2006 8:54 AM >To: beginners@perl.org >Subject: Exec a script on one server that will exec other scripts on a >different server.. > > >Hi, > >I'm trying to write a perl script that will run o

Exec a script on one server that will exec other scripts on a different server..

2006-06-08 Thread William Paulsen \(W\)
Hi, I'm trying to write a perl script that will run on one server but can instruct either socker server deamon on another server to exec any one of three applications on a different box. The reason for this is the password changes every month and the scripts that I'm currently using fails becaus

Two perl installation

2006-06-08 Thread Vijay Kumar Adhikari
Hello, I was running an earlier version of perl and upgraded to the latest one. Now when I run perl from command line, I get an error like this [Thu Jun 8 18:57:18 2006] Importer_mysql.pl: install_driver(mysql) failed: Can't load '/usr/local/lib/perl5/site_perl/5.8.8/i686-linux/auto/DBD/mysql/my

Re: Yet another OO question

2006-06-08 Thread Ricardo SIGNES
* Graeme McLaren <[EMAIL PROTECTED]> [2006-06-08T05:44:05] > Hi all, I've just been reading a bit about accessor get/set methods. I > have a method: > > sub even{ >my $self = shift; >my $even = shift; > >$self->{_even} = $even if defined($even); >return $self->{_even}; > } >

Re: regex to match a range of numbers

2006-06-08 Thread Flemming Greve Skovengaard
Joshua Colson wrote: On Thu, 2006-06-08 at 00:55 +0200, Flemming Greve Skovengaard wrote: If you are just going to print the day number and you have other dates in a similar format why not just use: print +(split /\s+/, $date)[2]; Well, in this particular instance, I am. However, there have

Yet another OO question

2006-06-08 Thread Graeme McLaren
Hi all, I've just been reading a bit about accessor get/set methods. I have a method: sub even{ my $self = shift; my $even = shift; $self->{_even} = $even if defined($even); return $self->{_even}; } This basically does what a get and set method would do. So why would I need a

Re: OO Perl question

2006-06-08 Thread Anthony Ettinger
my ($option) = $_ =~ s/(.*?)#/; #skip inline comments should be m//, not s// On 6/8/06, Anthony Ettinger <[EMAIL PROTECTED]> wrote: On 6/8/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: > Hi Anthony, good idea about overriding the table names. I had a feeling > there would be a conf file som

Re: OO Perl question

2006-06-08 Thread Anthony Ettinger
On 6/8/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: Hi Anthony, good idea about overriding the table names. I had a feeling there would be a conf file somewhere. As I am outputting the results of the SELECT to an HTML::Template I am already using a Conf file which is another class. This leads

Re: OO Perl question

2006-06-08 Thread Graeme McLaren
Hi Anthony, good idea about overriding the table names. I had a feeling there would be a conf file somewhere. As I am outputting the results of the SELECT to an HTML::Template I am already using a Conf file which is another class. This leads me on to another question. If I instantiate my cla

Re: OO Perl question

2006-06-08 Thread Anthony Ettinger
On 6/8/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: Hi all, this class that I have written lists the contents of a "log" table when the $log->view method is invoked. There is some hardcoded SQL in this method and all I do is pass it a number which then looks up the relevant records. This reall

OO Perl question

2006-06-08 Thread Graeme McLaren
Hi all, this class that I have written lists the contents of a "log" table when the $log->view method is invoked. There is some hardcoded SQL in this method and all I do is pass it a number which then looks up the relevant records. This really isn't a reusable class as far as I understand it