Re: checking input syntax

2002-11-05 Thread Felix Geerinckx
on Tue, 05 Nov 2002 01:10:51 GMT, [EMAIL PROTECTED] (Jose Malacara)
wrote: 

 I would like to be able to force them use the
 server[number].[location] syntax and generate a warning if they
 don't. Would it be possible to add a second argument test after
 the first? Something like: 
 
 ( $#ARGV eq server*.* ) or die usage:  $0
 server[number].[location]\n; 

$ARGV[0]  $ARGV[0] =~ /^[a-z]+\d+\.[a-z]+$/i or die usage ...;

-- 
felix

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




Re: checking input syntax

2002-11-05 Thread Jean Padilla
Hi,
try this :
#!/usr/bin/perl -w
use strict;
sub Usage() {
   die Usage: $0 server[number].[location]\n;
}
$_ = shift;
Usage unless ((defined $_)  (/^server(\d+)\.(\w+)$/));
print param is $_\n;
---
take a look at perlre.
A+


Jose Malacara a écrit :
 
 I would like to be able to verify the presence and syntax of an argument coming into 
my script prior to actually doing anything with it. My script is execpting to see 
something like this
 
 ../myscript server10.boston
 or
 ../myscript server30.california
 
 I am able to check for the presense of an argument like this:
 
 ( $#ARGV == 0 ) or die usage:  $0 server[number].[location] \n;
 
 But I am having trouble testing for proper syntax that would prevent the user trying 
to something like:
 
 ../myscript server10
 or
 ../myscript 30.california
 
 I would like to be able to force them use the server[number].[location] syntax and 
generate a warning if they don't. Would it be possible to add a second argument test 
after the first? Something like:
 
 ( $#ARGV eq server*.* ) or die usage:  $0 server[number].[location]\n;
 
 I seem to be having trouble with the wildcard* part of it. Any help would be greatly 
appreciated.
 
 Thanks in advance.
 
 -Jose

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


Understanding list creation...

2002-11-05 Thread David Buddrige
Hi all,

I am reading through a collegue's perl script.  In it he has the 
following lines:


sub SomeSubName
{
	my ($vara, $varb, $varc, @items) = @_;
	my ($itemtype, %symbol);
	...
}

The first line I understand; here you are getting the parameters to the 
subroutine (which are stored in @_), and putting them into particular 
variable names - $vara, $varb, and so on.

The second line however, I am not clear what it is doing.

It seems to be creating an in-line list, but firstly, that list is not 
assigned to anything, and secondly he is storing a hash into the list 
(presumably it must be a reference to a hash, since you cannot actually 
store a hash into a data structure such as a list or an array without 
using refernces...

Could anyone see what possible value could be had in creating the list:

	my ($itemtype, %symbol);

Is this assigned to some default name?

thanks heaps

David Buddrige.


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



Re: Understanding list creation...

2002-11-05 Thread Jean Padilla
Hi,
the second line is simply declaring two variables:
1 - the scalar $itemtype
2 - the hash %symbol
just another way to say
my $itemtype;
my %symbol;
no magic here, *NOT* a list or data structure.
A+

David Buddrige a écrit :
 
 Hi all,
 
 I am reading through a collegue's perl script.  In it he has the
 following lines:
 
 sub SomeSubName
 {
 my ($vara, $varb, $varc, @items) = @_;
 my ($itemtype, %symbol);
 ...
 }
 
 The first line I understand; here you are getting the parameters to the
 subroutine (which are stored in @_), and putting them into particular
 variable names - $vara, $varb, and so on.
 
 The second line however, I am not clear what it is doing.
 
 It seems to be creating an in-line list, but firstly, that list is not
 assigned to anything, and secondly he is storing a hash into the list
 (presumably it must be a reference to a hash, since you cannot actually
 store a hash into a data structure such as a list or an array without
 using refernces...
 
 Could anyone see what possible value could be had in creating the list:
 
 my ($itemtype, %symbol);
 
 Is this assigned to some default name?
 
 thanks heaps
 
 David Buddrige.
 
 --
 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: Understanding list creation...

2002-11-05 Thread David Buddrige
beaut!  thanks.

David.  8-)

Jean Padilla wrote:


Hi,
the second line is simply declaring two variables:
1 - the scalar $itemtype
2 - the hash %symbol
just another way to say
my $itemtype;
my %symbol;
no magic here, *NOT* a list or data structure.
A+

David Buddrige a écrit :


Hi all,

I am reading through a collegue's perl script.  In it he has the
following lines:

sub SomeSubName
{
   my ($vara, $varb, $varc, @items) = @_;
   my ($itemtype, %symbol);
   ...
}

The first line I understand; here you are getting the parameters to the
subroutine (which are stored in @_), and putting them into particular
variable names - $vara, $varb, and so on.

The second line however, I am not clear what it is doing.

It seems to be creating an in-line list, but firstly, that list is not
assigned to anything, and secondly he is storing a hash into the list
(presumably it must be a reference to a hash, since you cannot actually
store a hash into a data structure such as a list or an array without
using refernces...

Could anyone see what possible value could be had in creating the list:

   my ($itemtype, %symbol);

Is this assigned to some default name?

thanks heaps

David Buddrige.

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


rg







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




Changing @INC

2002-11-05 Thread todd shifflett
I just re-installed perl 5.8.0 on my mac.  When I did the new version 
was placed into /opt/bin where I do not want it so I moved all the 
files and man pages to where they should be.  Now How do I change the 
@INC array?

I would also like to know how to change the other information listed 
with 'perl -V'


-todd


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



Re: Changing @INC

2002-11-05 Thread Paul Johnson

todd shifflett said:
 I just re-installed perl 5.8.0 on my mac.  When I did the new version
 was placed into /opt/bin where I do not want it so I moved all the
 files and man pages to where they should be.  Now How do I change the
 @INC array?

You don't.  Your options are:

  - recompile perl
  - mess with PERL5LIB
  - put in symlinks
  - add use lib all over the place
  - binary edit your perl executable (careful!)
  - maybe something macperl specific - I don't know

The first is probably the best choice if it's possible.

 I would also like to know how to change the other information listed
 with 'perl -V'

Change the options to Configure when you recompile.

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




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




Re: changing case

2002-11-05 Thread dan
this *should* work:.

__ START __
my $path = qq~/home/phisher/documents~; # set this to your path
opendir(DIR,$path) or die(can't readdir $path: $!); # open the entire
directory for getting the contents of
while (my $file = readdir DIR) { # $file gets assigned the next value of
DIR, and exits when there's no more files
my ($fname,$ext) = split(/\./,$file); # removes extension
next if $file eq '.' or $file eq '..' or $ext ne 'html'; # goes to next
look if $file is . (current dir) or .. (parent dir)
$lcfile = lc($file);
print renaming $file to $lcfile\n;
system(qq~mv $path/$file $path/$lcfile~); # rename
}
closedir DIR; # close directory
__ END __

i changed the rename line to a system call, using move (mv). works fine
for me, and it renames the files. the print statement is just there to
tell you which one it's doing. if you want it to work silently, just take
that line out.


dan

Dan [EMAIL PROTECTED] wrote in message
news:20021104183421.83888.qmail;onion.perl.org...
 try this..

 __ START __
 my $path = qq~$HOME/documents~; # set this to your path
 opendir(DIR,$path) or diesub(can't readdir $path: $!); # open the entire
 directory for getting the contents of
 while (my $file = readdir DIR) { # $file gets assigned the next value of
 DIR, and exits when there's no more files
 my ($fname,$ext) = split(/\./,$file); # removes extension
 next if $file eq '.' or $file eq '..' or $ext ne 'html'; # goes to
next
 look if $file is . (current dir) or .. (parent dir)
 rename $file, lc($file); # rename
 }
 closedir DIR; # close directory
 __ END __

 dan

 P.S: This is untested.. test/alter/correct/test as need be.

 Desmond Coughlan [EMAIL PROTECTED] wrote in message
 news:20021103180226.GE15981;lievre.voute.net...

 Hi,
 I'm trying to figure out how I can change the filenames in a directory,
from
 having an initial capital letter, to all lowercase.  The files came from
 a Windows system, which doesn't really care about case.  My BSD box,
 however,
 does !

 I've tried fiddling around with tr and lc, but I don't know perl enough
 to get it to work.  FYI, the directory is called $HOME/documents, and
 the files are called 'Indexpage.html', or 'Reportback.html' and so on ...

 Thanks in advance.

 D.

 --
 Desmond Coughlan
 [EMAIL PROTECTED]
 http://www.zeouane.org






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




Files at different location

2002-11-05 Thread Ankit Gupta
Hi,

 I have written script that makes lot of files but the problem is that my
script stores all the files at the location from where the script is run. I
have tried usingt chdir(c:\abc) in order to store all the files in abc
directory but its of no use and still it stores files in the directory from
where the script is run.

Could someone throw some light as how I can use some statement before making
files so that all of them are stored in one directory of my choice.

Regards,
Ankit



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




comparing two hashes with different set of keys

2002-11-05 Thread naveen prabhakar

Hi

I have two hashes with different set of keys,but I woul like to sort the two hashes by 
keys and compare their elements.could anyone tell me how to do this.

I am trying to compare 'raimah' a hash with 'db2hash' 

I am trying to compare the first sorted element of raimah hash with the first sorted 
element of db2hash and so on.

thank you.naveen


sub temp{

my ($db2hash,$raimah)=_;

my $id;

my %db2hash1 = %{$db2hash};

for my $ord_id ( keys %db2hash1 ){
 print ord_id :$ord_id \n;
 my temp = keys  %{$db2hash1{$ord_id}} ;
 my $count =temp ;
 
 print the size of temp is $count\n;
 
 for my $trn_id ( sort keys %{$db2hash1{$ord_id}} ){
 
 print trn_id : $db2hash1{$ord_id}{$trn_id}\n;
 print $trn_id\n;

 }

}

}



-
Do you Yahoo!?
HotJobs - Search new jobs daily now


Re: Files at different location

2002-11-05 Thread dan
__ START __
my $path = qq~C:\path\where\to\put\stuff~;
open (WHATEVER,qq~$path\filename.ext~) or die (qq~Can't open
$path\filename.ext for writing : $!~);
etc..
close(WHATEVER);
__ END __
Note: untested, but i doubt anything can go wrong.

give that a go.

dan

Ankit Gupta [EMAIL PROTECTED] wrote in message
news:20021105140731.2786.qmail;onion.perl.org...
 Hi,

  I have written script that makes lot of files but the problem is that my
 script stores all the files at the location from where the script is run.
I
 have tried usingt chdir(c:\abc) in order to store all the files in abc
 directory but its of no use and still it stores files in the directory
from
 where the script is run.

 Could someone throw some light as how I can use some statement before
making
 files so that all of them are stored in one directory of my choice.

 Regards,
 Ankit





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




Re: Changing @INC (libgd and the GD module)

2002-11-05 Thread todd shifflett
Thank you.  I decided to recompile perl, which seemed to work well.
The big problem I am having is getting the GD.pm module to work because 
it
needs shared libraries which I am having trouble installing.

Have you had any luck installing libgd, zlib or the GD perl module?
I guess if you're using something other than OSX your situation would 
be different.

p.s.

I am running the standard unix version of perl, not macperl.

todd shifflett said:

I just re-installed perl 5.8.0 on my mac.  When I did the new version
was placed into /opt/bin where I do not want it so I moved all the
files and man pages to where they should be.  Now How do I change the
@INC array?


You don't.  Your options are:

  - recompile perl
  - mess with PERL5LIB
  - put in symlinks
  - add use lib all over the place
  - binary edit your perl executable (careful!)
  - maybe something macperl specific - I don't know

The first is probably the best choice if it's possible.


I would also like to know how to change the other information listed
with 'perl -V'


Change the options to Configure when you recompile.

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







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




Re: Files at different location

2002-11-05 Thread Paul Johnson

dan said:
 __ START __
 my $path = qq~C:\path\where\to\put\stuff~;
 open (WHATEVER,qq~$path\filename.ext~) or die (qq~Can't open
 $path\filename.ext for writing : $!~);
 etc..
 close(WHATEVER);
 __ END __
 Note: untested, but i doubt anything can go wrong.

Might I suggest testing next time ;-)

 Ankit Gupta [EMAIL PROTECTED] wrote in message
 news:20021105140731.2786.qmail;onion.perl.org...
 Hi,

  I have written script that makes lot of files but the problem is that
 my
 script stores all the files at the location from where the script is
 run.
 I
 have tried usingt chdir(c:\abc) in order to store all the files in
 abc directory but its of no use and still it stores files in the
 directory
 from
 where the script is run.

Did you check whether the chdir succeeded?

Hint:  \a rings the bell.

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




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




Trouble installing GD.pm

2002-11-05 Thread todd shifflett
Using: Mac OSX 10.2
   libgd 2.0.4

Can anyone help me make something of this?
when I try and install GD.pm I get the following errors:


cc -c  -I/sw/include -I/usr/local/include/gd -I/usr/lib 
-I/System/Library/Perl -pipe -fno-common -no-cpp-precomp 
-fno-strict-aliasing -O3   -DVERSION=\2.041\ -DXS_VERSION=\2.041\  
-I/System/Library/Perl/darwin/CORE  -DHAVE_JPEG -DHAVE_FT -DHAVE_XPM 
GD.c
GD.xs: In function `newDynamicCtx':
GD.xs:345: structure has no member named `gd_free'
GD.xs: In function `gd_cloneDim':
GD.xs:365: structure has no member named `alpha'
GD.xs:365: structure has no member named `alpha'
GD.xs:371: structure has no member named `thick'
GD.xs:371: structure has no member named `thick'
GD.xs: In function `XS_GD__Image_newFromPngData':
GD.xs:499: structure has no member named `gd_free'
GD.xs: In function `XS_GD__Image_newFromGdData':
GD.xs:518: structure has no member named `gd_free'
GD.xs: In function `XS_GD__Image_newFromGd2Data':
GD.xs:535: structure has no member named `gd_free'
GD.xs: In function `XS_GD__Image_newFromJpegData':
GD.xs:555: structure has no member named `gd_free'
GD.xs: In function `XS_GD__Image_newFromWBMPData':
GD.xs:580: structure has no member named `gd_free'
GD.xs: In function `XS_GD__Image_copyRotate90':
GD.xs:933: invalid lvalue in assignment
GD.xs:933: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_copyRotate180':
GD.xs:954: invalid lvalue in assignment
GD.xs:954: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_copyRotate270':
GD.xs:975: invalid lvalue in assignment
GD.xs:975: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_copyFlipHorizontal':
GD.xs:996: invalid lvalue in assignment
GD.xs:996: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_copyFlipVertical':
GD.xs:1017: invalid lvalue in assignment
GD.xs:1017: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_copyTranspose':
GD.xs:1038: invalid lvalue in assignment
GD.xs:1038: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_copyReverseTranspose':
GD.xs:1059: invalid lvalue in assignment
GD.xs:1059: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_rotate180':
GD.xs:1079: invalid lvalue in assignment
GD.xs:1079: invalid lvalue in assignment
GD.xs:1080: invalid lvalue in assignment
GD.xs:1080: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_flipHorizontal':
GD.xs:1097: invalid lvalue in assignment
GD.xs:1097: invalid lvalue in assignment
GD.xs:1098: invalid lvalue in assignment
GD.xs:1098: invalid lvalue in assignment
GD.xs: In function `XS_GD__Image_flipVertical':
GD.xs:1115: invalid lvalue in assignment
GD.xs:1115: invalid lvalue in assignment
GD.xs:1116: invalid lvalue in assignment
GD.xs:1116: invalid lvalue in assignment
make: *** [GD.o] Error 1


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



Re: Changing @INC (libgd and the GD module)

2002-11-05 Thread Chris Garaffa
On Tuesday, November 5, 2002, at 10:23 AM, todd shifflett wrote:

Thank you.  I decided to recompile perl, which seemed to work well.
The big problem I am having is getting the GD.pm module to work 
because it
needs shared libraries which I am having trouble installing.

Have you had any luck installing libgd, zlib or the GD perl module?
I guess if you're using something other than OSX your situation would 
be different.

Todd,

I'm on Mac OS X here as well. It used to be that compiling anything but 
the most simple UNIX programs was a headache. With 10.2, it's gotten 
better.
In addition, there's fink (http://fink.sf.net). It's a command line 
utility installs UNIX software that has been ported to OS X. In fact, 
just to see if it works, I'm installing GD right now, through fink. The 
command, if you're interested, is:
% fink install gd-pm

which will then ask you to confirm that gd-pm, gd2 and gd2-shlibs will 
be installed. Do this.

Interestingly enough, I think most of the fink program itself is 
written in perl.
Installing gd-pm is done. It took  5 minutes on a G3/500mHz iBook.
So it can be done :)


p.s.

I am running the standard unix version of perl, not macperl.

Amazing that there are still many people who simply don't get that.




todd shifflett said:

I just re-installed perl 5.8.0 on my mac.  When I did the new version
was placed into /opt/bin where I do not want it so I moved all the
files and man pages to where they should be.  Now How do I change the
@INC array?


You don't.  Your options are:

  - recompile perl
  - mess with PERL5LIB
  - put in symlinks
  - add use lib all over the place
  - binary edit your perl executable (careful!)
  - maybe something macperl specific - I don't know

The first is probably the best choice if it's possible.


I would also like to know how to change the other information listed
with 'perl -V'


Change the options to Configure when you recompile.

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







--
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: Mail::Sendmail Module

2002-11-05 Thread Scott, Joshua
How exactly could I accomplish combining the values?  Forgive me, I'm still
a little wet behind the ears using Perl.

Joshua Scott
Security Systems Analyst, CISSP
626-568-7024


-Original Message-
From: LRMK [mailto:lrmk;rakhitha.cjb.net] 
Sent: Tuesday, November 05, 2002 9:18 AM
To: Scott, Joshua
Cc: [EMAIL PROTECTED]
Subject: Re: Mail::Sendmail Module


combine all the lines using \n characters and store it in the hash variable



- Original Message -
From: Scott, Joshua [EMAIL PROTECTED]
To: Beginners Perl [EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 11:01 PM
Subject: Mail::Sendmail Module


 Hello everyone,

 I'm trying to use the Mail::Sendmail module in a script where I need a 
 independent mailer.  The problem I'm having is including more than one
line
 of text in the message body.  I'm not really sure how to do this.  The 
 package uses a $mail{message} = blah var for the message body.  Is 
 it possible to get more than one line into that hash value?

 Basically I've got a script that generates a bunch of information and 
 outputs it to a file.  What I would like to do is make the contents of
this
 file, the body of my message.  I don't want it as an attachment.

 Any help is greatly appreciated.

 Thank you,

 Joshua Scott
 Security Systems Analyst, CISSP
 626-568-7024



==
 NOTICE - This communication may contain confidential and privileged
information that is for the sole use of the intended recipient. Any viewing,
copying or distribution of, or reliance on this message by unintended
recipients is strictly prohibited. If you have received this message in
error, please notify us immediately by replying to the message and deleting
it from your computer.



==


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




==
NOTICE - This communication may contain confidential and privileged information that 
is for the sole use of the intended recipient. Any viewing, copying or distribution 
of, or reliance on this message by unintended recipients is strictly prohibited. If 
you have received this message in error, please notify us immediately by replying to 
the message and deleting it from your computer.

==


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




Re: Files at different location

2002-11-05 Thread dan
well i could spend ample amount of time testing code for someone else. like
everyone else here, i'm only offering suggestions on how a problem can be
overcome. seriously, if someone is trying to create a perl script, they'll
have at least some knowledge in perl on how to fix errors if something isn't
right. if the code i submitted doesn't work, then my bad. but the recipient
of the code can insert it into their code, and if it doesn't work, perl will
spew errors on what's wrong, and where, so they can fix it.

dan

Paul Johnson [EMAIL PROTECTED] wrote in message
news:60995.193.134.254.145.1036512487.squirrel;wesley.pjcj.net...

 dan said:
  __ START __
  my $path = qq~C:\path\where\to\put\stuff~;
  open (WHATEVER,qq~$path\filename.ext~) or die (qq~Can't open
  $path\filename.ext for writing : $!~);
  etc..
  close(WHATEVER);
  __ END __
  Note: untested, but i doubt anything can go wrong.

 Might I suggest testing next time ;-)

  Ankit Gupta [EMAIL PROTECTED] wrote in message
  news:20021105140731.2786.qmail;onion.perl.org...
  Hi,
 
   I have written script that makes lot of files but the problem is that
  my
  script stores all the files at the location from where the script is
  run.
  I
  have tried usingt chdir(c:\abc) in order to store all the files in
  abc directory but its of no use and still it stores files in the
  directory
  from
  where the script is run.

 Did you check whether the chdir succeeded?

 Hint:  \a rings the bell.

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






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




Re: Understanding list creation...

2002-11-05 Thread LRMK
@_ holds the values of parameters passed to the sub when it is called from
the code
 when it is used like that in subs

It has different meanings in different places
it is called default input variable


- Original Message -
From: David Buddrige [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 2:53 PM
Subject: Understanding list creation...


 Hi all,

 I am reading through a collegue's perl script.  In it he has the
 following lines:


 sub SomeSubName
 {
 my ($vara, $varb, $varc, @items) = @_;
 my ($itemtype, %symbol);
 ...
 }

 The first line I understand; here you are getting the parameters to the
 subroutine (which are stored in @_), and putting them into particular
 variable names - $vara, $varb, and so on.

 The second line however, I am not clear what it is doing.

 It seems to be creating an in-line list, but firstly, that list is not
 assigned to anything, and secondly he is storing a hash into the list
 (presumably it must be a reference to a hash, since you cannot actually
 store a hash into a data structure such as a list or an array without
 using refernces...

 Could anyone see what possible value could be had in creating the list:

 my ($itemtype, %symbol);

 Is this assigned to some default name?

 thanks heaps

 David Buddrige.


 --
 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: Mail::Sendmail Module

2002-11-05 Thread Gary Stainburn
On Tuesday 05 Nov 2002 5:01 pm, Scott, Joshua wrote:
 Hello everyone,

 I'm trying to use the Mail::Sendmail module in a script where I need a
 independent mailer.  The problem I'm having is including more than one line
 of text in the message body.  I'm not really sure how to do this.  The
 package uses a $mail{message} = blah var for the message body.  Is it
 possible to get more than one line into that hash value?

 Basically I've got a script that generates a bunch of information and
 outputs it to a file.  What I would like to do is make the contents of this
 file, the body of my message.  I don't want it as an attachment.

 Any help is greatly appreciated.

Hi Joshua,

If you simply wanted to create a multi-line message body as a string then you 
could do something like:

$mail{message}=line1\nline2\nline3\n;
or 
$mail{message}=qq{line1
line2
line3
};

If you want to use the contents of a file as the body, use something like.

$oldsep=$/; $/=undef; disable line seperation
open(FIN,myfile)||die cannot open file: $!\n;
$mail{message}=FIN;
close(FIN);
$/=$oldsep;

It disables the record seperator (newline) then reads the whole file into the 
hash entry.


 Thank you,

 Joshua Scott
 Security Systems Analyst, CISSP
 626-568-7024

 ===
=== NOTICE - This communication may contain confidential and
 privileged information that is for the sole use of the intended recipient.
 Any viewing, copying or distribution of, or reliance on this message by
 unintended recipients is strictly prohibited. If you have received this
 message in error, please notify us immediately by replying to the message
 and deleting it from your computer.

 ===
===

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


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




Re: Mail::Sendmail Module

2002-11-05 Thread LRMK
there is a   one problem
$mail{message}=FIN; only reads the first line of the file
in the following block;

 $oldsep=$/; $/=undef; disable line seperation
 open(FIN,myfile)||die cannot open file: $!\n;
 $mail{message}=FIN;
 close(FIN);
 $/=$oldsep;





try this instedof that line

@file = FIN;
chomp @file;
$mail{message}=join(\n,@file);



- Original Message -
From: Gary Stainburn [EMAIL PROTECTED]
To: Scott, Joshua [EMAIL PROTECTED]; Beginners Perl
[EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 11:15 PM
Subject: Re: Mail::Sendmail Module


 On Tuesday 05 Nov 2002 5:01 pm, Scott, Joshua wrote:
  Hello everyone,
 
  I'm trying to use the Mail::Sendmail module in a script where I need a
  independent mailer.  The problem I'm having is including more than one
line
  of text in the message body.  I'm not really sure how to do this.  The
  package uses a $mail{message} = blah var for the message body.  Is it
  possible to get more than one line into that hash value?
 
  Basically I've got a script that generates a bunch of information and
  outputs it to a file.  What I would like to do is make the contents of
this
  file, the body of my message.  I don't want it as an attachment.
 
  Any help is greatly appreciated.

 Hi Joshua,

 If you simply wanted to create a multi-line message body as a string then
you
 could do something like:

 $mail{message}=line1\nline2\nline3\n;
 or
 $mail{message}=qq{line1
 line2
 line3
 };

 If you want to use the contents of a file as the body, use something like.

 $oldsep=$/; $/=undef; disable line seperation
 open(FIN,myfile)||die cannot open file: $!\n;
 $mail{message}=FIN;
 close(FIN);
 $/=$oldsep;

 It disables the record seperator (newline) then reads the whole file into
the
 hash entry.

 
  Thank you,
 
  Joshua Scott
  Security Systems Analyst, CISSP
  626-568-7024
 
 
===
 === NOTICE - This communication may contain confidential and
  privileged information that is for the sole use of the intended
recipient.
  Any viewing, copying or distribution of, or reliance on this message by
  unintended recipients is strictly prohibited. If you have received this
  message in error, please notify us immediately by replying to the
message
  and deleting it from your computer.
 
 
===
 ===

 --
 Gary Stainburn

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


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




Help on -w

2002-11-05 Thread LRMK
#!/usr/bin/perl -w


my $a;

if ($a eq 'fff'){



}
above  line gives the error Use of uninitialized value in string eq at t.pl line 6.

but when -w not used in top line it works perfect
what the -w really does



best text/best perl version for beginning perl?

2002-11-05 Thread Sharon M. Tuttle

I have two related questions; for the first time, I have the opportunity
to teach a 1-unit 5-week course on Perl in the Spring 2003 semester.

1. I'm curious if anyone has any opinions for their favorite
beginning-Perl textbook?

I really like Learning Perl, 2nd Edition, by Schwartz and
Christiansen, but I have had it several years and I wonder
if it is out of date with regard to what is being commonly
used now (in terms of Perl versions).

2. What version of Perl should I be teaching? My Perl knowledge
is several years old, and now I am hearing about Perl 6... but
is it released yet or not? 8-)

I hope these questions are not too foolish --- any opinions would
be appreciated.

Thank you,

-- Sharon Tuttle
   Dept. of Computing Science
   Humboldt State University




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




RE: Mail::Sendmail Module

2002-11-05 Thread Kipp, James
 
 Hello everyone,
 
 I'm trying to use the Mail::Sendmail module in a script where I need a
 independent mailer.  The problem I'm having is including more 
 than one line
 of text in the message body.  I'm not really sure how to do this.  The
 package uses a $mail{message} = blah var for the message 
 body.  Is it
 possible to get more than one line into that hash value?

$mail{message} =  this is a line\nthis is another\n

 
 Basically I've got a script that generates a bunch of information and
 outputs it to a file.  What I would like to do is make the 
 contents of this
 file, the body of my message.  I don't want it as an attachment.

how about:
my $body = `cat $yourfile`;

 


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




RE: best text/best perl version for beginning perl?

2002-11-05 Thread Kipp, James
 I have two related questions; for the first time, I have the 
 opportunity
 to teach a 1-unit 5-week course on Perl in the Spring 2003 semester.
 
 1. I'm curious if anyone has any opinions for their favorite
 beginning-Perl textbook?
 
 I really like Learning Perl, 2nd Edition, by Schwartz and
 Christiansen, but I have had it several years and I wonder
 if it is out of date with regard to what is being commonly
 used now (in terms of Perl versions).

Nothing wrong with that book at all. use the 3rd edition.

 
 2. What version of Perl should I be teaching? My Perl knowledge
 is several years old, and now I am hearing about Perl 6... but
 is it released yet or not? 8-)

no. use 5.6.1 or 5.8

 
 I hope these questions are not too foolish -

of course not.




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




Re: best text/best perl version for beginning perl?

2002-11-05 Thread Geoffrey F. Green
On 11/5/02 12:47 PM, Sharon M. Tuttle [EMAIL PROTECTED] wrote:

 I have two related questions; for the first time, I have the opportunity
 to teach a 1-unit 5-week course on Perl in the Spring 2003 semester.
 
 1. I'm curious if anyone has any opinions for their favorite
 beginning-Perl textbook?
 
 I really like Learning Perl, 2nd Edition, by Schwartz and
 Christiansen, but I have had it several years and I wonder
 if it is out of date with regard to what is being commonly
 used now (in terms of Perl versions).

I learned Perl from the 3d edition, and I found it to be an excellent book.
Very straightforward and clearly written, with enough jokes and humorous
asides so that you stay interested but not so many that they wear you out.

I did have some programming background, though, so I can't vouch for how
well absolute compsci novices would fare with it.

 - geoff


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




RE: Help on -w

2002-11-05 Thread Mark Anderson
The '-w' helps you debug your code by producing warnings.  The code may
work, but $a has not been initialized when it reaches the if statement, so
it will always fail.  Is that really 'perfect'?  Why have the if block if
you know it will never be executed?  The easy, although prone to overuse,
solution is do initialize $a with a value when you declare it with the my
statement.

/\/\ark

-Original Message-
From: LRMK [mailto:lrmk;rakhitha.cjb.net]
Sent: Tuesday, November 05, 2002 9:51 AM
To: [EMAIL PROTECTED]
Subject: Help on -w


#!/usr/bin/perl -w


my $a;

if ($a eq 'fff'){



}
above  line gives the error Use of uninitialized value in string eq at t.pl
line 6.

but when -w not used in top line it works perfect
what the -w really does


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




Re: Files at different location

2002-11-05 Thread LRMK
use this


open (FILE _HANDDLE,'c:\abc\abc.abc');






- Original Message -
From: Ankit Gupta [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 5:07 AM
Subject: Files at different location


 Hi,

  I have written script that makes lot of files but the problem is that my
 script stores all the files at the location from where the script is run.
I
 have tried usingt chdir(c:\abc) in order to store all the files in abc
 directory but its of no use and still it stores files in the directory
from
 where the script is run.

 Could someone throw some light as how I can use some statement before
making
 files so that all of them are stored in one directory of my choice.

 Regards,
 Ankit



 --
 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: Help on -w

2002-11-05 Thread Robert Citek

Hello LRMK,

At 11:51 PM 11/5/2002 +0600, LRMK wrote:
#!/usr/bin/perl -w
my $a;
if ($a eq 'fff'){
}
above  line gives the error Use of uninitialized value in string eq 
at t.pl line 6.

but when -w not used in top line it works perfect
what the -w really does

You've created $a but not set it to any value.  From 'perldoc perlrun':

   -w   prints warnings about dubious constructs, such as
variable names that are mentioned only once and
scalar variables that are used before being set,
redefined subroutines, references to undefined ...

try changing 
  my $a;
to 
  my $a=;

Regards,
- Robert



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




Re: best text/best perl version for beginning perl?

2002-11-05 Thread Bob Rasey
On Tue, 2002-11-05 at 12:47, Sharon M. Tuttle wrote:

 1. I'm curious if anyone has any opinions for their favorite
 beginning-Perl textbook?
 
 I really like Learning Perl, 2nd Edition

I am not a programmer at all, I came at Perl from the sysadmin side. 
Learning Perl 3 was an incredible resource, and I use Perl on a daily
basis, for everything from building a central logging facility for NT
event logs, to parsing quake log files to taking out my trash for me.

I can't say I know any other beginning texts, but I sure can vouch for
the Llama!

Bob Rasey


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




Re: Understanding list creation...

2002-11-05 Thread John W. Krahn
David Buddrige wrote:
 
 Hi all,

Hello,

 I am reading through a collegue's perl script.  In it he has the
 following lines:
 
 sub SomeSubName
 {
 my ($vara, $varb, $varc, @items) = @_;
 my ($itemtype, %symbol);
 ...
 }
 
 The first line I understand; here you are getting the parameters to the
 subroutine (which are stored in @_), and putting them into particular
 variable names - $vara, $varb, and so on.
 
 The second line however, I am not clear what it is doing.
 
 It seems to be creating an in-line list, but firstly, that list is not
 assigned to anything, and secondly he is storing a hash into the list
 (presumably it must be a reference to a hash, since you cannot actually
 store a hash into a data structure such as a list or an array without
 using refernces...
 
 Could anyone see what possible value could be had in creating the list:
 
 my ($itemtype, %symbol);
 
 Is this assigned to some default name?


perldoc -f my

   my EXPR

   my EXPR : ATTRIBUTES
   A `my' declares the listed variables to be local
   (lexically) to the enclosing block, file, or
   `eval'.  If more than one value is listed, the
^
   list must be placed in parentheses.  See the
   ^^^
   Private Variables via my() entry in the perlsub
   manpage for details.



That code could also be written as:

sub SomeSubName
{
my ($vara, $varb, $varc, @items, $itemtype, %symbol) = @_;


:-)

John
-- 
use Perl;
program
fulfillment

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




perl modules for NT

2002-11-05 Thread Johnson, Shaunn

--Howdy:

--I've installed  ActiveState 2.1.6 on Windows NT serv. pak 6.
--I'd like to install a few modules with the ppm too, but
--it doesn't seem to be working.  As I understand it, all I
--should have to do is :

[snip]


ppminstall DBI


pmminstall DBD-Oracle

[/snip]

--my error is this:

[snip error]


D:\PERL\BINping ppm.ActiveState.com

Pinging www.ActiveState.com [199.60.48.91] with 32 bytes of data:

Reply from 199.60.48.91: bytes=32 time=109ms TTL=231
Reply from 199.60.48.91: bytes=32 time=93ms TTL=231
Reply from 199.60.48.91: bytes=32 time=94ms TTL=231
Reply from 199.60.48.91: bytes=32 time=94ms TTL=231

D:\PERL\BINppm
PPM interactive shell (2.1.6) - type 'help' for available commands.
PPM install dbi
Install package 'dbi?' (y/N): y
Installing package 'dbi'...
Error installing package 'dbi': Could not locate a PPD file for package dbi
PPM version
2.1.6
PPM

[/snip error]

--I'm thinking that the problem is that I can't get to
--the ActiveState site due to the proxy configuration
--of the company (although I can ping the site).

--My question is: Where,exactly, can I download the perl 
--modules for ActiveState (perhaps even use the ppm 
--install method). I'm at the site and I'm looking under 
--modules, but all I see are docs and info pages about
--the modules.

--Also, do I need to have a compiler to install these?  I did
--a search on groups.google.com and someone mentioned that
--I should have one.

--Thanks!

-X



RE: perl modules for NT

2002-11-05 Thread Kipp, James
 
 D:\PERL\BINppm
 PPM interactive shell (2.1.6) - type 'help' for available commands.
 PPM install dbi
 Install package 'dbi?' (y/N): y
 Installing package 'dbi'...
 Error installing package 'dbi': Could not locate a PPD file 
 for package dbi
 PPM version
 2.1.6
 PPM
 
 [/snip error]

Hi, try this:
1. Choose the package you want to install from:
http://www.activestate.com/PPMPackages/zips/6xx-builds-only/  (
2. unzip the files into a temp directory
3. After the package files are extracted, open a command prompt and cd to
the directory where the package files exist. eg. c:\temp
4. At the command prompt just type : ppm install package_name.ppd  
So for DBI you would type: ppm install dbi.ppd
Say yes to the prompt and it will be done.
5. To verify the installation type: ppm query
This will give you a  list of the packages installed, you should see the DBI
package in the list.

 


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




line feeds in perl scripts

2002-11-05 Thread sean finnigan

What is the best way to replace line feeds in perl scripts that I copy from my PC to 
my Unix machine?  They don't run on the Unix side unless I open an editor and 
find/replace the line feeds/carriage returns.

 

function SetDomain(d) { document.domain = d; }



-
Do you Yahoo!?
HotJobs - Search new jobs daily now


RE: line feeds in perl scripts

2002-11-05 Thread Kipp, James
 
 What is the best way to replace line feeds in perl scripts 
 that I copy from my PC to my Unix machine?  They don't run on 
 the Unix side unless I open an editor and find/replace the 
 line feeds/carriage returns.
 

tr -d '\015'  file newfile


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




Re: perl modules for NT

2002-11-05 Thread Jenda Krynicky
From: Johnson, Shaunn [EMAIL PROTECTED]
 --I've installed  ActiveState 2.1.6 on Windows NT serv. pak 6.

No you did not.
You installed ActiveState ActivePerl 6xx which is Perl version 5.6.1 
+ some patches.

If you want to know the exact version run
perl -v

Only the PPM installed with it is version 2.1.6.

 --I'm thinking that the problem is that I can't get to
 --the ActiveState site due to the proxy configuration
 --of the company (although I can ping the site).

That's possible.
If you go to the Start Menu\Programs\ActiveState ActivePerl, click 
the Perl documentation and go to ActivePerl FAQ\PPM you should 
get some info about this.
 
 --Also, do I need to have a compiler to install these?  I did
 --a search on groups.google.com and someone mentioned that
 --I should have one.

No. You don't need a compiler if you use PPM.
That is the reason of it's existence. Only if you try to install some 
module directly from CPAN do you need a C compiler.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Thread::Queue (Invalid value for shared scalar)

2002-11-05 Thread Jeremy Vinding
does anyone know why I can't enqueue an array ref?
the error is this:
Invalid value for shared scalar at /usr/lib/perl5/5.8.0/Thread/Queue.pm
line 90.

TIA,
jjv

__CODE__

#!/usr/bin/perl
use 5.008;
use warnings;
use strict;

use threads;
use Thread::Queue;

my $q = Thread::Queue-new ();
$q-enqueue (['bob', 'joe', 'jon']);
## hmmm... well threads::shared de-refs refs one level lets try this:
## $q-enqueue (\['bob, 'joe', 'jon']);
## nope... gives the same error



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




Sorting a hash with keys generated on the fly

2002-11-05 Thread Scott, Joshua
I'd like to know the best/easiest way to sort a hash based on the values of
it's keys.  Here is a snippet of my code.
 
%somehash=();
 
foreach (somearray) {
$somehash{$_}++;
};
 
Basically I'm getting a count of unique items in an array and I want to sort
by the number of each item.  I've read some documentation and it says to do
a sort with the cmp feature, but I don't know the names of they keys I need
to compare.  Please tell me if I'm pursing this correctly, or if I'm way off
base.
 
Thank you very much for all your assistance!  I've gotten wonderful help
from this group.  Don't know what I'd do without you!
 
Joshua Scott
Security Systems Analyst, CISSP
626-568-7024
 

==
NOTICE - This communication may contain confidential and privileged information that 
is for the sole use of the intended recipient. Any viewing, copying or distribution 
of, or reliance on this message by unintended recipients is strictly prohibited. If 
you have received this message in error, please notify us immediately by replying to 
the message and deleting it from your computer.

==



Re: Sorting a hash with keys generated on the fly

2002-11-05 Thread Jenda Krynicky
From:   Scott, Joshua [EMAIL PROTECTED]
 I'd like to know the best/easiest way to sort a hash based on the
 values of it's keys.  Here is a snippet of my code.
 
 %somehash=();
 
 foreach (@somearray) {
 $somehash{$_}++;
 };
 
 Basically I'm getting a count of unique items in an array and I want
 to sort by the number of each item.  I've read some documentation and
 it says to do a sort with the cmp feature, but I don't know the names
 of they keys I need to compare.

@sorted = sort {$somehash{$a} = $somehash{$b}} keys %somehash;

The first parameter to sort() may be a block, in this block the 
elements of the list being sorted that are to be compared are aliased 
as $a and $b.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: Thread::Queue (Invalid value for shared scalar)

2002-11-05 Thread Jenda Krynicky
From: Jeremy Vinding [EMAIL PROTECTED]

 does anyone know why I can't enqueue an array ref?
 the error is this:
 Invalid value for shared scalar at
 /usr/lib/perl5/5.8.0/Thread/Queue.pm line 90.

Because you'd have a shared reference to a private array.

I believe the docs for threads.pm and Thread::Queue explain this.
I'm not using Perl 5.8 yet so I can't tell.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: Thread::Queue (Invalid value for shared scalar)

2002-11-05 Thread Jenda Krynicky
From: Jeremy Vinding [EMAIL PROTECTED]
 On Tue, 2002-11-05 at 14:18, Jenda Krynicky wrote:
 
  
  Because you'd have a shared reference to a private array.
  
  I believe the docs for threads.pm and Thread::Queue explain this.
  I'm not using Perl 5.8 yet so I can't tell.
 
 they don't but i guess that makes sense, however, 'perldoc
 threads::shared', shows these examples:
  my($scalar, @array, %hash);
  share($scalar);
  share(@array);
  share(%hash);
  my $bar = share([]);
  $hash{bar} = share({});
 
 any suggestions as to how i can create anonymous arrays on the fly in
 one thread and access them in another?

Try

enqueue( share([1, 2, 3, 4]))

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




Re: perl modules for NT

2002-11-05 Thread dan
funny, i used the ppm to install DBI on my server, it's a win2k service pack
3, but nevertheless, still the same perl software. try:

ppm install DBI

case sensitive.. maybe?

dan

James Kipp [EMAIL PROTECTED] wrote in message
news:EC6C49DE5C846143AA2CE580420E77C331D09D;xexwlm05.mbnainternational.com..
.
 
  D:\PERL\BINppm
  PPM interactive shell (2.1.6) - type 'help' for available commands.
  PPM install dbi
  Install package 'dbi?' (y/N): y
  Installing package 'dbi'...
  Error installing package 'dbi': Could not locate a PPD file
  for package dbi
  PPM version
  2.1.6
  PPM
 
  [/snip error]

 Hi, try this:
 1. Choose the package you want to install from:
 http://www.activestate.com/PPMPackages/zips/6xx-builds-only/  (
 2. unzip the files into a temp directory
 3. After the package files are extracted, open a command prompt and cd to
 the directory where the package files exist. eg. c:\temp
 4. At the command prompt just type : ppm install package_name.ppd
 So for DBI you would type: ppm install dbi.ppd
 Say yes to the prompt and it will be done.
 5. To verify the installation type: ppm query
 This will give you a  list of the packages installed, you should see the
DBI
 package in the list.






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




Re: Localizing variables

2002-11-05 Thread Jenda Krynicky
From: Jason Frisvold [EMAIL PROTECTED]
 I'm curious if there are any side effects to doing the following :
 
 #!/usr/bin/perl
 use strict;
 use warnings;
 
 my $var1 = test1;
 my $var2 = this is not test2;
 
 {
  my $var2 = test2;
  print $var1 - $var2\n;
 }
 
 print $var1 - $var2\n;
 
 
 What I'm trying to do is create a temporary variable within the main
 body of the program.  I don't want that variable to stick around after
 I use it (which is directly after I declare it) ...

Aplaud everybody! :-)

Yes, this is IMO the best way to do this.
Restrict the variables as much as you can.

There is only one case when you have to be carefull. If you define a 
procedure within the same block you efectively create a closure, the 
procedure will have it's own copy of the variable. Which may be what 
you want, but you should be aware of that.

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


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




RE: Localizing variables

2002-11-05 Thread Nikola Janceski
the second 'my $var2' will have memory allocated to it, but will not be
freed until Perl ends, but Perl will re-use that memory allocation after
leaving the {BLOCK}.


 -Original Message-
 From: Jason Frisvold [mailto:friz;corp.ptd.net]
 Sent: Tuesday, November 05, 2002 4:43 PM
 To: [EMAIL PROTECTED]
 Subject: Localizing variables
 
 
 I'm curious if there are any side effects to doing the following :
 
 #!/usr/bin/perl
 use strict;
 use warnings;
 
 my $var1 = test1;
 my $var2 = this is not test2;
 
 {
  my $var2 = test2;
  print $var1 - $var2\n;
 }
 
 print $var1 - $var2\n;
 
 
 What I'm trying to do is create a temporary variable within the main
 body of the program.  I don't want that variable to stick 
 around after I
 use it (which is directly after I declare it) ...
 
 In most cases, I'll be using unique variable names within that local
 block.  The idea is that I want to release the memory associated with
 those local variables without carrying them around.  The rest of the
 program definitely uses a lot more memory, but good memory management
 dictates that I release it when I'm done with it.  I never need that
 inner $var2 again, so why bother leaving it around?
 
 
 -- 
 ---
 Jason 'XenoPhage' Frisvold
 Senior ATM Engineer
 Penteledata Engineering
 [EMAIL PROTECTED]
 RedHat Certified - RHCE # 807302349405893
 ---
 Something mysterious is formed, born in the silent void. 
 Waiting alone
 and unmoving, it is at once still and yet in constant motion. 
 It is the
 source of all programs. I do not know its name, so I will call it the
 Tao of Programming.
 
 
 -- 
 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: Localizing variables

2002-11-05 Thread Jason Frisvold
That is exactly what I was hoping...

Thanks!

On Tue, 2002-11-05 at 16:48, Nikola Janceski wrote:
 the second 'my $var2' will have memory allocated to it, but will not be
 freed until Perl ends, but Perl will re-use that memory allocation after
 leaving the {BLOCK}.

-- 
---
Jason 'XenoPhage' Frisvold
Senior ATM Engineer
Penteledata Engineering
[EMAIL PROTECTED]
RedHat Certified - RHCE # 807302349405893
---
Something mysterious is formed, born in the silent void. Waiting alone
and unmoving, it is at once still and yet in constant motion. It is the
source of all programs. I do not know its name, so I will call it the
Tao of Programming.


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




Query String processing

2002-11-05 Thread Johnstone, Colin
Hi all,

I am writing an administration interface to my mailing list.

Upon opening the program it displays the email addresses of all the subscribers along 
with a delete link next to each name. 

The subscribers are written to a hash.

When you click delete link the name/value pair is passed back to the program.

e.g

cgi-bin/managelist.pl?[EMAIL PROTECTED]

I strip out the name value pair and search the hash for the email address, if it 
exists I delete it. This all works fine.

It is at this point that I'd like to refresh the page and remove any query string from 
URL how do I do this. Is this possible ?

Colin Johnstone
Website Project Officer 

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




Re: Thread::Queue (Invalid value for shared scalar)

2002-11-05 Thread Jeremy Vinding
On Tue, 2002-11-05 at 14:34, Jenda Krynicky wrote:
 From: Jeremy Vinding [EMAIL PROTECTED]
  On Tue, 2002-11-05 at 14:18, Jenda Krynicky wrote:
  
   
   Because you'd have a shared reference to a private array.
   
   I believe the docs for threads.pm and Thread::Queue explain this.
   I'm not using Perl 5.8 yet so I can't tell.
  
  they don't but i guess that makes sense, however, 'perldoc
  threads::shared', shows these examples:
   my($scalar, @array, %hash);
   share($scalar);
   share(@array);
   share(%hash);
   my $bar = share([]);
   $hash{bar} = share({});
  
  any suggestions as to how i can create anonymous arrays on the fly in
  one thread and access them in another?
 
 Try
 
 enqueue( share([1, 2, 3, 4]))


ah... i stand corrected, it does mention that in 'perldoc
threads::shared'
however when i do this:
thread 1:
$q-enqueue (share (['bob', 'tim', 'jon']));
thread 2:
my $file = $queue-dequeue;
print file: $file\n;
print (bob: (, join (,, @$file), )\n);
 
i get an empty array ref:
file: ARRAY(0x8505c00)
bob: ()

any other ideas?

TIA,
jjv


PS, i greatly appreciate your help.


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




Re: Split a file

2002-11-05 Thread John W. Krahn
Johnny Hall wrote:
 
 Hello all,

Hello,

 I am trying to take a file of variable length on a daily basis and
 divide it up into 4 equal parts for processing on each file.  Does
 someone have an easy way to do this?
 
 The original file is just a series of numbers like..
 
 3233404936
 3233404934
 3233669122
 3233557761
 3233818369
 3234343425
 3233431553
 3233455617
 3233404932
 3233435393
 3233562369
 3233554689
 
 
 I've tried everything I know.  Granted, that isn't very much.  :-)
 
 Here is what I'm doing so far..
 
 #!/bin/perl -w
 # Script for cloning Unix hosts weekly.
 # This is ran from cron on Saturdays at 9am
 
 # This will get Full savesets for all servers in the /root/backups/ux_serverlist file
 $SSID_LIST = /tmp/ux_clonelist;
 @CLONE_LIST = `cat /root/backups/ux_serverlist`;
 system rm $SSID_LIST;
 foreach $CLONE_HOST (@CLONE_LIST)
{
 chomp $CLONE_HOST;
 system /usr/sbin/mminfo -q level=full,client=$CLONE_HOST -r 'ssid' -t 'one 
week ago'  $SSID_LIST;
}
 
 # Attempt to break the /tmp/ux_clonelist file into equal parts for multiple cloning 
streams
 $NUM_SSID = `cat '$SSID_LIST' | wc -l`;
 chomp $NUM_SSID;
 $NUM_CON_JOBS = 4;
 $SSID_PER_FILE = int(($NUM_SSID / $NUM_CON_JOBS) + 1);
 chomp $SSID_PER_FILE;
 $FILE_COUNT = 1;
 $CLONE_FILE_LIST = $SSID_LIST.$FILE_COUNT;
 @SSID_LIST_ARRAY = `cat $SSID_LIST`;
 system rm $CLONE_FILE_LIST;
 $SSID_COUNT = 0;
 $FILE_COUNT = 0;
 chomp $SSID_COUNT; 
 open(FILE, $CLONE_FILE_LIST);
 while ($SSID_COUNT = $SSID_PER_FILE)
{
 foreach $SSID (@SSID_LIST_ARRAY)
{
 while ($SSID_COUNT = $SSID_PER_FILE)
  {
 open(FILE, $CLONE_FILE_LIST);
 chomp $SSID;
 print FILE $SSID \n;
 $SSID_COUNT = ($SSID_COUNT + 1);
 close FILE;
  }
}
 $FILE_COUNT = ($FILE_COUNT + 1);
 $CLONE_FILE_LIST = $SSID_LIST.$FILE_COUNT;
}
 
 # Now start cloning from the 4 files
 #system nsrclone -v -s catlmsxi02 -b 'UX Clone' -S -f $CLONELIST;
 #system rm $CLONELIST;



This should do what you want:

#!/bin/perl -w
use strict;
# Script for cloning Unix hosts weekly.
# This is ran from cron on Saturdays at 9am

my $ssid_list= '/tmp/ux_clonelist';
my $num_con_jobs = 4;

# This will get Full savesets for all servers in the /root/backups/ux_serverlist file
open CLONE, '/root/backups/ux_serverlist' or die Cannot open 
'/root/backups/ux_serverlist': $!;
my @ssid_list_array;
while ( my $clone_host = CLONE ) {
chomp $clone_host;
push @ssid_list_array, `/usr/sbin/mminfo -q level=full,client=$clone_host -r 
'ssid' -t 'one week ago'`;
}
my $num_ssid = @ssid_list_array;

# Break the clonelist into equal parts for multiple cloning streams
my $ssid_per_file = int( ( $num_ssid + ( $num_con_jobs - 1 ) ) / $num_con_jobs );
for my $file_count ( 1 .. 4 ) {
open FILE,  $ssid_list.$file_count or die Cannot open $ssid_list.$file_count: 
$!;
print FILE splice @ssid_list_array, 0, $ssid_per_file;
close FILE;
}

# Now start cloning from the 4 files
for my $file_count ( 1 .. 4 ) {
system nsrclone -v -s catlmsxi02 -b 'UX Clone' -S -f $ssid_list.$file_count;
unlink $ssid_list.$file_count or warn Cannot delete $ssid_list.$file_count: $!;
}

__END__



John
-- 
use Perl;
program
fulfillment

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




RE: perl modules for NT

2002-11-05 Thread ss004b3324
Hi Shaunn,

I am running W2K SP3 and it installs OK.
 pmminstall DBD-Oracle
PPM install dbd::oracle
Install package 'dbd-oracle?' (y/N): y
Installing package 'dbd-oracle'...
Bytes transferred: 92963
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.bs
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.dll
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.exp
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.lib
Installing C:\Perl\html\site\lib\Oraperl.html
Installing C:\Perl\html\site\lib\DBD\Oracle.html
Installing C:\Perl\site\lib\oraperl.ph
Installing C:\Perl\site\lib\Oraperl.pm
Installing C:\Perl\site\lib\DBD\Oracle.pm
Installing C:\Perl\bin\ora_explain
Installing C:\Perl\bin\ora_explain.bat
Writing C:\Perl\site\lib\auto\DBD\Oracle\.packlist

Check which repository ppm is using:
PPM set
Commands will be confirmed.
Temporary files will be deleted.
Download status will be updated every 16384 bytes.
Case-insensitive searches will be performed.
Package installations will continue if a dependency cannot be installed.
Tracing info will not be written.
Screens will pause after 24 lines.
Query/search results will be verbose.
Current PPD repository paths:
ActiveState Package Repository:
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer

To set the repository path:
PPM set repository Repository_Name URL
so for ActiveState Package Repository as above:
PPM set ActiveState Package Repository
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer
(The URL above will most likely be wrapped)

ppm set help gives:
set repository NAME LOCATION
- Adds a repository to the list of PPD repositories for this
  session.  'NAME' is the name by which this repository will
  be referred; 'LOCATION' is a URL or directory name.

 D:\PERL\BINppm
 PPM interactive shell (2.1.6) - type 'help' for available commands.
 PPM install dbi
 Install package 'dbi?' (y/N): y
 Installing package 'dbi'...
 Error installing package 'dbi': Could not locate a PPD file for
 package dbi
 PPM version
 2.1.6
 PPM
I think that your repository is not pointing to the correct URL.
My PPM is:
PPM version
2.1.5

Hth,

Shaun
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.410 / Virus Database: 231 - Release Date: 31/10/2002


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




RE: perl modules for NT

2002-11-05 Thread Timothy Johnson

Along the lines of what has been mentioned, do a search in the ActiveState
page for the HTTP_PROXY environment variable.  I believe just looking up the
word firewall will get you the articles you're looking for.

-Original Message-
From: ss004b3324 [mailto:meecho;blueyonder.co.uk]
Sent: Tuesday, November 05, 2002 3:07 PM
To: Beginners
Subject: RE: perl modules for NT


Hi Shaunn,

I am running W2K SP3 and it installs OK.
 pmminstall DBD-Oracle
PPM install dbd::oracle
Install package 'dbd-oracle?' (y/N): y
Installing package 'dbd-oracle'...
Bytes transferred: 92963
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.bs
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.dll
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.exp
Installing C:\Perl\site\lib\auto\DBD\Oracle\Oracle.lib
Installing C:\Perl\html\site\lib\Oraperl.html
Installing C:\Perl\html\site\lib\DBD\Oracle.html
Installing C:\Perl\site\lib\oraperl.ph
Installing C:\Perl\site\lib\Oraperl.pm
Installing C:\Perl\site\lib\DBD\Oracle.pm
Installing C:\Perl\bin\ora_explain
Installing C:\Perl\bin\ora_explain.bat
Writing C:\Perl\site\lib\auto\DBD\Oracle\.packlist

Check which repository ppm is using:
PPM set
Commands will be confirmed.
Temporary files will be deleted.
Download status will be updated every 16384 bytes.
Case-insensitive searches will be performed.
Package installations will continue if a dependency cannot be installed.
Tracing info will not be written.
Screens will pause after 24 lines.
Query/search results will be verbose.
Current PPD repository paths:
ActiveState Package Repository:
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer

To set the repository path:
PPM set repository Repository_Name URL
so for ActiveState Package Repository as above:
PPM set ActiveState Package Repository
http://ppm.ActiveState.com/cgibin/PPM/ppmserver.pl?urn:/PPMServer
(The URL above will most likely be wrapped)

ppm set help gives:
set repository NAME LOCATION
- Adds a repository to the list of PPD repositories for this
  session.  'NAME' is the name by which this repository will
  be referred; 'LOCATION' is a URL or directory name.

 D:\PERL\BINppm
 PPM interactive shell (2.1.6) - type 'help' for available commands.
 PPM install dbi
 Install package 'dbi?' (y/N): y
 Installing package 'dbi'...
 Error installing package 'dbi': Could not locate a PPD file for
 package dbi
 PPM version
 2.1.6
 PPM
I think that your repository is not pointing to the correct URL.
My PPM is:
PPM version
2.1.5

Hth,

Shaun
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.410 / Virus Database: 231 - Release Date: 31/10/2002


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




env

2002-11-05 Thread Chris Knipe
Lo everyone,

How do I read environment variables with perl?

--
me

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




RE: env

2002-11-05 Thread Timothy Johnson

They're automatically stored in the %ENV hash.  Note that if you are using
NT/2000/XP, you cannot use this hash to PERMANENTLY change environment
variables.

-Original Message-
From: Chris Knipe [mailto:savage;savage.za.org]
Sent: Tuesday, November 05, 2002 11:13 AM
To: [EMAIL PROTECTED]
Subject: env


Lo everyone,

How do I read environment variables with perl?

--
me

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




Fork Question

2002-11-05 Thread Jessee Parker
Using Perl on a Linux system, is there a way to fork off x amount of copies
then make a system wait until those copies are finished before forking off
more copies? If so can you show me an example if possible. It would be
greatly appreciated! TIA

Jessee



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




Query String Processing

2002-11-05 Thread Johnstone, Colin
Hi all,

I am writing an administration interface to my mailing list.

Upon opening the program it displays the email addresses of all the subscribers along 
with a delete link next to each name. 

The subscribers are written to a hash.

When you click delete link the name/value pair is passed back to the program.

e.g

cgi-bin/managelist.pl?[EMAIL PROTECTED]

I strip out the name value pair and search the hash for the email address, if it 
exists I delete it. This all works fine.

It is at this point that I'd like to refresh the page and remove any query string from 
URL how do I do this. Is this possible ?

Colin Johnstone
Website Project Officer

Colin Johnstone 
Website Project Officer 
Corporate Website Unit 
Public Affairs Directorate 
ph 9561 8643 

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




RE: line feeds in perl scripts

2002-11-05 Thread sean finnigan

Thank You.  What is the string if I am going the other direction?
ie. Mac to PC translation.
 Kipp, James [EMAIL PROTECTED] wrote:
 What is the best way to replace line feeds in perl scripts 
 that I copy from my PC to my Unix machine? They don't run on 
 the Unix side unless I open an editor and find/replace the 
 line feeds/carriage returns.
 

tr -d '\015'  file newfile


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



-
Do you Yahoo!?
HotJobs - Search new jobs daily now


Include files in PERL

2002-11-05 Thread Johnstone, Colin
Gidday from downunder,

When writing PHP if I want to an include I type include(filename.php);

Is there a similar command in PERL, does require do the job? In my mailing list 
application I re-use numerous functions and would like to pop these in a function 
library and include them on every page.

Colin Johnstone 
Website Project Officer
NSW Department of Education and Training 

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




RE: Include files in PERL

2002-11-05 Thread Timothy Johnson

I think 'use' is what you're looking for.  But just in case,

perldoc -f require
perldoc -f use
perldoc perlmod

On the last one, I would recommend reading the first section and then
skipping down to the Perl Modules section.  Then you can go back over the
whole thing.  Just to give you a taste of how modules work, here's a sample
..pm file.  Don't forget the 1 at the end.

#
#  Sample.pm

package Tim::Sample; #assumes the file is at .../site/lib/Tim/

sub InsertSpaces{
  my @text = split //,$_[0]; #get characters of function parameter
  return join(' ',@text);#return string made of chars w/spaces between
}

1
#

#
#  Sample.pl

use strict;
use warnings;
use Tim::Sample;

my $text = Tim::Sample::InsertSpaces(Hello World!);
print $text;

#

This prints H e l l o  W o r l d !.
-Original Message-
From: Johnstone, Colin [mailto:Colin.Johnstone;det.nsw.edu.au]
Sent: Tuesday, November 05, 2002 7:17 PM
To: '[EMAIL PROTECTED]'
Subject: Include files in PERL


Gidday from downunder,

When writing PHP if I want to an include I type include(filename.php);

Is there a similar command in PERL, does require do the job? In my mailing
list application I re-use numerous functions and would like to pop these in
a function library and include them on every page.

Colin Johnstone 
Website Project Officer
NSW Department of Education and Training 

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




javascript anybody?

2002-11-05 Thread Mariusz
I think my problem should be rather solved in JavaScript, but where can I find help? I 
tried many different keywords on goggle to find some info on accomplishing the 
following (but without success):

I have two pull-down menus. How can I make the values (choices) in the second 
pull-down menu depend on the choice from the first one? E.g.
pull-down1 category(choices: A,B,C..)
pull-down2 subcategory   (if choice A was selected in 1, then choices in 2 are for 
example A1, A2, etc..)

any help greatly appreciated
Mariusz



linux pearl??

2002-11-05 Thread stacy wilmshurst
hey can someone give me a tip to where i can find the pearl
packages on redhat8?
i'm getting real confused trying to set them up
but i know they're there...

help please

_
a href=http://www.gamedev.net;GameDev.net Email Service/a - Plenty of 1's and 
0's

_
Select your own custom email address for FREE! Get [EMAIL PROTECTED] w/No Ads, 6MB, 
POP  more! http://www.everyone.net/selectmail?campaign=tag

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




RE: javascript anybody?

2002-11-05 Thread Toby Stuart
this is not a perl question.  better posted to a HTML/javascript list.

nonetheless the following works ...


form
select name=category onclick=updateSubCategory(this.value);
option value=/option
option value=AA/option
option value=BB/option
/select

select name=sub-category
/select
/form

script language=javascript

function updateSubCategory(sCategory)
{
var aSubCategories = new Array('A1','A2','B1','B2');
var oForm = document.forms[0];
var oSubCategory = oForm.elements['sub-category'];
var oNewOption;
var i;  

while (oSubCategory.options.length != 0)
{
oSubCategory.options[0] = null;
}

for (i=0; iaSubCategories.length; i++)
{
if (aSubCategories[i].substr(0,1) == sCategory)
{
oNewOption = new Option(aSubCategories[i],
aSubCategories[i]);
oSubCategory.options[oSubCategory.length] =
oNewOption;
}
}
}
/script




 -Original Message-
 From: Mariusz [mailto:mkubis22;hotmail.com]
 Sent: Wednesday, November 06, 2002 1:56 PM
 To: perl
 Subject: javascript anybody?
 
 
 I think my problem should be rather solved in JavaScript, but 
 where can I find help? I tried many different keywords on 
 goggle to find some info on accomplishing the following (but 
 without success):
 
 I have two pull-down menus. How can I make the values 
 (choices) in the second pull-down menu depend on the choice 
 from the first one? E.g.
 pull-down1 category(choices: A,B,C..)
 pull-down2 subcategory   (if choice A was selected in 1, 
 then choices in 2 are for example A1, A2, etc..)
 
 any help greatly appreciated
 Mariusz
 

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




Re: Perl Unix Binary Files

2002-11-05 Thread Jim
On Sunday 03 November 2002 11:25, John Pitchko wrote:

Sorry this took me so long to respond to.  Yes, that is part of if not the 
full answer to your question.  You make the data binary before writing it to 
a file.

- Jim

| Ok so then how do I make my data binary? Use pack() and unpack() ?
|
| Thanks.
| --
| John Pitchko
| 3rd Year Computer Science - University of Regina
| Systems Trainee - Data Services - SGI
|
| All e-mails and attachments are certified virus free!
| - Original Message -
| From: Jim [EMAIL PROTECTED]
| To: Paul Johnson [EMAIL PROTECTED]
| Cc: [EMAIL PROTECTED]
| Sent: Sunday, November 03, 2002 10:31 AM
| Subject: Re: Perl Unix Binary Files
|
|  On Saturday 02 November 2002 18:01, you wrote:
|  | On Sat, Nov 02, 2002 at 04:00:44PM -0600, John Pitchko wrote:
|  |  I've been racking my brains out trying to get Perl to write binary
|  |  files for me. Here is my situation. For my Operating Systems class,
|  |  we are designing a file system. One of the requirements is that the
|  |  file system needs to be saved to disk as a binary file. I have a few
|  |  large array of arrays and hash of hashes in my code, so I was hoping
|  |  to be able to use Data::Dumper to dump and retireve the data
|  |  structures. However, I do not know how to open a file in binary mode
|  |  (from what I understand, binmode() does not work for Unix which is
|  |  the envrionment where I am coding) or write binary data to that file.
|  |
|  | That depends on what you mean by does not work.  I'll assume you're
|  | not using layers for the moment.  If that is the case, then binmode
|  | doesn't really have any work to do on Unix.  You can just read and
|  | write your binary data.  This has been the case since Perl 3, about 13
|  | years ago I think.
|  |
|  |  I was thinking that I would record the output from Data::Dumper into
|  |  a scalar and write this scalar in binary mode to the disk. Can anyone
|  |  give me any help with this
| 
|  Afaik, binmode doesn't actually do any binary converting.  It simply
|  makes the data in the filehandle from being tainted (keeping it real) and
|  on the Unix OS's binmode is completely optional although recommended. 
|  So, in
|
| other
|
|  words, if your data isn't already binary then binmode isn't doing
|  anything for you.
| 
|  perldoc  for binmode:
| 
|   Arranges for FILEHANDLE to be read or written in
| binary or text mode on systems where the run-
| time libraries distinguish between binary and text
| files.  If FILEHANDLE is an expression, the value
| is taken as the name of the filehandle.  DISCI-
| PLINE can be either of :raw for binary mode or
| :crlf for text mode.  If the DISCIPLINE is
| omitted, it defaults to :raw.
| 
|  | I would suggest taking a look at Storable.
|  |
|  |  All e-mails and attachments are certified virus free!
|  |
|  | Phew!
| 
|  --
| 
|  - Jim
| 
|  --
|  To unsubscribe, e-mail: [EMAIL PROTECTED]
|  For additional commands, e-mail: [EMAIL PROTECTED]

-- 

- Jim

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




could 5.8 make a difference in place of 5.6 ?

2002-11-05 Thread PRADEEP GOEL
   I am writing and/or modifying some perl scripts - they have 
  they r for test automation  for installation of some product and/or its patches , 
  scripts have basic requoirement as perl 5.6.1 must be installed on the machine 
wherever r scripts  
  gona   fired , 
   now my question could it make a difference(such as script may not run) if it s an 
upgraded 5.8 
   version   instead of 5.6 ?

  Regards 
  Pradeep 



depot?

2002-11-05 Thread PRADEEP GOEL
Thanks Aman
 can u also tell me some site to download
 perl 5.8 gz or tar.gz for hp ux 11.00
 i downloaded some , but they r depot.gz - i don't know about depot-
 or how to use them

 Regards
 Pradeep

- Original Message -
From: Aman Thind [EMAIL PROTECTED]
To: PRADEEP GOEL [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 12:20 PM
Subject: RE: could 5.8 make a difference in place of 5.6 ?


 5.8 is perfectly backward compatible and no exception has been thrown in
my
 period of it's usage.
 I have recently upgraded from 5.6.1 to 5.8 and my old scripts run perfecly
 fine.
 So any script that is good enuff for 5.6 is good enuff for 5.8

 Thanks
 Aman

 -Original Message-
 From: PRADEEP GOEL [mailto:pradeepg;india.hp.com]
 Sent: Wednesday, November 06, 2002 12:13 PM
 To: [EMAIL PROTECTED]
 Subject: could 5.8 make a difference in place of 5.6 ?


I am writing and/or modifying some perl scripts - they have
   they r for test automation  for installation of some product and/or its
 patches ,
   scripts have basic requoirement as perl 5.6.1 must be installed on the
 machine wherever r scripts
   gona   fired ,
now my question could it make a difference(such as script may not run)
if
 it s an upgraded 5.8
version   instead of 5.6 ?

   Regards
   Pradeep



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




RE: depot?

2002-11-05 Thread Aman Thind
Hi

Yeah sure.

You could look it up in : ftp://theoryx5.uwinnipeg.ca/pub/other

I found my win32 tar there.

Thanks
Aman

-Original Message-
From: PRADEEP GOEL [mailto:pradeepg;india.hp.com]
Sent: Wednesday, November 06, 2002 12:33 PM
To: Aman Thind; [EMAIL PROTECTED]
Subject: depot?


Thanks Aman
 can u also tell me some site to download
 perl 5.8 gz or tar.gz for hp ux 11.00
 i downloaded some , but they r depot.gz - i don't know about depot-
 or how to use them

 Regards
 Pradeep

- Original Message -
From: Aman Thind [EMAIL PROTECTED]
To: PRADEEP GOEL [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 12:20 PM
Subject: RE: could 5.8 make a difference in place of 5.6 ?


 5.8 is perfectly backward compatible and no exception has been thrown in
my
 period of it's usage.
 I have recently upgraded from 5.6.1 to 5.8 and my old scripts run perfecly
 fine.
 So any script that is good enuff for 5.6 is good enuff for 5.8

 Thanks
 Aman

 -Original Message-
 From: PRADEEP GOEL [mailto:pradeepg;india.hp.com]
 Sent: Wednesday, November 06, 2002 12:13 PM
 To: [EMAIL PROTECTED]
 Subject: could 5.8 make a difference in place of 5.6 ?


I am writing and/or modifying some perl scripts - they have
   they r for test automation  for installation of some product and/or its
 patches ,
   scripts have basic requoirement as perl 5.6.1 must be installed on the
 machine wherever r scripts
   gona   fired ,
now my question could it make a difference(such as script may not run)
if
 it s an upgraded 5.8
version   instead of 5.6 ?

   Regards
   Pradeep


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




RE: Include files in PERL

2002-11-05 Thread Aman Thind
Yeah this will sure do the trick but just in case you need another option to
do the same , require is also there to the rescue.

Just put all the functions you require in a separate .pl file.

The following solution can also be implemented as :

#
#  Sample.pl

sub InsertSpaces{
  my @text = split //,$_[0]; #get characters of function parameter
  return join(' ',@text);#return string made of chars w/spaces between
}

1; # required so that file can be correctly included in another script 
   #- gives a 'true' response when loaded
#

#
#  RequireSample.pl

use strict;
use warnings;

require 'C:\WINNT\Profiles\athind\Desktop\Sample.pl'; #location of the perl
file acting as a repository of all the functions 

my $text = InsertSpaces(Hello World!);
print $text;

#

This prints H e l l o  W o r l d ! too.

Take your pick :)

Thanks
Aman

-Original Message-
From: Timothy Johnson [mailto:tjohnson;sandisk.com]
Sent: Wednesday, November 06, 2002 9:17 AM
To: 'Johnstone, Colin'; '[EMAIL PROTECTED]'
Subject: RE: Include files in PERL



I think 'use' is what you're looking for.  But just in case,

perldoc -f require
perldoc -f use
perldoc perlmod

On the last one, I would recommend reading the first section and then
skipping down to the Perl Modules section.  Then you can go back over the
whole thing.  Just to give you a taste of how modules work, here's a sample
...pm file.  Don't forget the 1 at the end.

#
#  Sample.pm

package Tim::Sample; #assumes the file is at .../site/lib/Tim/

sub InsertSpaces{
  my @text = split //,$_[0]; #get characters of function parameter
  return join(' ',@text);#return string made of chars w/spaces between
}

1
#

#
#  Sample.pl

use strict;
use warnings;
use Tim::Sample;

my $text = Tim::Sample::InsertSpaces(Hello World!);
print $text;

#

This prints H e l l o  W o r l d !.
-Original Message-
From: Johnstone, Colin [mailto:Colin.Johnstone;det.nsw.edu.au]
Sent: Tuesday, November 05, 2002 7:17 PM
To: '[EMAIL PROTECTED]'
Subject: Include files in PERL


Gidday from downunder,

When writing PHP if I want to an include I type include(filename.php);

Is there a similar command in PERL, does require do the job? In my mailing
list application I re-use numerous functions and would like to pop these in
a function library and include them on every page.

Colin Johnstone 
Website Project Officer
NSW Department of Education and Training 

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

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