Re: Postgres Example

2002-08-09 Thread zentara

On Thu, 8 Aug 2002 10:33:27 -0400, [EMAIL PROTECTED] (Rob) wrote:

Does any one know of an example script that uses the DBI module, connects
to a PostgreSql database, query's the db, and inserts a record.

I've been using flat text files for any storage that I've needed in the
past but would like to move on with the learning process.  I've read the
perldoc for DBI but I think a small working example would help me out a
great deal.

Make sure postgres is running, put in your username, make sure the db
ztest is created first. This just fills up a products table with random
data.

#!/usr/bin/perl -w
###
# insert_product : this script will insert records into the 
#  products table
###
use DBI;

my $database_name   = ztest;
my $database= dbi:Pg:dbname=$database_name;
my $db_user = zentara;

my $PRODUCT_TB  = products;

# number of record to insert into the table
my $rec_num = 1000;
###

my $dbh = DBI-connect($database,$db_user,) or
 die Can't connect to database\n;

$dbh-do(CREATE TABLE products ( 
  name varchar(50),  
  price int4,
  description varchar(50),
  pic_location varchar(50)
  ));
 

my $sth = $dbh-prepare(INSERT INTO $PRODUCT_TB(name,price,description,
 pic_location) VALUES (?,?,?,?));
 
for ($i = 1; $i = $rec_num; $i++){
my $name = Product $i;
my $price = rand 350;
#my $category = rand 3;
my $desc = Description of product $i;
my $pic = images/product/product.$i..jpg;
 
$sth-execute($name,$price,$desc,$pic);
}
print Finish inserting $rec_num records into table $PRODUCT_TB\n;
$dbh-disconnect;
exit();




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




Re: Problems viewing source in mozilla

2002-08-09 Thread James Williams

Hi everyone,

Turns out it was a mozilla problem after all (I ran into the same 
problem on another site).  I appreciate the response though ( I tried 
manually printing the headers, to no avail), especially on a topic who's 
relevance to this list was suspect ;-)

Thanks tons!
-James

Bob Showalter wrote:

-Original Message-
From: James Williams [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 06, 2002 6:02 PM
To: [EMAIL PROTECTED]
Subject: Problems viewing source in mozilla


Hi everyone,

I'm not sure if this is on topic or not, but I was wondering 
if anyone 
had ever encountered a problem viewing source because of a 
cgi script. 
When I try to view source (the script prints out several 
versions of a 
form with hidden values), I get a message saying the postdata has 
expired from cache. If I repost the data, I see the same form 
(not the 
source), and nothing if I opt not to post the data (these are both in 
pop-up windows).  



I suspect the issue is with the PrintHeader sub (which is where? 
cgi-lib.pl? Why are you using both cgi-lib.pl and CGI.pm?)

If the response header tells the browser not to cache the response,
perhaps Mozilla requires the response to be in the cache in order to
view source. If you really need to view source, you might need
to adjust the Expires and/or Cache-control headers.


  




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




beginner

2002-08-09 Thread Javeed SAR



Hi,

I am giving a command in  command  prompt:

cct checkout -unreserved.

i want to do this:
see if -unreserved exists in command prompt , if it exist just  exit.
How to grep the word -unreservedin perl from the above command
line?

Regards
Javeed





RE: beginner

2002-08-09 Thread NYIMI Jose (BMB)

perldoc GetOpt::Long

Example:

#!/usr/local/bin/perl -w
use strict;
use Getopt::Long;

my $var='';
GetOptions('unreserved' = \$var);
print coucou\n if($var);
__END__


HTH,

José.



-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]] 
Sent: Friday, August 09, 2002 8:56 AM
To: [EMAIL PROTECTED]
Subject: beginner




Hi,

I am giving a command in  command  prompt:

cct checkout -unreserved.

i want to do this:
see if -unreserved exists in command prompt , if it exist just  exit.
How to grep the word -unreservedin perl from the above command
line?

Regards
Javeed




 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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




use of uninitialised value...

2002-08-09 Thread Nandita Mullapudi

i'm trying to run a perl script written to parse a file, and it runs fine
the way it is written, however, after making little changes to accomodate
my file, i get inundated with the following message

Use of uninitialized value in hash element at modif2.pl line 90

can any1 tell me what this means?
many thanks
nandita 



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




to terminate a perl program

2002-08-09 Thread rohana

Dear all,

I am running two perl programs simultaneously. I want to stop 
second whenever the first one stops. How could I do this, your kind 
help is highly appreciated.

regards,
Rohana.




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




Re: use of uninitialised value...

2002-08-09 Thread Sudarshan Raghavan

On Thu, 8 Aug 2002, Nandita Mullapudi wrote:

 i'm trying to run a perl script written to parse a file, and it runs fine
 the way it is written, however, after making little changes to accomodate
 my file, i get inundated with the following message
 
 Use of uninitialized value in hash element at modif2.pl line 90
 
 can any1 tell me what this means?

I guess you are trying to use a undefined value as your hash key.
You will get a more definitive answer if you can post your code.
If it is a big file, upload it to a web page and post the url.


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




Re: to terminate a perl program

2002-08-09 Thread Sudarshan Raghavan

On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote:

 Dear all,
 
 I am running two perl programs simultaneously. I want to stop 
 second whenever the first one stops. How could I do this, your kind 
 help is highly appreciated.

If you have the pid of the other process
perldoc -f kill

 
 regards,
 Rohana.
 
 
 
 
 


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




printing to the top of a file

2002-08-09 Thread stephen . redding

Hi

I have a text file that i want to insert two lines to the top of.
how do i do this?

Stephen Redding

BT Ignite Solutions
Telephone - 0113 237 3277
Fax - 0113 244 1413
Email - [EMAIL PROTECTED]
http://www.technet.bt.com/sit/public/


British Telecommunications plc
Registered office: 81 Newgate Street London EC1A 7AJ
Registered in England no. 180
This electronic message contains information from British Telecommunications
plc which may be privileged or  confidential. The information is intended to
be for the use of the individual(s) or entity named above. If you  are not
the intended recipient be aware that any disclosure, copying, distribution
or use of the contents of  this information is prohibited. If you have
received this electronic message in error, please notify us by  telephone or
email (to the numbers or address above) immediately.



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




Re: use of uninitialised value...

2002-08-09 Thread John W. Krahn

Nandita Mullapudi wrote:
 
 i'm trying to run a perl script written to parse a file, and it runs fine
 the way it is written, however, after making little changes to accomodate
 my file, i get inundated with the following message
 
 Use of uninitialized value in hash element at modif2.pl line 90
 
 can any1 tell me what this means?

Yes, perldiag can.

perldoc perldiag
[snip]
   Use of uninitialized value%s
   (W uninitialized) An undefined value was used as if it
   were already defined.  It was interpreted as a  or a
   0, but maybe it was a mistake.  To suppress this
   warning assign a defined value to your variables.



John
-- 
use Perl;
program
fulfillment

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




how to define default params for subroutines?

2002-08-09 Thread Michael Rauh


how can one define default parameters for subroutines? 

something like:
sub mysub($a, $b=5)
{}

or do i have to do a check like this after entering the sub:
sub mysub
{
  ($a, $b) = @_;
  if (!$b) {$b=5;}
}


thx for help!
michael

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




Re: printing to the top of a file

2002-08-09 Thread Felix Geerinckx

on Fri, 09 Aug 2002 08:54:01 GMT, [EMAIL PROTECTED] (Stephen
Redding) wrote: 

 I have a text file that i want to insert two lines to the top of.
 how do i do this?

This is frequently asked question (FAQ).
You can look up the answer by typing the following at your command 
prompt:

perldoc -q insert

-- 
felix

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




Re: printing to the top of a file

2002-08-09 Thread Sudarshan Raghavan

On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote:

 Hi
 
 I have a text file that i want to insert two lines to the top of.
 how do i do this?

From the command line you can do this, this will retain you original
file as filename~
perl -i~ -pe 'print line1\nline2\n if ($. == 1)' your_text_file

If you want to do this from a perl file, 
open (YOURFILE, $your_file) or die ;
open (TEMPFILE, backup.txt) or die ...;

print TEMPFILE line1\nline2\n;
while (YOURFILE) {
  print TEMPFILE;
}
close (YOURFILE);
close (TEMPFILE);
rename (backup.txt, $your_file);


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




Re: printing to the top of a file

2002-08-09 Thread John W. Krahn

Stephen Redding wrote:
 
 Hi

Hello,

 I have a text file that i want to insert two lines to the top of.
 how do i do this?

perl -i~ -pe'$.==1 and s/^/new line one\nnew line two\n/' text_file


John
-- 
use Perl;
program
fulfillment

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




Re: how to define default params for subroutines?

2002-08-09 Thread John W. Krahn

Michael Rauh wrote:
 
 how can one define default parameters for subroutines?
 
 something like:
 sub mysub($a, $b=5)
 {}

No.


 or do i have to do a check like this after entering the sub:
 sub mysub
 {
   ($a, $b) = @_;
   if (!$b) {$b=5;}
 }

Yes, or:

sub mysub {
  my $a = shift;
  my $b = shift || 5;
}



John
-- 
use Perl;
program
fulfillment

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




Re: printing to the top of a file

2002-08-09 Thread John W. Krahn

Stephen Redding wrote:
 
 Hi

Hello,

 I have a text file that i want to insert two lines to the top of.
 how do i do this?


#!/usr/bin/perl -w
use strict;
use Fcntl ':seek';

my $file = 'text_file.txt';

open FILE, + $file or die Cannot open $file: $!;
my @lines = FILE;

seek FILE, 0, SEEK_SET or die Cannot seek on $file: $!;
print FILE TEXT, @lines;
This is the new line one.
This is the new line two.
TEXT

__END__



John
-- 
use Perl;
program
fulfillment

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




Re: how to define default params for subroutines?

2002-08-09 Thread Felix Geerinckx

on Fri, 09 Aug 2002 09:11:24 GMT, [EMAIL PROTECTED] (John W. Krahn) 
wrote:

 sub mysub {
   my $a = shift;
   my $b = shift || 5;
 }

This only works when 0 or '' are not allowed for the second 
parameter.
   
   my $a = $_[0];
   my $b = defined($_[1]) ? $_[1] : 5;

takes care of this.

An elegant solution, especially when you have a lot of possible 
parameters, is to use named parameters:

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

mysub (A = 10, C = 'Hello, world');

sub mysub {

   croak Invalid parameter list if @_ % 2;
   my %defaults = (
  A = 1,
  B = 2,
  C = 'A string');
  
   my %parameters = (%defaults, @_);
   
   for my $p (sort keys %parameters) {
   print $p has value '$parameters{$p}'\n;
   }
   return;
}


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




piping to a perl script

2002-08-09 Thread Mat Harrison

hi, i am trying to get an email to feed a perl script.

I have aliased the email address to pipe to the program but nothing. What 
variables should I be looking in to get the data that is piped? for example, 
command line arguments are in @ARGV. Is it something to do with $?

I need to be able to process the body of the message a line at a time, with a 
(theoretically) unlimited number of lines.

Also, I know it is slightly of topic but could someone just run by me how to 
pipe a sendmail address to a perl script just for confirmation, off list if 
necessary?


cheers guys

-
This mail sent through IMP: http://horde.org/imp/

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




Re: piping to a perl script

2002-08-09 Thread Sudarshan Raghavan

On Fri, 9 Aug 2002, Mat Harrison wrote:

 hi, i am trying to get an email to feed a perl script.
 
 I have aliased the email address to pipe to the program but nothing. What 
 variables should I be looking in to get the data that is piped? for example, 
 command line arguments are in @ARGV. Is it something to do with $?
 
 I need to be able to process the body of the message a line at a time, with a 
 (theoretically) unlimited number of lines.

When email message is piped into your script you should be reading from
the standard input.

 
 Also, I know it is slightly of topic but could someone just run by me how to 
 pipe a sendmail address to a perl script just for confirmation, off list if 
 necessary?

Your .procmailrc should look like this
:0
* ^From.*your_search_pattern
| your_perl_script

your_perl_script to print the message to a file mail.txt

open (MAILTEXT, mail.txt) or die ;
while (STDIN) {
  print MAILTEXT;
}
close (MAILTEXT);

 
 
 cheers guys
 
 -
 This mail sent through IMP: http://horde.org/imp/
 
 


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




regx way

2002-08-09 Thread Jerry Preston

Hi!

I am looking for a simple way to replace a date in a string:

   %makesql(FORD,waf_end,010602 nowdate,all,0,pdv.CHEVY);\n,
   
to 
   %makesql(FORD,waf_end,080902 nowdate,all,0,pdv.CHEVY);\n,
   
I am new at doing reg's.

Thanks for Your Help,

Jerry


NAVER-MAILER@naver.com

2002-08-09 Thread Jerry Preston

Hey!!

Every time I send an e-mail to Beginners I get an e-mail
[EMAIL PROTECTED], and my e-mail admin says that it contains a
viruses!!

Any ideas what is going on??

Jerry



RE: NAVER-MAILER@naver.com

2002-08-09 Thread Jayashankar Nelamane Srinivasarao

Hi all

This is hapens to me also. The mail comes from this very same email id, 
but also will totally specially characters.

Regards
Jay

-Original Message-
From: Jerry Preston [mailto:[EMAIL PROTECTED]]
Sent: 09 August 2002 17:07
To: Beginners Perl
Subject: [EMAIL PROTECTED]


Hey!!

Every time I send an e-mail to Beginners I get an e-mail
[EMAIL PROTECTED], and my e-mail admin says that it contains a
viruses!!

Any ideas what is going on??

Jerry



**Disclaimer

Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' and 'confidential' and intended for use only by the individual
 or entity to which it is addressed. You are notified that any use, copying 
or dissemination of the information contained in the E-MAIL in any manner 
whatsoever is strictly prohibited.

***



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


Re: piping to a perl script

2002-08-09 Thread drieux


On Friday, August 9, 2002, at 01:38 , Mat Harrison wrote:

 hi, i am trying to get an email to feed a perl script.

 I have aliased the email address to pipe to the program but nothing. What
 variables should I be looking in to get the data that is piped? for 
 example,
 command line arguments are in @ARGV. Is it something to do with $?
[..]


It's the 'get an email to feed' part that confuses me.

assume the simples of pipes

ls -la | myPerlScript

then the following would be a simple implementation of that

### #!/usr/bin/perl -w
### use strict;
###
### while(STDIN) {
###
### print I see: $_;
### }

and would generate

vladimir: 70:] ls -la | /tmp/drieux/silly.pl
I see: total 818
I see: drwxrwxrwt   6 root sys  672 Aug  9 03:30 .
I see: drwxr-xr-x  25 root root 512 Aug  5 13:36 ..
I see: drwxrwxrwx   2 root root 179 Aug  4 23:16 .pcmcia
I see: drwxrwxr-x   2 root root 176 Aug  4 23:16 .X11-pipe
I see: drwxrwxr-x   2 root root 176 Aug  4 23:16 .X11-unix
I see: drwxr-xr-x   2 drieux   house182 Aug  9 04:46 drieux
I see: -rw-r--r--   1 drieux   house 115341 Aug  6 07:00 
patches1028642408.html
I see: -rw-r--r--   1 drieux   house 235943 Aug  6 07:01 
patches1028642436.html
I see: -rw-rw-r--   1 root sys 5584 Aug  4 23:15 ps_data
I see: -rwxrwxr-x   1 root other 48 Aug  5 13:35 sunpro.c.1.0.
4.20
vladimir: 71:]

that technically works for 'getting the piped' data into
the perl code...


ciao
drieux

---


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




Re: regx way

2002-08-09 Thread Felix Geerinckx

on Fri, 09 Aug 2002 11:30:54 GMT, [EMAIL PROTECTED] (Jerry Preston) 
wrote:

 I am looking for a simple way to replace a date in a string:
 
%makesql(FORD,waf_end,010602 nowdate,all,0,pdv.CHEVY);\n,

 to 
%makesql(FORD,waf_end,080902 nowdate,all,0,pdv.CHEVY);\n,


Don't use ^ unless you are writing your message with a monospaced 
font. (It tends to confuse people ;-)

Try:

$string = %makesql(FORD,waf_end,010602 nowdate,all,0,pdv.CHEVY);\n
$string =~ s/010602/080902/;

-- 
felix

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




RE: regx way

2002-08-09 Thread Jerry Preston

Felix,

Thanks about ^^^.  I forget to say that I will not know what the date is,
anyone can change it.

Tanks,

Jerry

-Original Message-
From: Felix Geerinckx [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 6:55 AM
To: [EMAIL PROTECTED]
Subject: Re: regx way


on Fri, 09 Aug 2002 11:30:54 GMT, [EMAIL PROTECTED] (Jerry Preston)
wrote:

 I am looking for a simple way to replace a date in a string:

%makesql(FORD,waf_end,010602 nowdate,all,0,pdv.CHEVY);\n,

 to
%makesql(FORD,waf_end,080902 nowdate,all,0,pdv.CHEVY);\n,


Don't use ^ unless you are writing your message with a monospaced
font. (It tends to confuse people ;-)

Try:

$string = %makesql(FORD,waf_end,010602 nowdate,all,0,pdv.CHEVY);\n
$string =~ s/010602/080902/;

--
felix

--
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: NAVER-MAILER@naver.com

2002-08-09 Thread Jerry Preston

Jay,

It is in Korean!

Jerry

-Original Message-
From: Jayashankar Nelamane Srinivasarao
[mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 7:00 AM
To: 'Beginners Perl'
Subject: RE: [EMAIL PROTECTED]


Hi all

This is hapens to me also. The mail comes from this very same email id, 
but also will totally specially characters.

Regards
Jay

-Original Message-
From: Jerry Preston [mailto:[EMAIL PROTECTED]]
Sent: 09 August 2002 17:07
To: Beginners Perl
Subject: [EMAIL PROTECTED]


Hey!!

Every time I send an e-mail to Beginners I get an e-mail
[EMAIL PROTECTED], and my e-mail admin says that it contains a
viruses!!

Any ideas what is going on??

Jerry



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




RE: regx way

2002-08-09 Thread Felix Geerinckx

on Fri, 09 Aug 2002 12:35:25 GMT, [EMAIL PROTECTED] (Jerry Preston)
wrote: 

 Thanks about ^^^.  I forget to say that I will not know what the
 date is, anyone can change it.

If you don't have other 6-digit substrings in your input string, you 
can use

#! /usr/bin/perl -w
use strict;
my $string = 
   %makesql(FORD,waf_end,010602 nowdate,all,0,pdv.CHEVY;\n;
my $newdate = '080902';
$string =~ s/\d{6}/$newdate/;
print $string;

You may also want to check out 

perldoc perlretut

-- 
felix

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




splitting string

2002-08-09 Thread Javeed SAR

hi All,


I have string as given below:

M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File

From this string i need to split indivually and get   

Soarian_Context_Sensitive_Coordination_File ---   in one variable.
test
--- in one variable
train
--- in one variable
sun1
--- in one variable
M:
--- in one variable



Regards
Javeed

Regards
Javeed





RE: splitting string

2002-08-09 Thread Timothy Johnson


I think your subject answers your question:  split() the string.

E.g. @path = split(/\/,$string);

should give you the right result.

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:07 PM
To: [EMAIL PROTECTED]
Subject: splitting string


hi All,


I have string as given below:

M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File

From this string i need to split indivually and get   

Soarian_Context_Sensitive_Coordination_File ---   in one variable.
test
--- in one variable
train
--- in one variable
sun1
--- in one variable
M:
--- in one variable



Regards
Javeed

Regards
Javeed



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




RE: splitting string

2002-08-09 Thread Kipp, James


 
 I think your subject answers your question:  split() the string.
 
 E.g. @path = split(/\/,$string);
 
 should give you the right result.

yep and to take a step further:
($var1, $var2, $var3...) = split(/\/,$string);

 
 -Original Message-
 From: Javeed SAR [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 09, 2002 2:07 PM
 To: [EMAIL PROTECTED]
 Subject: splitting string
 
 
 hi All,
 
 
 I have string as given below:
 
 M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File
 
 From this string i need to split indivually and get   
   
 Soarian_Context_Sensitive_Coordination_File ---   in one 
 variable.
   test
 --- in one variable
   train
 ---   in one variable
   sun1
 ---   in one variable
   M:
 ---   in one variable
 
 
 
 
 


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




RE: splitting string

2002-08-09 Thread Timothy Johnson

Then something like this:
 
my($var1,$var2,$var3,$var4,$var5) = split(/\/,$string);
 
BTW, to avoid confusion, you should probably be referring to one variable
as one scalar, or something more specific.

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:15 PM
To: Timothy Johnson
Subject: RE: splitting string



My requirement is like this: 


Soarian_Context_Sensitive_Coordination_File ---   in one variable. 
test--- in one variable 
train---in one variable
sun1--- in one variable 
M:---   in one variable 


TIA 
Regards 
Javeed 



-Original Message- 
From: Timothy Johnson [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
Sent: Friday, August 09, 2002 6:42 PM 
To: Javeed SAR; [EMAIL PROTECTED] 
Subject: RE: splitting string 



I think your subject answers your question:  split() the string. 

E.g. @path = split(/\/,$string); 

should give you the right result. 

-Original Message- 
From: Javeed SAR [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
Sent: Friday, August 09, 2002 2:07 PM 
To: [EMAIL PROTECTED] 
Subject: splitting string 


hi All, 


I have string as given below: 

M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File 

From this string i need to split indivually and get   

Soarian_Context_Sensitive_Coordination_File ---   in one variable. 
test 
--- in one variable 
train 
--- in one variable
sun1 
--- in one variable 
M: 
--- in one variable 



Regards 
Javeed 

Regards 
Javeed 




Deep copy

2002-08-09 Thread Nikola Janceski

Hey anyone have the link handy that explained deep copying and had the
simplest little code snip to make deep copies?

Nikola Janceski

We are such stuff as dreams are made on, rounded with a little sleep.
-- William Shakespeare




The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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




RE: splitting string

2002-08-09 Thread Timothy Johnson

You should direct your questions to the list.  I will help you if I can.
You might also want to post more code.  The line you are referring to has
nothing to do with your original question.  What syntax are you using?

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:39 PM
To: Timothy Johnson
Subject: RE: splitting string


i am getting this error i am working on NT
 
syntax error at \\blrk35ed\javeed\unresco.pl
file://\\blrk35ed\javeed\unresco.pl  line 11, near $FNAME=~ s/\
Execution of \\blrk35ed\javeed\unresco.pl
file://\\blrk35ed\javeed\unresco.pl  aborted due to compilation errors.
 

Regards 
Javeed 


-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 6:56 PM
To: Javeed SAR; '[EMAIL PROTECTED]'
Subject: RE: splitting string



Then something like this:
 
my($var1,$var2,$var3,$var4,$var5) = split(/\/,$string);
 
BTW, to avoid confusion, you should probably be referring to one variable
as one scalar, or something more specific.

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:15 PM
To: Timothy Johnson
Subject: RE: splitting string



My requirement is like this: 


Soarian_Context_Sensitive_Coordination_File ---   in one variable. 
test--- in one variable 
train---in one variable
sun1--- in one variable 
M:---   in one variable 


TIA 
Regards 
Javeed 



-Original Message- 
From: Timothy Johnson [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
Sent: Friday, August 09, 2002 6:42 PM 
To: Javeed SAR; [EMAIL PROTECTED] 
Subject: RE: splitting string 



I think your subject answers your question:  split() the string. 

E.g. @path = split(/\/,$string); 

should give you the right result. 

-Original Message- 
From: Javeed SAR [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
Sent: Friday, August 09, 2002 2:07 PM 
To: [EMAIL PROTECTED] 
Subject: splitting string 


hi All, 


I have string as given below: 

M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File 

From this string i need to split indivually and get   

Soarian_Context_Sensitive_Coordination_File ---   in one variable. 
test 
--- in one variable 
train 
--- in one variable
sun1 
--- in one variable 
M: 
--- in one variable 



Regards 
Javeed 

Regards 
Javeed 




RE: Deep copy

2002-08-09 Thread NYIMI Jose (BMB)

What you mean by deep copy ?
Be more clear :-)

José.

-Original Message-
From: Nikola Janceski [mailto:[EMAIL PROTECTED]] 
Sent: Friday, August 09, 2002 3:40 PM
To: Beginners (E-mail)
Subject: Deep copy


Hey anyone have the link handy that explained deep copying and had the simplest little 
code snip to make deep copies?

Nikola Janceski

We are such stuff as dreams are made on, rounded with a little sleep.
-- William Shakespeare




The views and opinions expressed in this email message are the sender's own, and do 
not necessarily represent the views and opinions of Summit Systems Inc.


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



 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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




Dymanically use

2002-08-09 Thread RAHUL SHARMA

Hi All,

I want to use a module whose filename is into some variable.

For e.g.

use $filename;   # $filename contains the modulename that is to be imported.

I'm getting an error.

Please help.



Re: splitting string

2002-08-09 Thread Dave K

Try:

use File::Basename;
my $direx = 'E:/Perl/bin/extra/nodir/hi.txt';
my ($name, $path, $suffix, @stuff);
while (1) {
 ($name, $path, $suffix) = fileparse($direx);
 last if $name eq '.';
 print Name is $name\n;
 push @stuff, $name;
 chop($path);
 $direx = $path;
}
foreach (@stuff) {
 print\t$_\n;
}

HTH
David

Javeed Sar [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hi All,


 I have string as given below:

 M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File

 From this string i need to split indivually and get

 Soarian_Context_Sensitive_Coordination_File ---   in one variable.
 test
 --- in one variable
 train
 --- in one variable
 sun1
 --- in one variable
 M:
 --- in one variable



 Regards
 Javeed

 Regards
 Javeed






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




RE: Dymanically use

2002-08-09 Thread NYIMI Jose (BMB)

perldoc -f require

Example:

$filename=/home/me/lib/Foo.pm;
eval require $filename;

HTH,

José.

-Original Message-
From: RAHUL SHARMA [mailto:[EMAIL PROTECTED]] 
Sent: Friday, August 09, 2002 10:37 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Dymanically use


Hi All,

I want to use a module whose filename is into some variable.

For e.g.

use $filename;   # $filename contains the modulename that is to be imported.

I'm getting an error.

Please help.


 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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




RE: Deep copy

2002-08-09 Thread Nikola Janceski

http://www.stonehenge.com/merlyn/UnixReview/col30.html

Found it. Interesting read once you get into large complex data structures.

 -Original Message-
 From: Nikola Janceski [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 09, 2002 9:46 AM
 To: 'NYIMI Jose (BMB)'; Nikola Janceski; Beginners (E-mail)
 Subject: RE: Deep copy
 
 
 Deep copy.
 I have a data structure (hashes of hashes)
 I want to make a real/deep copy of the values to store elsewhere.
 So when I change the values of one, the references don't 
 point to the same
 values as the original data structure.
 hence deep copy.
 
 
  -Original Message-
  From: NYIMI Jose (BMB) [mailto:[EMAIL PROTECTED]]
  Sent: Friday, August 09, 2002 9:44 AM
  To: Nikola Janceski; Beginners (E-mail)
  Subject: RE: Deep copy
  
  
  What you mean by deep copy ?
  Be more clear :-)
  
  José.
  
  -Original Message-
  From: Nikola Janceski [mailto:[EMAIL PROTECTED]] 
  Sent: Friday, August 09, 2002 3:40 PM
  To: Beginners (E-mail)
  Subject: Deep copy
  
  
  Hey anyone have the link handy that explained deep copying 
  and had the simplest little code snip to make deep copies?
  
  Nikola Janceski
  
  We are such stuff as dreams are made on, rounded with a 
 little sleep.
  -- William Shakespeare
  
  
  --
  --
  
  The views and opinions expressed in this email message are 
  the sender's own, and do not necessarily represent the views 
  and opinions of Summit Systems Inc.
  
  
  -- 
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  
   DISCLAIMER 
  
  This e-mail and any attachment thereto may contain 
  information which is confidential and/or protected by 
  intellectual property rights and are intended for the sole 
  use of the recipient(s) named above. 
  Any use of the information contained herein (including, but 
  not limited to, total or partial reproduction, communication 
  or distribution in any form) by other persons than the 
  designated recipient(s) is prohibited. 
  If you have received this e-mail in error, please notify the 
  sender either by telephone or by e-mail and delete the 
  material from any computer.
  
  Thank you for your cooperation.
  
  For further information about Proximus mobile phone services 
  please see our website at http://www.proximus.be or refer to 
  any Proximus agent.
  
 
 --
 --
 
 The views and opinions expressed in this email message are 
 the sender's
 own, and do not necessarily represent the views and opinions of Summit
 Systems Inc.
 
 
 -- 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 



The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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




RE: splitting string

2002-08-09 Thread Timothy Johnson

 
That was my typo.  The correct statement is
 
($var1,$var2,$var3,$var4,$var5) = split(/\\/,$FNAME);
 
The backslash is uset to escape other characters, so two backslashes must be
used.
 
Again, though, please post to the list.  I am at work, and can't always
answer, and I don't even always have the best answer.

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:45 PM
To: Timothy Johnson
Subject: RE: splitting string


#!c:\perl\bin\perl 
 
$PN=$ENV{'CLEARCASE_PN'};
($FNAME, $FEXTENSION)=split(/\./,$PN);
 
 
 
#print $FEXTENSION\n;
print $FNAME\n;   # The output here is
M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File 
 
my($var1,$var2,$var3,$var4,$var5) = split(/\/,$FNAME);
 print $var5;
#$FNAME=~ s/\\//g;
if(($ENV{'CLEARCASE_RESERVED'} == 0)  ($FNAME=~
m/Soarian_Context_Sensitive_Coordination_File.xls/) | ($FNAME =~
m/comEPRHelp.ini/) | ($FNAME =~
m/CDMS_Context_Sensitive_Coordination_File.xls/) | ($FNAME =~
m/CDMS_Soarian_ToC_1.2b.xls/) | ($FNAME =~ m/CDMScomEPRHelp.ini/))
{
 
   $PROMPT=\The element ($FNAME) is not allowed to be
checkedout(unreserved).please  contact Clearcase administrator or javeed
(Extn 4919)\;
   exec (clearprompt yes_no -mask abort -default abort -pre -pro $PROMPT);
   exit 0;
}
 

 
 

Regards 
Javeed 

: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 7:12 PM
To: Javeed SAR; '[EMAIL PROTECTED]'
Subject: RE: splitting string


You should direct your questions to the list.  I will help you if I can.
You might also want to post more code.  The line you are referring to has
nothing to do with your original question.  What syntax are you using?

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:39 PM
To: Timothy Johnson
Subject: RE: splitting string


i am getting this error i am working on NT
 
syntax error at \\blrk35ed\javeed\unresco.pl
file://\\blrk35ed\javeed\unresco.pl  line 11, near $FNAME=~ s/\
Execution of \\blrk35ed\javeed\unresco.pl
file://\\blrk35ed\javeed\unresco.pl  aborted due to compilation errors.
 

Regards 
Javeed 


-
From: Timothy Johnson [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 6:56 PM
To: Javeed SAR; '[EMAIL PROTECTED]'
Subject: RE: splitting string



Then something like this:
 
my($var1,$var2,$var3,$var4,$var5) = split(/\/,$string);
 
BTW, to avoid confusion, you should probably be referring to one variable
as one scalar, or something more specific.

-Original Message-
From: Javeed SAR [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 2:15 PM
To: Timothy Johnson
Subject: RE: splitting string



My requirement is like this: 


Soarian_Context_Sensitive_Coordination_File ---   in one variable. 
test--- in one variable 
train---in one variable
sun1--- in one variable 
M:---   in one variable 


TIA 
Regards 
Javeed 



-Original Message- 
From: Timothy Johnson [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
Sent: Friday, August 09, 2002 6:42 PM 
To: Javeed SAR; [EMAIL PROTECTED] 
Subject: RE: splitting string 



I think your subject answers your question:  split() the string. 

E.g. @path = split(/\/,$string); 

should give you the right result. 

-Original Message- 
From: Javeed SAR [ mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] ] 
Sent: Friday, August 09, 2002 2:07 PM 
To: [EMAIL PROTECTED] 
Subject: splitting string 


hi All, 


I have string as given below: 

M:\sun1\train\test\Soarian_Context_Sensitive_Coordination_File 

From this string i need to split indivually and get   

Soarian_Context_Sensitive_Coordination_File ---   in one variable. 
test 
--- in one variable 
train 
--- in one variable
sun1 
--- in one variable 
M: 
--- in one variable 



Regards 
Javeed 

Regards 
Javeed 




Re: Dymanically use

2002-08-09 Thread Chas Owens

On Fri, 2002-08-09 at 04:37, RAHUL SHARMA wrote:
 Hi All,
 
 I want to use a module whose filename is into some variable.
 
 For e.g.
 
 use $filename;   # $filename contains the modulename that is to be imported.
 
 I'm getting an error.
 
 Please help.

Try something like:

code
#!/usr/bin/perl -w

use strict;

my $gtk = 'Gtk';

my $gtk_loaded = eval use $gtk; 1;

if ($gtk_loaded) {
Gtk-init;
my $window = Gtk::Window-new;
$window-signal_connect('destroy', sub { Gtk-main_quit });
$window-add(Gtk::Label-new(Hello World));
$window-show_all;
Gtk-main;
} else {
print Hello World\n;
}
/code
 
-- 
Today is Sweetmorn the 2nd day of Bureaucracy in the YOLD 3168
Wibble.

Missile Address: 33:48:3.521N  84:23:34.786W


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




Re: Dymanically use

2002-08-09 Thread drieux


On Friday, August 9, 2002, at 01:37 , RAHUL SHARMA wrote:

 Hi All,

 I want to use a module whose filename is into some variable.

 For e.g.

 use $filename;   # $filename contains the modulename that is to be 
 imported.

think about when 'use' is dealt with by perl -
it is done in the initial pass before any of
your code is actually executed.

as such I expect you are getting an error message
of the form:

File untitled text 3; Line 3:  syntax error near use $filename

something that I can generate with

#!/usr/bin/perl -w
use strict;
use $filename;
my $filename = Data::Dumper;

trying to avoid the fact that

use foo

is the equivolent of

BEGIN { require foo ;}

is NOT a good idea.

go back and re-read the

perldoc -f require
perldoc -f use

since just to get past the require gag with say

sub FunkMe {
my ($mod, $var1, $var2) = @_;
$mod =~ s/::/\//g;
$mod .= .pm;
require $mod; import $mod ;

my $d = $base-new([$var1, $var2]);

print $d-Dump;
}

still basically requires that you know apriori that $mod
will in fact have the 'method' you plan to invoke

It's a long row to hoe - but hey if you want it...

ciao
drieux

---
 #!/usr/bin/perl -w
 use strict;
 my $filename ='Data::Dumper';

 my $me = do {
 #
 # the funny pre-grot for darwin offsetting.
 #
 my $preGrot = '/Network/Servers/gax/export';
 my ($base , $lib);
 {
 base = $base = $preGrot . '/archive/solaris/patches',
 lib =  $lib = $base/lib,
 host_dir = $lib/hosts,
 xref = $lib/hosts/patchdiag.xref,
 url = {
 base = 'http://sunsolve.sun.com/pub-cgi/',
 prefix = 'patchDownload.pl?target=',
 suffix = 'method=h',
 }
 }
 }; # end Defining our world

 funk_Me($filename, $me, $filename);

 #
 #
 sub funk_Me {
 my ($mod, $var1, $var2) = @_;
 my $base=$mod;
 $mod =~ s/::/\//g;
 $mod .= .pm;
 require $mod; #import $mod ;

 my $d = $base-new([$var1, $var2]);

 print $d-Dump;

 } # end of FunkMe


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




RE: getting STDERR output...

2002-08-09 Thread Sylvanie, Jean-Pierre

Thanks to you all for your answers !

jp.


-Original Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 08, 2002 6:36 PM
To: [EMAIL PROTECTED]
Subject: Re: getting STDERR output...


Jean-Pierre Sylvanie wrote:
 
 Hi guys,

Hello,

 Actually I want to get STDERR ouput to have more details about systems
call
 errors, and write the result to a log file...
 
 I spent a couple of hours writing (well... Finding how to write ! :)
 the sample code, but I have the feeling that all that stuff is
overkill...
 Is there something more simple ?


You could probably use IPC::Open3.

my $pid = open3( \*WTRFH, \*RDRFH, \*ERRFH, $ZIP_CMD, $filename );

Do a Google groups search for open3 on comp.lang.perl.misc and you
should find some examples.



John
-- 
use Perl;
program
fulfillment

-- 
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: Dymanically use

2002-08-09 Thread chris

module for use must be a bareword. 

Try

require $filename;

On Fri, 9 Aug 2002 14:07:14 +0530, [EMAIL PROTECTED] (Rahul
Sharma) wrote:

Hi All,

I want to use a module whose filename is into some variable.

For e.g.

use $filename;   # $filename contains the modulename that is to be imported.

I'm getting an error.

Please help.


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




RE: use of uninitialised value...

2002-08-09 Thread Bob Showalter

 -Original Message-
 From: Nandita Mullapudi [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 08, 2002 3:49 PM
 To: [EMAIL PROTECTED]
 Subject: use of uninitialised value... 
 
 
 i'm trying to run a perl script written to parse a file, and 
 it runs fine
 the way it is written, however, after making little changes 
 to accomodate
 my file, i get inundated with the following message
 
 Use of uninitialized value in hash element at modif2.pl line 90
 
 can any1 tell me what this means?
 many thanks
 nandita 

The handy splain program that comes with Perl can help:

$ echo Use of uninitialized value in hash element at modif2.pl line 90 |
splain
Use of uninitialized value in hash element at modif2.pl line 90 (#1)

(W uninitialized) An undefined value was used as if it were already
defined.  It was interpreted as a  or a 0, but maybe it was a mistake.
To suppress this warning assign a defined value to your variables.

To help you figure out what was undefined, perl tells you what operation
you used the undefined value in.  Note, however, that perl optimizes
your
program and the operation displayed in the warning may not necessarily
appear literally in your program.  For example, that $foo is
usually optimized into that  . $foo, and the warning will refer to
the concatenation (.) operator, even though there is no . in your
program.

Assuming that your program correctly handles the undefined value as  or 0,
you can suppress the warning by adding:

no warnings 'uninitialized';

This declaration can be placed inside a block to limit its scope, or you can
just put it at the top of the script to suppress these warnings throughout.

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




GD::Graph logo_resize question

2002-08-09 Thread Kevin Old

Hello everyone,

I've got a quick question about using the logo_resize option in the
GD::Graph package.

My code is:

use GD::Graph::bars;
use CGI qw(:standard);

  @data = (
[1st,2nd,3rd,4th,5th,6th,7th, 8th, 9th],
[1,2,5,6,3,  1.5,1, 3, 4],
[ sort { $a = $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ]
  );

  $graph = GD::Graph::bars-new(400, 300);

  $graph-set(
  x_label   = 'X Label',
  y_label   = 'Y label',
  title = 'Some simple graph',
  y_max_value   = 8,
  y_tick_number = 8,
  y_label_skip  = 2,
  logo  =
'/home/motorola/local/apache/graphic/motorola.png',
  logo_resize   = '1.0'
  );

my $format = $graph-export_format;
print header(image/$format);
binmode STDOUT;
print $graph-plot(\@data)-$format();

Everything works fine, and the logo is it's normal size.  What I'd like
to do is make it a little smaller, but putting a negative value causes
the logo not to show.  

Here's what the documentation has to say about it:

logo_resize, logo_position
Factor to resize the logo by, and the position on the canvas of the
logo. Possible values for logo_position are 'LL', 'LR', 'UL', and 'UR'.
(lower and upper left and right). Default: 'LR'.

I'm not sure what Factor to put in the logo_resize value.

All searches on Google and several perl list archives have turned up
only the fact that I might need to use a floating point value.

Any help is appreciated,
Kevin



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




Re: printing to the top of a file

2002-08-09 Thread Janek Schleicher

Stephen Redding wrote at Fri, 09 Aug 2002 10:54:01 +0200:

 I have a text file that i want to insert two lines to the top of.
 how do i do this?

A solution where it's not necessary to think is to use the
Tie::File module.

use Tie::File;
tie my @line, 'Tie::File', 'filename.txt' or die ...;
unshift @line, $line1, $line2;


Greetings,
Janek


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




Re: Dymanically use

2002-08-09 Thread Janek Schleicher

Rahul Sharma wrote at Fri, 09 Aug 2002 10:37:14 +0200:

 I want to use a module whose filename is into some variable.
 
 For e.g.
 
 use $filename;   # $filename contains the modulename that is to be imported.

From perldoc -f use

It is exactly equivalent to

   BEGIN { require Module; import Module LIST; }

except that Module must be a bareword.



Cheerio,
Janek


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




RE: printing to the top of a file

2002-08-09 Thread NYIMI Jose (BMB)

Oh yes ! 
The magic Tie ...

Enjoy!

José.

-Original Message-
From: Janek Schleicher [mailto:[EMAIL PROTECTED]] 
Sent: Friday, August 09, 2002 5:45 PM
To: [EMAIL PROTECTED]
Subject: Re: printing to the top of a file


Stephen Redding wrote at Fri, 09 Aug 2002 10:54:01 +0200:

 I have a text file that i want to insert two lines to the top of. how 
 do i do this?

A solution where it's not necessary to think is to use the Tie::File module.

use Tie::File;
tie my @line, 'Tie::File', 'filename.txt' or die ...;
unshift @line, $line1, $line2;


Greetings,
Janek


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



 DISCLAIMER 

This e-mail and any attachment thereto may contain information which is confidential 
and/or protected by intellectual property rights and are intended for the sole use of 
the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, total or 
partial reproduction, communication or distribution in any form) by other persons than 
the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either by 
telephone or by e-mail and delete the material from any computer.

Thank you for your cooperation.

For further information about Proximus mobile phone services please see our website at 
http://www.proximus.be or refer to any Proximus agent.


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




DBD::CSV question

2002-08-09 Thread Gregg O'Donnell


Hey - I'm trying to put this together from studying the perldoc. Do I need to define 
my $table = and if so, to the csv file? Also, the number of scalars should equal the 
number of question marks?

use DBI;

my $dbh = DBI-connect(qq{DBI:CSV:csv_sep_char=\\;});
my $dbh-{'csv_tables'}-{'logger'} = { 'file' = 'logger.csv'};
my $sth = $dbh-do(INSERT INTO $table VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?), undef, 
$name_logger, $phone_logger, $email_logger, $name_landowner, $phone_landowner, 
$county, $logging_location, $logging_begin, $acres, $conf_number); 

my $sth-execute() or die Cannot execute:  . $sth-errstr();
my $sth-finish();
my $dbh-disconnect();

Many thanks,

Gregg



-
Do You Yahoo!?
HotJobs, a Yahoo! service - Search Thousands of New Jobs


Re: DBD::CSV question

2002-08-09 Thread Michael Fowler

On Fri, Aug 09, 2002 at 11:32:38AM -0700, Gregg O'Donnell wrote:
 
 Do I need to define my $table =

Um, yes.  There's nothing magical about how you're using $table, it's just
like using any other variable, which means you have to define it.  You could
also just insert logger directly into the SQL in place of $table.


 and if so, to the csv file?

No, to the table name you defined in the csv_tables structure.


 Also, the number of scalars should equal the number of question marks?

Yes.  You can read about placeholders in perldoc DBI.


 use DBI;
 
 my $dbh = DBI-connect(qq{DBI:CSV:csv_sep_char=\\;});
 my $dbh-{'csv_tables'}-{'logger'} = { 'file' = 'logger.csv'};
 my $sth = $dbh-do(INSERT INTO $table VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?), 
undef, $name_logger, $phone_logger, $email_logger, $name_landowner, $phone_landowner, 
$county, $logging_location, $logging_begin, $acres, $conf_number); 
 
 my $sth-execute() or die Cannot execute:  . $sth-errstr();
 my $sth-finish();
 my $dbh-disconnect();


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

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




Need help

2002-08-09 Thread Najamuddin, Junaid

Hi, 

Thanks in advance, if someone can help me out 
I am trying to read the last 10 lines of a log file. If the script finds a
word ERROR it should email and log the event. If not then do nothing.
Some how the other first part is working
If it finds the word ERROR  it does  what needs to be done but when it do
not find the word it doesn't do anything 
I am about to pull my hair. 

Can some one help me please

thanks
junaid





open(INFILE, $File);
$size = @lines = (INFILE);
close (INFILE);
$cnt = 0;
$tail = 10; 
foreach (@lines)
{
if (($cnt ($size - $tail)) and (/\berror\b/i))
{
print $_;
$cnt++;
print LOG xyz log has a problem\n;
email (\nxyz log has a problem on $t\n);
exit;
}

else
{
print I am doing great;
print LOG xyz is working fine\n;
print LOG No E-mail is being sent\n;
close LOG;
exit;
}

}
}   




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




RE: Need help

2002-08-09 Thread Kirby_Sarah


Mabe you could send a sample of the log file as well?


-Original Message-
From: Najamuddin, Junaid [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 09, 2002 5:23 PM
To: '[EMAIL PROTECTED]'
Subject: Need help


Hi, 

Thanks in advance, if someone can help me out 
I am trying to read the last 10 lines of a log file. If the script finds a
word ERROR it should email and log the event. If not then do nothing.
Some how the other first part is working
If it finds the word ERROR  it does  what needs to be done but when it do
not find the word it doesn't do anything 
I am about to pull my hair. 

Can some one help me please

thanks
junaid





open(INFILE, $File);
$size = @lines = (INFILE);
close (INFILE);
$cnt = 0;
$tail = 10; 
foreach (@lines)
{
if (($cnt ($size - $tail)) and (/\berror\b/i))
{
print $_;
$cnt++;
print LOG xyz log has a problem\n;
email (\nxyz log has a problem on $t\n);
exit;
}

else
{
print I am doing great;
print LOG xyz is working fine\n;
print LOG No E-mail is being sent\n;
close LOG;
exit;
}

}
}   




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




Sorting a list by...

2002-08-09 Thread Samuel Brown

Hi ya,

I'm teaching myself Perl and I have a log file around 1GB that I need to sort 
by month | date | time | byte size. So far I have parse the log for bytes 
since this is all that I need but I can't get it to sort like I want.

Here is the Data I parsed for bytes but now I need to sort by month | date | 
time | byte size.

Aug  3 04:02:02 node qmail: 1028545322.562816 info msg 401391: bytes 4138 
from #@[] qp 1367 uid 507
Aug  2 04:02:57 node qmail: 1028545377.266421 info msg 401390: bytes 614 
from [EMAIL PROTECTED] qp 1558 uid 0
Aug  1 04:02:57 node qmail: 1028545377.340607 info msg 401393: bytes 1206 
from  qp 1561 uid 507
Aug  4 04:02:57 node qmail: 1028545377.423885 info msg 401391: bytes 1701 
from #@[] qp 1564 uid 507
Aug  5 04:02:02 node qmail: 1028545322.562816 info msg 401391: bytes 4138 
from #@[] qp 1367 uid 507
Aug  9 04:02:57 node qmail: 1028545377.266421 info msg 401390: bytes 614 
from [EMAIL PROTECTED] qp 1558 uid 0
Aug  7 04:02:57 node qmail: 1028545377.340607 info msg 401393: bytes 1206 
from  qp 1561 uid 507
Aug  8 04:02:57 node qmail: 1028545377.423885 info msg 401391: bytes 1701 
from #@[] qp 1564 uid 507

CODE:

#!/usr/bin/perl

$hostname = `hostname`;
@a = localtime(time);
$today = sprintf(%04d/%02d/%02d,1900+$a[5], $a[4]+1, $a[3]);
print Date: $today\n;
#Search current log file for byte
$log = /var/log.txt;
print Byte Statistics for HOST: $hostname\n;
open (FILE,  $log)
or die Couldn't open $log!;
while ($line = FILE) {
if ($line =~ /byte/i) { print $line }
}
close (FILE);

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




Re: Sorting a list by...

2002-08-09 Thread Robin Norwood

Samuel Brown [EMAIL PROTECTED] writes:

 Hi ya,
 
 I'm teaching myself Perl and I have a log file around 1GB that I need to sort 
 by month | date | time | byte size. So far I have parse the log for bytes 
 since this is all that I need but I can't get it to sort like I want.

Well...

First, I hope I'm understanding you correctly - you have this file, in
'some order', which you need to sort by month, then by date, then
time, then bytce size.  If that's not right, please enlighten me.  If
I understand your problem, however, read on - 

I've got good news, bad news, bad news, and bad news... :-)

Good news: below is an algorithm that works for your data.

Bad news: it's not going to work for you, because it's going to curl
up and die when it tries to load a GB file into RAM, copy it, sort it,
and spit out another copy.

Bad news: some of the regular readers of this list may remember my
little rant about how important it is to write easy-to-understand,
idiomatic code.  Forget I said all that...this way is much more fun.

Bad news: with the function call in the sort loop, it's gonna be dog
slow, even with smaller sets of data.

What you probably need to do is write some custom sorting code to sort
the file (or a copy, more likely) in place, without loading the whole
thing in memory.  There aren't many machines who'll be able to load
the whole file into RAM, and even fewer which would have enough left
over to make 1 1/2 copies of the data.  The memory efficiency could
certainly be improved, but it's still likely to kill the system in
question, so another solution is needed.  Unfortunately, writing that
is much more work than I put into the following example, but perhaps
it will give you some ideas.

Code follows, comments inline:

'
#!/usr/bin/perl -w

use strict;

#always enable warnings and use strict.

my $hostname = `hostname`;
my @a = localtime(time);
my $today = sprintf(%04d/%02d/%02d,1900+$a[5], $a[4]+1, $a[3]);
print Date: $today\n;
#Search current log file for byte
my $log = /var/log.txt;
print Byte Statistics for HOST: $hostname\n;

my @data;

open (FILE,  $log)
or die Couldn't open $log!;

while (my $line = FILE) {
if ($line =~ /byte/i) { push @data, $line }
}

close (FILE);

#the above was pretty much your original script, with slight modifications

print @data;  #print it out - you probably don't want to do this yet.

my %month_map = (Jan = 0, Feb = 1, Mar = 2, Apr = 3, May = 4, Jun
= 5, Jul = 6, Aug = 7, Sep = 8, Oct = 9, Nov = 10, Dec = 11);

#a hash - $month_map{Oct} == 9, etc.

#This is where it gets fun - a Schwartzian transform, with conditional
#sorting...

my @ordered = 
  map { $_-[0] }
  sort { $month_map{$a-[1]-[0]} = $month_map{$b-[1]-[0]}
 || $a-[1]-[1] = $b-[1]-[1]
 || tm_conv($a-[1]-[2]) = tm_conv($b-[1]-[2])
 || $a-[1]-[3] = $b-[1]-[3] }
  map { [ $_, [(split /\s+/)[0,1,2,10]] ] } @data;

#explanation of the last few lines, starting from the last and moving up:

#'map { [ $_, [(split /\s+/)[0,1,2,10]] ] } @data;'
#Take @data, map it into an array of arrayrefs.
# the first element in each arrayref is the original line.
# the second element is an arrayref containing fields 0,1,2, and 10 of
# the original data, split by spaces.

#'sort { $month_map ... $b-[1]-[3] }'
#Now, we take this array, and sort it by the values contained in the
# array referred to by the second element of each 'outer' arrayref.
# First by month, using our map; then the day; then the timestamp,
# with the ':'s stripped out by the tm_conv function; and finally by
# the bytes.

#'map { $_-[0] }'
#Now that we've sorted the arrayrefs by the values in the second
#element, we take the first element (the original line), and throw the
#rest away.

#Fun!

print \n\n;
print @ordered;

#The tm_conv function just strips out the ':'s - I'm assuming the
#timestamps are in '24-hour' format.  Calling this function in the
#middle of the sort like this is absolutely terrible; it will slow
#down the sort tremendously.  I should be shot for writing this code.
sub tm_conv {
  my $tm = shift;

  $tm =~ tr/://d;

  return $tm;
}
'

-RN (Who should never be allowed near a keyboard again)

-- 

Robin Norwood
Red Hat, Inc.

The Sage does nothing, yet nothing remains undone.
-Lao Tzu, Te Tao Ching

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




How does ZOMBIE/defunct affect the system?

2002-08-09 Thread Ahmed Moustafa

If a Perl program generates ZOMBIE/defunct processes, how does that 
affect the system?

Do the following code avoid the ZOMBIE/defunct?

# code
do {
$pid = waitpid (-1, WNOHANG);
} until $pid == -1;
# /code


Your help will be appreciated so much.

-- 
Ahmed Moustafa


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