Subroutine returning a hash (?)

2001-07-03 Thread Martijn van Exel

Dear subscribers,

I was in a modular mood and thought it might just be a good idea to 
do the parsing of the querystring in a subroutine. The subroutine 
goes into a separate file that I then 'require' in all my future 
CGI-scripts (is this a good way?).

I thought it would be nice to return a hash with the key/value pairs 
from my querystring. I was thinking of the following:

sub parseit
{
foreach $name ($q-(param))
{
$input{$name} = $q-param($name);
}
return \%input;
}

Because a subroutine cannot return a hash (or so I was told) I 
instead return a reference to the hash. I'm not sure if this will 
work. How would I access the data in my main cgi? Or am I making 
things more difficult than they should be?

'There's always more than one way to do it' can be very confusing at times..
-- 
Martijn van Exel, [EMAIL PROTECTED]

WEBkitchen
Waterstraat 11
3511 BW Utrecht
tel/fax 030-6701818

http://www.webkitchen.nl



Re: Subroutine returning a hash (?)

2001-07-03 Thread Pierre Smolarek

damn.. i ment

sub cgi {
my $hashref = {};
.
return ($hashref);
}

my $cgi = {};
$cgi = cgi;
$cgi-{'varname'};

:) had {} after the sub :p

- Original Message - 
From: Pierre Smolarek [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; Martijn van Exel [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 10:52 AM
Subject: Re: Subroutine returning a hash (?)


 sub cgi {}
 my $hashref = {};
 .
 return ($hashref);
 }
 
 my $cgi = {};
 $cgi = cgi;
 $cgi-{'varname'};
 
 - Original Message -
 From: Martijn van Exel [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, July 03, 2001 10:01 AM
 Subject: Subroutine returning a hash (?)
 
 
  Dear subscribers,
 
  I was in a modular mood and thought it might just be a good idea to
  do the parsing of the querystring in a subroutine. The subroutine
  goes into a separate file that I then 'require' in all my future
  CGI-scripts (is this a good way?).
 
  I thought it would be nice to return a hash with the key/value pairs
  from my querystring. I was thinking of the following:
 
  sub parseit
  {
  foreach $name ($q-(param))
  {
  $input{$name} = $q-param($name);
  }
  return \%input;
  }
 
  Because a subroutine cannot return a hash (or so I was told) I
  instead return a reference to the hash. I'm not sure if this will
  work. How would I access the data in my main cgi? Or am I making
  things more difficult than they should be?
 
  'There's always more than one way to do it' can be very confusing at
 times..
  --
  Martijn van Exel, [EMAIL PROTECTED]
 
  WEBkitchen
  Waterstraat 11
  3511 BW Utrecht
  tel/fax 030-6701818
 
  http://www.webkitchen.nl




Web Test Sites

2001-07-03 Thread Frank J. Schmuck

Can someone point me to a list of sites that allow free testing of cgi
scripts?  I had such a list at one time but have misplaced it just as I need
it.

Thanks
Frank




Re: Web Test Sites

2001-07-03 Thread Nigel G Romeril

The best thing to do is get an oldish Pentium, say P200 32 Mb 1 G b hard drive
and load Linux, Apache and perl onto it. There are lots of cover disc tasters or
if you are on cable you can download and ISO image from lots of websites. This
will pretty much work 'straight out of the box' unless you want to do something
fancy and it is all yours for test purposes you can mangle it up any way you
like. If it really goes wrong, just reinstall it.

Frank J. Schmuck wrote:

 Can someone point me to a list of sites that allow free testing of cgi
 scripts?  I had such a list at one time but have misplaced it just as I need
 it.

 Thanks
 Frank




tcl/tk

2001-07-03 Thread parkra

Actually this is not cgi-problem.
But does anybody knows methods how
I can use tcl-tk tools graphically.
/Rp



RE: Web Test Sites

2001-07-03 Thread Fco. Javier Valladolid Hdez.

Hello folks !

http://free.prohosting.com

is a good choice..

if you is using Unix, install Apache Web Server, and test your CGI scripts
locally.

Rergards.
=
Francisco Valladolid
V Microsistemas
Taking the Initiative!
[EMAIL PROTECTED]

- Original Message -
From: Frank J. Schmuck [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 4:56 AM
Subject: Web Test Sites


 Can someone point me to a list of sites that allow free testing of cgi
 scripts?  I had such a list at one time but have misplaced it just as I
need
 it.

 Thanks
 Frank


_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




Writing Dynamic tables

2001-07-03 Thread James Kelty

Ok,

I have connected to a MySQL database, and I am creating a table based on
the row fetched which is not a problem. But! How can I write a table
when multiple rows are fetched without writing a new table for each row?
Here is the code I am using at the moment. I had it wrapped with a while
statement, but that wrote a table for each row.


CURRENT CODE:
@row = $query-fetchrow_array();
print $cgi-table({-border='1'},
  Tr({-align=LEFT, -valign=MIDDLE},
  [

td({-bgcolor=green,-width='150'},[$row[0],$row[1],$row[2],$row[3]])

  ]
  )
 );
print $cgi-end_table;

CODE TO WRITE A TABLE FOR EACH ROW: (Not used at the moment)

while(@row = $query-fetchrow_array()) {
print $cgi-table({-border='1'},
  Tr({-align=LEFT, -valign=MIDDLE},
  [

td({-bgcolor=green,-width='150'},[$row[0],$row[1],$row[2],$row[3]])

  ]
  )
 );
print $cgi-end_table;
}
-- 
--
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
[EMAIL PROTECTED]



Re: Writing Dynamic tables

2001-07-03 Thread Vinicius Jose Latorre


One way is:

print $cgi-start_table({-border='1'});
while(my @row = $query-fetchrow_array()) {
print $cgi-Tr({-align=LEFT, -valign=MIDDLE},
   $cgi-td({-bgcolor=green,-width='150'}, \@row));
}
print $cgi-end_table;




  Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
  Precedence: bulk
  List-Post: mailto:[EMAIL PROTECTED]
  List-Help: mailto:[EMAIL PROTECTED]
  List-Unsubscribe: mailto:[EMAIL PROTECTED]
  List-Subscribe: mailto:[EMAIL PROTECTED]
  Sender: [EMAIL PROTECTED]
  Date: Tue, 03 Jul 2001 10:26:32 -0700
  From: James Kelty [EMAIL PROTECTED]
  X-Accept-Language: en
  Content-Type: text/plain; charset=us-ascii
  X-OriginalArrivalTime: 03 Jul 2001 17:41:48.0515 (UTC) FILETIME=[6F71EB30:01C103E7]
  X-Spam-Rating: onion.valueclick.com 1.6.2 0/1000/N
  
  Ok,
  
  I have connected to a MySQL database, and I am creating a table based on
  the row fetched which is not a problem. But! How can I write a table
  when multiple rows are fetched without writing a new table for each row?
  Here is the code I am using at the moment. I had it wrapped with a while
  statement, but that wrote a table for each row.
  
  
  CURRENT CODE:
  @row = $query-fetchrow_array();
  print $cgi-table({-border='1'},
Tr({-align=LEFT, -valign=MIDDLE},
[
  
  td({-bgcolor=green,-width='150'},[$row[0],$row[1],$row[2],$row[3]])
  
]
)
   );
  print $cgi-end_table;
  
  CODE TO WRITE A TABLE FOR EACH ROW: (Not used at the moment)
  
  while(@row = $query-fetchrow_array()) {
  print $cgi-table({-border='1'},
Tr({-align=LEFT, -valign=MIDDLE},
[
  
  td({-bgcolor=green,-width='150'},[$row[0],$row[1],$row[2],$row[3]])
  
]
)
   );
  print $cgi-end_table;
  }
  -- 
  --
  James Kelty
  Sr. Unix Systems Administrator
  The Ashland Agency
  [EMAIL PROTECTED]
  


-- 
Vinicius Jose Latorre
CPqD - Telecom  IT Solutions
e-mail : [EMAIL PROTECTED]



Re: Web Test Sites

2001-07-03 Thread Richard

Hi - here's some you could try

www.f2s.com
www.virtualave.net
www.xoasis.com

take a look at www.thefreesite.com as well - it lists a whole pile of free
webhosting services.

cheers

Rick


- Original Message -
From: Frank J. Schmuck [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 10:56 AM
Subject: Web Test Sites


 Can someone point me to a list of sites that allow free testing of cgi
 scripts?  I had such a list at one time but have misplaced it just as I
need
 it.

 Thanks
 Frank





Please help with error message

2001-07-03 Thread Moon, John

Can anyone explain what this error message is trying to tell me ...

[03/Jul/2001:17:31:08] catastrophe (20762): for host ...  trying to GET
 /ITP_Billing/cgi-bin/Library/JavaScripts/misc_services_menu.js,
cgieng_start_ou
tput reports: could not fork new process (exec() failure [Exec format
error])

script contains ...

...
print $q-header(text/html);
print $q-start_html(-title=$title,
-script={-language='JavaScript',
-src='Library/JavaScripts/misc_services_menu.js'});
...


and if these type of errors are referenced any place ... ?

jwm 



CGI.pm and saving state

2001-07-03 Thread Kevin Hancock

I am having trouble with CGI.pm. The module seems great and does a lot of
cool stuff but this seems silly.

I have a script that needs to be called several times and collects different
data each time.

So I figgured I could save the state and restore the parameters each time
the script is run. All the documentation suggests this is possible.

The saving the parameters is great but how do you get them back?

I have this test code copied from ActiveState and am playing with it.
Trouble is each time you restore the state you clobber the CGI object, easy
I think I will save the state and then recover all values from the file. As
you can see below it will only recover the first values saved?

How do I get all values in the file loaded? The package is so cool that I
cannot believe there is not an easy way to restore all values.

I could loop through the test.out file and assign the values individually
but it sounds like there must be an easier way?

What am I missing? Are there any resources that do not just rehash this
example? I have found a few but they all show the same example.

Thanks for any help.

Kevin


Program run first time.

#!/usr/bin/perl
use CGI;
open (OUT,test.out) || die;
my $q = new CGI;
$q-param(-name='junk',-value='Hello');
$q-param(-name='MUM',-value='Wave');
$q-save(OUT);
close OUT;

# reopen for reading
open (IN,test.out) || die;
my $q = new CGI(IN);
print $q-Dump;
close IN;

Produces this  in test.out
junk=Hello
MUM=Wave
=

and prints

UL
LISTRONGjunk/STRONG
UL
LIHello
/UL
LISTRONGMUM/STRONG
UL
LIWave
/UL
/UL

Second time run change a few values to simulate script being called again
from browser

#!/usr/bin/perl

use CGI;
open (OUT,test.out) || die;
my $q = new CGI;
$q-param(-name='2junk',-value='Hello');
$q-param(-name='22MUM',-value='Wave');
$q-save(OUT);
close OUT;

# reopen for reading
open (IN,test.out) || die;
my $q = new CGI(IN);
print $q-Dump;
close IN;

When run prints
UL
LISTRONGjunk/STRONG
UL
LIHello
/UL
LISTRONGMUM/STRONG
UL
LIWave
/UL
/UL

Produces this in test.out
junk=Hello
MUM=Wave
=
2junk=Hello
22MUM=Wave
=





error

2001-07-03 Thread RL Autry

Hello everyone:

We are new to this list, per, and a few other perl lists.
Beginners of beginners you might say, but everyone needs a laugh every once 
in a while  :0)

Anyway can someone please tell us why we might be getting the error shown 
at this url.

We moved some scripts from a UNIX machine to a Windows2000 Server based 
machine.
Many of the scripts say they require uid, but our Server Admin doesn't 
know what a uid is.

http://www.cyberdzyns.com/cgi-bin/websearch.cgi


Thanks,
RL




Re: Concurrent file access problem !

2001-07-03 Thread Karthik Krishnamurthy

the problem here is that the ftp daemon writes to the file. unless he hacks
the code there is no way he can make the ftpd honour whatever locking protocol 
he chooses. EXCEPT for mandatory locking. this is enabled for a file by setting
the set GID bit, and clearing the group exec bit.
chmod 2640 would set it. now the big question here is will using the perl flock
enable mandatory locking ???. AFAIK linux supports mandatory locking
/kk

On Tue, Jul 03, 2001 at 12:00:08PM +0200, Aaron Craig wrote:
 What about a simple text file (that could act as a cheap PID) which is 
 created by the first process that opens the file, and deleted by that 
 process when it's done.  Any other process that wants to access the same 
 file sleep()s until the text file gets deleted.  Hacky, maybe, but simple.
 
 At 10:22 03.07.2001 +0200, you wrote:
   Hy all!
 
 I'am working on a webcam application and I enconter a problem. I have a
 Camera, a video server and a Web/FTP server (Redhat 7.0, Apache
 1.3.12-25, Wu-ftpd 2.6.1-6). My video server send 1 picture/s to the ftp
 
 server and the Web server pushes the pictures to the web client (Ie 
 Netscape) by a cgi script. My problem is a concurrent file access
 beetween the cgi script, which read the pictures file (1 per second) and
 
 the ftp server which write the picture file. The result of the error is
 that the pictures appear truncated to the web client. Furthermore, when
 the number of web client increases, the error increases too. I tried to
 force simultaneous access to the file by using the perl function sysopen
 
 with the parameter O_NONBLOCK, but my pictures appear mixed. I use a
 ramdisk to store the pictures which speeding the application but which
 not solve the problem.
 Now, I would like to synchronize the cgi file read access in order to
 block the script picture reading while the file is being writing. How to
 
 do that ? If you have any other idea, I will be enjoyed ..
 
 Thank you for your future help..
 
 I joined the cgi script :
 
 #!/usr/bin/perl
 #
 #
 
 use Fcntl;
 require 'stat.pl';
 
 #
 # Path to where the image file is stored
 $DIR = /cam/;
 #Filename the image is stored as
 $fileName = image.jpg;
 #Maximum of images/s sent
 $freq = 1;
 #Max number of images to send on a connection
 $maxImages = 900;
 #Max number of seconds until update is considered stopped
 #(ie the camera is no longer updating the image)
 $maxNoUpdate = 30;
 #
 
 $con_type = jpeg;
 
 # Unbuffer the output so it streams through faster and better.
   $| = 1;
 
 # No input record separator when reading from file via .
 undef $/;
 
 # Print HTTP headers...
 
 print Content-type: multipart/x-mixed-replace;
 boundary=--myboundary\n\n;
 print --myboundary\n;
 
 $rounds=0;
 
 while ($rounds  $maxImages)
 {
#$rounds =   $rounds +1;
$basefile = $DIR . $fileName;
 
@fstat = stat($basefile);
 
# If the same image time stamp is on the image file for more then
# X seconds then I presume that the image is no longer updated and
 will
# End the connection
 
if ($fstat[$ST_MTIME] ne $oldimagetime)
{
$sameCount = 0;
$oldimagetime = $fstat[$ST_MTIME];
}
 
#We may send the same image multiple times but there is a strict limit
 
if ($sameCount  ($maxNoUpdate * $freq))
{
  die;
}
 
$sameCount = $sameCount +1;
 
print Content-type: image/$con_type\n\n;
 
open(PIC,$basefile);
print STDOUT PIC;
close(PIC);
 
print \n\n--myboundary\n;
 
 sleep($freq);
 }
 
 
 - Gaƫl Jeanniard du Dot -
 
 Aaron Craig
 Programming
 iSoftitler.com



Writing Data Into Existing Excel

2001-07-03 Thread madan

Dear All,

I Have An Existing Excel Sheet On Linux And I Want To Embed
Some Data Onto This Excel and Then Save It .. Is There Any Perl
Script to Do This.

I Went Through CPAN's Spreadsheet::WriteExcel , But This
Overwrites The Existing Excel , Hence Old Data Inside Is Lost ,
Pls. Help Me Out ..

Warm Regards,

Madan.




Decoding URL-encoded strings..

2001-07-03 Thread Craig Paterson

Can someone tell me what function I can use to
decode URL-encoded strings, eg.

3Dhttp%3A%2F%2Fwww.domain.com%2Fdummy%2Fdummyform.asp%3Fmode%3DDUMB


Craig




RE: Multiple files in a filehandle

2001-07-03 Thread mark crowe (JIC)

OK, I probably didn't phrase that very well. But can I open more than one
filename to a single filehandle, or alternatively use more than one
filehandle in a while loop?

What I want to do is something like this:
open FILEHANDLE file1 + file2;
while (FILEHANDLE) {do stuff}

I know I can use ARGV, but in the situation I'm trying to use it, it behaves
differently to a filehandle generated with 'open'. I'm trying to get batches
of a fixed number of records to process and want to load a fixed number of
records into an array (from two files, one after the other). Then if the
final array value contains something, I want to process that batch (since
I've got enough records), otherwise it means that I've run out of data
before having enough for a full batch, and want to save that data for later
analysis. 

Test code that duplicates the problem:
@ARGV = qw(test1 test2);
for $i(0..9) {$array[$i] = }
print @array;

Unless there are an exact multiple of 10 lines in file1 + file2, this
freezes up when it runs out of data (I guess because it's waiting for the
remaining data to finish the for loop). However with a filehandle from
'open', it does what I want (except of course I can only use one file) and
completes the for loop, putting (I think) undef in the remaining places. 

I've found a couple of workarounds, but really would like to use something
like the multiple file handling behaviour of ARGV with a conventionally
'open'ed filehandle - can it be done please?

Thanks 

Mark C

 -Original Message-
 From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]]
 Sent: 02 July 2001 16:53
 To: mark crowe (JIC)
 Cc: [EMAIL PROTECTED]
 Subject: Re: Multiple files in a filehandle
 
 
 On Jul 2, mark crowe (JIC) said:
 
 Please can anyone tell me if there is a way to open multiple 
 files to a
 single filehandle, or somehow carry out something 
 equivalent. I can do it by
 putting the filenames into @ARGV and then doing a while () 
 {loop}, but I'd
 like to use a specific filehandle name.
 
 There *IS* a specific filehandle being used -- ARGV.



RE: Decoding URL-encoded strings..

2001-07-03 Thread Craig Paterson

Thanks a million..

 -Original Message-
 From: Nigel Wetters [mailto:[EMAIL PROTECTED]]
 Sent: 03 July 2001 11:39
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: Re: Decoding URL-encoded strings..
 
 
 From CPAN - URI::Escape -
 
 
 NAME
URI::Escape - Escape and unescape unsafe characters
 
 SYNOPSIS
 use URI::Escape;
 $safe = uri_escape(10% is enough\n);
 $verysafe = uri_escape(foo, \0-\377);
 $str  = uri_unescape($safe);
 
 
 DESCRIPTION
This module provides functions to escape and unescape URI
strings as defined by RFC 2396.  URIs consist of a
restricted set of characters, denoted as uric in RFC
2396.  The restricted set of characters consists of
digits, letters, and a few graphic symbols chosen from
those common to most of the character encodings and input
facilities available to Internet users:
 
 
  Craig Paterson [EMAIL PROTECTED] 07/03/01 10:06am 
 Can someone tell me what function I can use to
 decode URL-encoded strings, eg.
 
 3Dhttp%3A%2F%2Fwww.domain.com%2Fdummy%2Fdummyform.asp%3Fmode%3DDUMB
 
 
 Craig
 
 
 
 
 This e-mail and any files transmitted with it are confidential 
 and solely for the use of the intended recipient. 
 ONdigital plc, 346 Queenstown Road, London SW8 4DG. Reg No: 3302715. 
 




Re: Windows2000

2001-07-03 Thread Aaron Craig

I would call back server Admin and ask them to take off FrontPage Extensions :)

However, Windows2000 is pretty good at transferring files in the correct 
format.  I actually use the Windows Explorer as my ftp client, and it 
handles cgi and pl scripts just fine.

Plus, if you're using Network Places to transfer data around, it means 
you're going through the local network, which means you're transferring 
files in much the same way as you move them from one folder to another -- 
ie, you've got nothing to worry about :)

At 00:27 03.07.2001 -0500, RL Autry wrote:
Hello everyone:

We are new to the list and need to find out the following:
Our server Admin just told us that we are now on Windows2000 with 
FrontPage Extensions installed.
They warned us about using FTP in order to transfer files. They said FTP 
would corrupt the FrontPage Extensions.

They advised us to use our Network Places instead for file transfer.

Does anyone know how we can tell our Windows2000 Professional Operating 
system (Network Places) that it is moving a .pl or .cgi, ect file so that 
we can be sure it does it in ASCII?



Thanks,
RL


Aaron Craig
Programming
iSoftitler.com




A Split Question

2001-07-03 Thread paul


Hi.

My file has dates in it that either come out as 2Jul2001 or 21Jul2001.  So one or 
two digits for the day, three for the month, and four for the year.

So I would like to split out the day, month, year, and am interested in splitting 
techniques, where there are no delimeters.

Of course, I could just test the length and then use substr it all out, or even 
sprintf it into a new variable with a pad at the first character.

But this is perl, and I reckon there are much cooler ways to do it.

Any takers?

Paul.




Global WebMail -
  Delivered by Global Internet www.global.net.uk







Re: A Split Question

2001-07-03 Thread Pierre Smolarek

my $dateis = 2Jul2001;
my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;

print $date - $month - $year \n;

:)

with regards,

Pierre

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 12:24 PM
Subject: A Split Question



 Hi.

 My file has dates in it that either come out as 2Jul2001 or 21Jul2001.
So one or two digits for the day, three for the month, and four for the
year.

 So I would like to split out the day, month, year, and am interested in
splitting techniques, where there are no delimeters.

 Of course, I could just test the length and then use substr it all out, or
even sprintf it into a new variable with a pad at the first character.

 But this is perl, and I reckon there are much cooler ways to do it.

 Any takers?

 Paul.



 
 Global WebMail -
   Delivered by Global Internet www.global.net.uk
 






RE: A Split Question

2001-07-03 Thread John Edwards

You do have delimiters there (of a sort)

2Jul2001
^^  ^
Number Letter Number


@dates = qw(2Jul2001 21Jul2001);

foreach (@dates) {
/(\d+)(\D+)(\d+)/;
$day = $1;
$month = $2;
$year = $3;

print Day $day, month $month, year $year\n;
}

John

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 12:24
To: [EMAIL PROTECTED]
Subject: A Split Question



Hi.

My file has dates in it that either come out as 2Jul2001 or 21Jul2001.
So one or two digits for the day, three for the month, and four for the
year.

So I would like to split out the day, month, year, and am interested in
splitting techniques, where there are no delimeters.

Of course, I could just test the length and then use substr it all out, or
even sprintf it into a new variable with a pad at the first character.

But this is perl, and I reckon there are much cooler ways to do it.

Any takers?

Paul.




Global WebMail -
  Delivered by Global Internet www.global.net.uk





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





Best way to match 3 things?

2001-07-03 Thread Tim Musson

PerlGuru's,

I had anif {} elsif {}and converted it to the following which
I like, but now find I need to match 3 things - not 2.

DoTheSub($PassedVar) if ($String eq string) or ($foo =~ /$String/);

I tried adding another or to the above, but that did not work (I
didn't really think it would, but had to try g).
  or (AnotherSub($Var) eq \tText)

What would be the best way to run my sub (DoTheSub in the above
example) if any of 3 things matched?  Should I go back to:
 if(){ }elsif(){ }else(){ }
or is another way better?

TIA

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Ever stop to think, and forget to start again?




A Sort Hash Question

2001-07-03 Thread paul



My hash has keys that are dates in ddmmm format (21Jul2001).

I would like to sort the hash by date.

So as I understand it:
  
  keys %dates

should return an array with the dates in.  I can't sort that directly as it is a date, 
so I was thinking that I could split the date out and timelocal the result and sort on 
that.

However, I need to do all that inline in the sort as far as I can see, and that is 
just a little more than my newbie Perl brain can get together.

Can anyone else?




Global WebMail -
  Delivered by Global Internet www.global.net.uk







Re: A Sort Hash Question

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, [EMAIL PROTECTED] said:

My hash has keys that are dates in ddmmm format (21Jul2001).

The date format DDMM is easily sortable (even via normal 'cmp'
comparison).  Translate your dates into this format:

  %mon2num = qw(
Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06
Jul 07 Aug 08 Sep 09 Oct 10 Nov 11 Dec 12
  );

  %num2mon = reverse %mon2num;  # so we can go backwards, if desired

  @sorted_dates =
map { s/(\d\d)(\d\d)/$1$num2mon{$2}/; $_ }  # change MM - MON
sort# sort the dates
map { s/(\D+)/$mon2num{$1}/; $_ }   # change MON - MM
@dates;

This is a Guttman-Rosler Transform (it might look like a Schwartzian
Transform, but it is not).  The GRT works by finessing the data into a
form that can be sorted by simply saying sort(), and then finessing it
back to how you want.

This assumes your dates are DDMMM.  If you have a DMMM (like
2Jul2001), you'll need to pad it with a 0.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




RE: Re: A Split Question

2001-07-03 Thread paul



Aah...  I was so close.  But slightly on the wrong track by using split..  I had the 
regex as below.

Now I just need to work out how to use this with my sort hash question.

Thanks Pierre.

In reply-to Pierre Smolarek [EMAIL PROTECTED] on Tue Jul  3 13:01:43 2001
my $dateis = 2Jul2001;
my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;

print $date - $month - $year \n;

:)

with regards,

Pierre

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 12:24 PM
Subject: A Split Question



 Hi.

 My file has dates in it that either come out as 2Jul2001 or 21Jul2001.
So one or two digits for the day, three for the month, and four for the
year.

 So I would like to split out the day, month, year, and am interested in
splitting techniques, where there are no delimeters.

 Of course, I could just test the length and then use substr it all out, or
even sprintf it into a new variable with a pad at the first character.

 But this is perl, and I reckon there are much cooler ways to do it.

 Any takers?

 Paul.



Global WebMail -
  Delivered by Global Internet www.global.net.uk







Re: A Sort Hash Question

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, Jeff 'japhy' Pinyan said:

  @sorted_dates =
map { s/(\d\d)(\d\d)/$1$num2mon{$2}/; $_ }  # change MM - MON
sort# sort the dates
map { s/(\D+)/$mon2num{$1}/; $_ }   # change MON - MM
@dates;

This assumes your dates are DDMMM.  If you have a DMMM (like
2Jul2001), you'll need to pad it with a 0.

I suggest you pad it via a simple

  map { length($_)  9 ? 0$_ : $_ }

between the bottom map() and @dates.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Re: Agnostic clear command...

2001-07-03 Thread paul


Hmm...  this used to work in old dos:

  cls  clear.txt
  type clear.txt

This would clear the screen.  Now you just get an ascii representation of the clear 
code.

Does this mean than that you cannot clear the screen in Win32 just by printing an 
ascii sequence?

Or perhaps we need
  device=c:\winnt\system32\ansi.sys

Somewhere?  In config.sys?



Hey Michael,

print $clear;on my system gives an ascii 012 on my screen and does
not clear it (I am $^O=MSWin32).



Global WebMail -
  Delivered by Global Internet www.global.net.uk







RE: Best way to match 3 things?

2001-07-03 Thread John Edwards

Adding another or works.

$String = 0;
$foo = 0;
$bar = 0;

print Hello if ($String) or ($foo) or ($bar);

Set any of the vars to 1 and it prints Hello. What's not working about
that...

John

-Original Message-
From: Tim Musson [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 12:49
To: [EMAIL PROTECTED]
Subject: Best way to match 3 things?


PerlGuru's,

I had anif {} elsif {}and converted it to the following which
I like, but now find I need to match 3 things - not 2.

DoTheSub($PassedVar) if ($String eq string) or ($foo =~ /$String/);

I tried adding another or to the above, but that did not work (I
didn't really think it would, but had to try g).
  or (AnotherSub($Var) eq \tText)

What would be the best way to run my sub (DoTheSub in the above
example) if any of 3 things matched?  Should I go back to:
 if(){ }elsif(){ }else(){ }
or is another way better?

TIA

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Ever stop to think, and forget to start again?


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





Re[2]: Best way to match 3 things?

2001-07-03 Thread Tim Musson

Hey John,

Ok, I stand corrected, I guess it was something else that didn't work.
Thanks!

Tuesday, July 03, 2001, 8:38:02 AM, my MUA believes you used
Internet Mail Service (5.5.2653.19) to write:

JE Adding another or works.

JE $String = 0;
JE $foo = 0;
JE $bar = 0;

JE print Hello if ($String) or ($foo) or ($bar);

JE Set any of the vars to 1 and it prints Hello. What's not working about
JE that...

=

JE PerlGuru's,

JE I had anif {} elsif {}and converted it to the following which
JE I like, but now find I need to match 3 things - not 2.

JE DoTheSub($PassedVar) if ($String eq string) or ($foo =~ /$String/);

JE I tried adding another or to the above, but that did not work (I
JE didn't really think it would, but had to try g).
JE   or (AnotherSub($Var) eq \tText)

JE What would be the best way to run my sub (DoTheSub in the above
JE example) if any of 3 things matched?  Should I go back to:
JE  if(){ }elsif(){ }else(){ }
JE or is another way better?

-- 
[EMAIL PROTECTED]
Using The Bat! (http://www.ritlabs.com/the_bat/) eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
Why are you wasting time reading taglines?




Re: changing Unix Passwd

2001-07-03 Thread charles


i am not certain if you are looking at actually using the 'passwd' command
to change your password, or just its functionality. one cgi script that
does this is brink.cgi which is freely available. at the very least,
you'll get one individuals take on how to do it and perhaps build upon it.

-charles


On Tue, 3 Jul 2001, Tarik Jeait wrote:

 Hi,
   can somebody tell me how to change my unix passwd by a perl script
 :

 open(FILE,|passwd); -- doesn't work ;

 must I open some pipe or What ?

 T.J

 Thank you






Re: changing Unix Passwd

2001-07-03 Thread Luke Bakken

The passwd program usually (if not always) expects a TTY - so you either
have to fake it out with something like Expect.pm (do a google search on
change password passwd Expect.pm perl) or use a stream of commands fed
into vipw (including the new password encrypted) to do the dirty work.

I would think the Expect route to be easiest.

Luke


On Tue, 3 Jul 2001, Tarik Jeait wrote:

 Hi,
   can somebody tell me how to change my unix passwd by a perl script
 :

 open(FILE,|passwd); -- doesn't work ;

 must I open some pipe or What ?

 T.J

 Thank you





RE: Multiple files in a filehandle

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, mark crowe (JIC) said:

   open FILEHANDLE file1 + file2;
   while (FILEHANDLE) {do stuff}

This is specifically what @ARGV and  are good for. ;)

Test code that duplicates the problem:
   @ARGV = qw(test1 test2);
   for $i(0..9) {$array[$i] = }
   print @array;

Yes, if there are less than 10 lines in the combined count of test1 and
test2, this program *MIGHT* hang.  It won't hang if the number of lines in
the files, combined, is ONE LESS than the number of lines you're looking
for.  That's because after  has exhausted @ARGV, it returns undef on the
next call for a line.  After that,  goes back to doing what it always
does -- read from the files in @ARGV, or set @ARGV to - and read from
that (STDIN).

So the solution is to use the eof() function in its no-arguments form.
(To see why this is important, read 'perldoc -f eof' to find how
eof() checks differently, if it's called as 'eof', 'eof()', or 'eof(FH)'.)

So I would write:

  for (0 .. 9) {
push @array, scalar ;
last if eof();
  }

And it works as expected.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Re: A Split Question

2001-07-03 Thread Luke Bakken

  Unpack works well with fixed format data like this.

 Why would you use unpack when this can be easily split apart with a regex?
 I'd think unpack would be overkill!

 -- Brett

if you had thousands of dates to split up, unpack is much faster than
regexes.  way way faster.

Luke




Re: changing Unix Passwd

2001-07-03 Thread Maxim Berlin

Hello Tarik,

Tuesday, July 03, 2001, Tarik Jeait [EMAIL PROTECTED] wrote:

TJ   can somebody tell me how to change my unix passwd by a perl
TJ script:
TJ open(FILE,|passwd); -- doesn't work ;

TJ must I open some pipe or What ?
on linux - man usermod
on freebsd - man pw
on ... - man -k user, man -k passwd

Best wishes,
 Maximmailto:[EMAIL PROTECTED]





RE: A Split Question

2001-07-03 Thread Will Crain



-- Original Message --

My file has dates in it that either come out as 2Jul2001 or 21Jul2001.
 So one or two digits for the day, three for the month, and four for the
year.

So I would like to split out the day, month, year, and am interested in
splitting techniques, where there are no delimeters.


This is my first contribution to the list, I hope it helps.  You should
be able to extract your date data using this regex -

($day, $month, $year) = $date =~ /(\d{1,2})(\w{3,})(\d{4})/;

This assumes $date contains your date string and results in $day, $month
and $year containing the individual data bits.

Will



Visit iWon.com - the Internet's largest guaranteed cash giveaway! Click
here now for your Thank You gift:
http://www.iwon.com/giftcenter/0,2612,,00.html?t_id=20157






Re: ActivePerl PPM Question

2001-07-03 Thread Tim Musson

Hey Bill,

Tuesday, July 03, 2001, 10:05:47 AM, my MUA believes you used
Internet Mail Service (5.5.2653.19) to write:

CBT Hi All

CBT Has anyone used ActivePerl's Perl Package Manager to install CPAN
CBT packages? I down loaded the Tk package and I am trying to install it locally
CBT with the following command

CBT ppm install Tk.ppd

CBT and I get the following error:

CBT Failed to load PPM_DAT file

CBT Can someone tell me what I need to do to correct this error.

May seem like a silly question, but did the package you got from CPAN
have a Tk.ppd file?  I don't recall seeing .ppd files in downloads
from CPAN.  I usually just run PPM to get precompiled packages from
ActiveState...
ppm
search tk
install Tk --the package from the returned list you want to install

-- 
[EMAIL PROTECTED]
Using The Bat! (http://www.ritlabs.com/the_bat/) eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
!try; do();




Log file creation

2001-07-03 Thread Tim Musson

perlpeople,

  Is it better to open a log file only when I need to write to it, or
  open it at the start, and close when done?

  A few thousand lines in the log...

-- 
[EMAIL PROTECTED]
Using The Bat! eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
When in doubt, think.




RE: ActivePerl PPM Question

2001-07-03 Thread Conrad, Bill (ThomasTech)

HI Tim

Yes, I downloaded the Tk.zip file from ActiveState not CPAN and got
this error.

Thanks

Bill Conrad

-Original Message-
From: Tim Musson [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 10:42 AM
To: [EMAIL PROTECTED]
Subject: Re: ActivePerl PPM Question


Hey Bill,

Tuesday, July 03, 2001, 10:05:47 AM, my MUA believes you used
Internet Mail Service (5.5.2653.19) to write:

CBT Hi All

CBT Has anyone used ActivePerl's Perl Package Manager to install
CPAN
CBT packages? I down loaded the Tk package and I am trying to install it
locally
CBT with the following command

CBT ppm install Tk.ppd

CBT and I get the following error:

CBT Failed to load PPM_DAT file

CBT Can someone tell me what I need to do to correct this error.

May seem like a silly question, but did the package you got from CPAN
have a Tk.ppd file?  I don't recall seeing .ppd files in downloads
from CPAN.  I usually just run PPM to get precompiled packages from
ActiveState...
ppm
search tk
install Tk --the package from the returned list you want to install

-- 
[EMAIL PROTECTED]
Using The Bat! (http://www.ritlabs.com/the_bat/) eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
!try; do();



RE: A Split Question

2001-07-03 Thread John Edwards

Sorry to pick holes in your first post to the list ;) but this part of your
suggested regex 

(\w{3,})

will match any alphanumeric character (i.e it will match on the numbers or
letters in the string). By limiting it to three places, you force the match
to work. It's not good practice though.

Matching on a non-digit character will produce the same result, with more
flexibility.

So

($day, $month, $year) = $date =~ /(\d+)(\D+)(\d+)/;
^ ^^
| ||
Match one or more numbers ||
  ||
  Match one or more NON numbers|
   |
 Match one or more numbers again

HTH

John


-Original Message-
From: Will Crain [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 15:41
To: [EMAIL PROTECTED]
Subject: RE: A Split Question

-- Original Message --

My file has dates in it that either come out as 2Jul2001 or 21Jul2001.
 So one or two digits for the day, three for the month, and four for the
year.

So I would like to split out the day, month, year, and am interested in
splitting techniques, where there are no delimeters.


This is my first contribution to the list, I hope it helps.  You should
be able to extract your date data using this regex -

($day, $month, $year) = $date =~ /(\d{1,2})(\w{3,})(\d{4})/;

This assumes $date contains your date string and results in $day, $month
and $year containing the individual data bits.

Will



Visit iWon.com - the Internet's largest guaranteed cash giveaway! Click
here now for your Thank You gift:
http://www.iwon.com/giftcenter/0,2612,,00.html?t_id=20157




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





Re: A Split Question

2001-07-03 Thread Pierre Smolarek

I stand by my reply to this post. Sure, unpack is quicker. But if you use
regex, i always prefer to use my own defined regex's

my $dateis = 2Jul2001;
my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;

It makes me sleeper at night


- Original Message -
From: John Edwards [EMAIL PROTECTED]
To: 'Will Crain' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 3:54 PM
Subject: RE: A Split Question


 Sorry to pick holes in your first post to the list ;) but this part of
your
 suggested regex

 (\w{3,})

 will match any alphanumeric character (i.e it will match on the numbers or
 letters in the string). By limiting it to three places, you force the
match
 to work. It's not good practice though.

 Matching on a non-digit character will produce the same result, with more
 flexibility.

 So

 ($day, $month, $year) = $date =~ /(\d+)(\D+)(\d+)/;
 ^ ^^
 | ||
 Match one or more numbers ||
   ||
   Match one or more NON numbers|
|
  Match one or more numbers again

 HTH

 John


 -Original Message-
 From: Will Crain [mailto:[EMAIL PROTECTED]]
 Sent: 03 July 2001 15:41
 To: [EMAIL PROTECTED]
 Subject: RE: A Split Question

 -- Original Message --

 My file has dates in it that either come out as 2Jul2001 or
21Jul2001.
  So one or two digits for the day, three for the month, and four for the
 year.
 
 So I would like to split out the day, month, year, and am interested in
 splitting techniques, where there are no delimeters.
 

 This is my first contribution to the list, I hope it helps.  You should
 be able to extract your date data using this regex -

 ($day, $month, $year) = $date =~ /(\d{1,2})(\w{3,})(\d{4})/;

 This assumes $date contains your date string and results in $day, $month
 and $year containing the individual data bits.

 Will



 Visit iWon.com - the Internet's largest guaranteed cash giveaway! Click
 here now for your Thank You gift:
 http://www.iwon.com/giftcenter/0,2612,,00.html?t_id=20157




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





Re: A Split Question

2001-07-03 Thread Pierre Smolarek

err.. make that sleep better

kinda got side tracked with work :}


- Original Message -
From: Pierre Smolarek [EMAIL PROTECTED]
To: John Edwards [EMAIL PROTECTED]; 'Will Crain'
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 3:59 PM
Subject: Re: A Split Question


 I stand by my reply to this post. Sure, unpack is quicker. But if you use
 regex, i always prefer to use my own defined regex's

 my $dateis = 2Jul2001;
 my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;

 It makes me sleeper at night


 - Original Message -
 From: John Edwards [EMAIL PROTECTED]
 To: 'Will Crain' [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, July 03, 2001 3:54 PM
 Subject: RE: A Split Question


  Sorry to pick holes in your first post to the list ;) but this part of
 your
  suggested regex
 
  (\w{3,})
 
  will match any alphanumeric character (i.e it will match on the numbers
or
  letters in the string). By limiting it to three places, you force the
 match
  to work. It's not good practice though.
 
  Matching on a non-digit character will produce the same result, with
more
  flexibility.
 
  So
 
  ($day, $month, $year) = $date =~ /(\d+)(\D+)(\d+)/;
  ^ ^^
  | ||
  Match one or more numbers ||
||
Match one or more NON numbers|
 |
   Match one or more numbers again
 
  HTH
 
  John
 
 
  -Original Message-
  From: Will Crain [mailto:[EMAIL PROTECTED]]
  Sent: 03 July 2001 15:41
  To: [EMAIL PROTECTED]
  Subject: RE: A Split Question
 
  -- Original Message --
 
  My file has dates in it that either come out as 2Jul2001 or
 21Jul2001.
   So one or two digits for the day, three for the month, and four for
the
  year.
  
  So I would like to split out the day, month, year, and am interested in
  splitting techniques, where there are no delimeters.
  
 
  This is my first contribution to the list, I hope it helps.  You should
  be able to extract your date data using this regex -
 
  ($day, $month, $year) = $date =~ /(\d{1,2})(\w{3,})(\d{4})/;
 
  This assumes $date contains your date string and results in $day, $month
  and $year containing the individual data bits.
 
  Will
 
 
 
  Visit iWon.com - the Internet's largest guaranteed cash giveaway! Click
  here now for your Thank You gift:
  http://www.iwon.com/giftcenter/0,2612,,00.html?t_id=20157
 
 
 
 
  --Confidentiality--.
  This E-mail is confidential.  It should not be read, copied, disclosed
or
  used by any person other than the intended recipient.  Unauthorised use,
  disclosure or copying by whatever medium is strictly prohibited and may
be
  unlawful.  If you have received this E-mail in error please contact the
  sender immediately and delete the E-mail from your system.
 




RE: Re: A Sort Hash Question

2001-07-03 Thread paul


Thanks Japhy...

I can see where you are going with this, we convert the month into a number, and then 
sort the dates as a string.

My dates are the second keys of a hash of hashes.  So I have routine like:

foreach $firstkey (keys %hoh)
{
  foreach $thedate (keys %{ $hoh { $firstkey }} )
  {
 #do stuff with what we find there
  }
}

What I don't quite get is how I integrate the sort into what I am already doing.  If I 
just wanted to sort the keys as is, I could insert sort( before (keys above.

But I need to process the date before sorting on it, and I can't see how to get it 
into the loop.  Or perhaps I shouldn't.

Can you help further?

Thanks,

Paul.




In reply-to [EMAIL PROTECTED] on Tue Jul  3 15:59:15 2001
On Jul 3, [EMAIL PROTECTED] said:

My hash has keys that are dates in ddmmm format (21Jul2001).

The date format DDMM is easily sortable (even via normal 'cmp'
comparison).  Translate your dates into this format:

  %mon2num = qw(
Jan 01 Feb 02 Mar 03 Apr 04 May 05 Jun 06
Jul 07 Aug 08 Sep 09 Oct 10 Nov 11 Dec 12
  );

  %num2mon = reverse %mon2num;  # so we can go backwards, if desired

  @sorted_dates =
map { s/(\d\d)(\d\d)/$1$num2mon{$2}/; $_ }  # change MM - MON
sort# sort the dates
map { s/(\D+)/$mon2num{$1}/; $_ }   # change MON - MM
@dates;

This is a Guttman-Rosler Transform (it might look like a Schwartzian
Transform, but it is not).  The GRT works by finessing the data into a
form that can be sorted by simply saying sort(), and then finessing it
back to how you want.

This assumes your dates are DDMMM.  If you have a DMMM (like
2Jul2001), you'll need to pad it with a 0.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **





Global WebMail -
  Delivered by Global Internet www.global.net.uk







Re[2]: ActivePerl PPM Question

2001-07-03 Thread Tim Musson

Hey Bill,

I have never grabbed the .zip files from ActiveState.  I always just
run PPM and let it get the files...  I believe you can do it manually,
I just have never had a reason to try.  At a guess, you may have
problems locating the .ppm file?

Tuesday, July 03, 2001, 10:53:38 AM, my MUA believes you used
Internet Mail Service (5.5.2653.19) to write:

CBT HI Tim

CBT Yes, I downloaded the Tk.zip file from ActiveState not CPAN and
CBT got this error.

CBT Tuesday, July 03, 2001, 10:05:47 AM, my MUA believes you used
CBT Internet Mail Service (5.5.2653.19) to write:

CBT Has anyone used ActivePerl's Perl Package Manager to install
CBT CPAN packages? I down loaded the Tk package and I am trying to
CBT install it locally with the following command

CBT ppm install Tk.ppd

CBT and I get the following error:

CBT Failed to load PPM_DAT file

CBT Can someone tell me what I need to do to correct this error.

CBT May seem like a silly question, but did the package you got from CPAN
CBT have a Tk.ppd file?  I don't recall seeing .ppd files in downloads
CBT from CPAN.  I usually just run PPM to get precompiled packages from
CBT ActiveState...
CBT ppm
CBT search tk
CBT install Tk --the package from the returned list you want to install




-- 
[EMAIL PROTECTED]
Using The Bat! (http://www.ritlabs.com/the_bat/) eMail v1.53d
Windows NT 5.0.2195 (Service Pack 1)
MS Windows -- From the people who brought you EDLIN! 




Re: A Split Question

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, Luke Bakken wrote:

Unpack works well with fixed format data like this.
  
   Why would you use unpack when this can be easily split apart with a regex?
   I'd think unpack would be overkill!

 why is it overkill any more that a regex?

Are you saying we should be using unpack rather than regular expressions?

-- Brett
   http://www.chapelperilous.net/btfwk/

An investment in knowledge always pays the best interest.
-- Benjamin Franklin





RE: ActivePerl PPM Question

2001-07-03 Thread Conrad, Bill (ThomasTech)

Hi Adrian

I had a corrupt version of ppm. I re-installed and it works. 

Thanks

Bill Conrad

-Original Message-
From: Ichim, Adrian [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 11:12 AM
To: Conrad, Bill (ThomasTech)
Subject: RE: ActivePerl PPM Question


You may have some version conflict, or a broken download. I tried the steps
I wrote you about and it worked.
Maybe you can download the package again and try a new install.

Best wishes,

Adrian Ichim
Network administrator, Timken Romania
phone:  +(40) 44 403172
e-mail:  [EMAIL PROTECTED]


-Original Message-
From: Conrad, Bill (ThomasTech) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 6:03 PM
To: Ichim, Adrian
Subject: RE: ActivePerl PPM Question


HI Adrian

I downloaded the package from ActiveState not CPAN as I mentioned in
my e-mail and I am attempting to install the package locally but I still get
the error. 

Thanks

Bill Conrad

-Original Message-
From: Ichim, Adrian [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 10:55 AM
To: Conrad, Bill (ThomasTech)
Subject: RE: ActivePerl PPM Question


PPM is designed to install ActiveState packages. If you downloaded something
from CPAN, it is unlikely to work directly with PPM.
If you will search the ActiveState documentation (installed by default), you
will see at ActivePerl FAQ- Using PPM,
PPM, Proxies and Firewalls something like this:

NOTE: If none of the changes in this document work for you, you may
download individual packages from here [ActivePerl 613 and later] or here
[ActivePerl 522 and earlier] and install them according to the directions in
the README file contained within the ZIP file.

You will have to follow the appropriate link to download the package, unpack
the downloaded zip file (Tk.zip) and do as instructed by the README file: 

To install this ActiveState PPM package, run the following command
in the current directory:

ppm install Tk.ppd

In fact, you should open a command window (I assume you are on Windows),
change your directory to the drive and directory you unzipped the package
and issue the PPM command.

Best regards, 

Adrian Ichim
Network administrator, Timken Romania
phone:  +(40) 44 403172
e-mail:  [EMAIL PROTECTED]


-Original Message-
From: Conrad, Bill (ThomasTech) [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 03, 2001 5:06 PM
To: [EMAIL PROTECTED]
Subject: ActivePerl PPM Question


Hi All

Has anyone used ActivePerl's Perl Package Manager to install CPAN
packages? I down loaded the Tk package and I am trying to install it locally
with the following command

ppm install Tk.ppd

and I get the following error:

Failed to load PPM_DAT file

Can someone tell me what I need to do to correct this error.

Thanks

Bill Conrad



Re[2]: A Split Question

2001-07-03 Thread Maxim Berlin

Hello Brett,

Tuesday, July 03, 2001, Brett W. McCoy [EMAIL PROTECTED] wrote:

Unpack works well with fixed format data like this.
  
   Why would you use unpack when this can be easily split apart with a regex?
   I'd think unpack would be overkill!

 why is it overkill any more that a regex?

BWM Are you saying we should be using unpack rather than regular expressions?

try this:
-
 use strict;
 use Benchmark;

 my %try =(

   'unpack' = sub {

  my @dates = qw(2Jul2001 21Jul2001 2Jul2001 21Jul2001 2Jul2001 21Jul2001);

  for my $date (@dates)
  {
  my ($month, $day, $year) =
  length $date == 8   ?
  unpack 'AA3A4', $date   :
  unpack 'A2A3A4', $date;
  }

   },

   'regexp' = sub {
  my @dates = qw(2Jul2001 21Jul2001 2Jul2001 21Jul2001 2Jul2001 21Jul2001);

  foreach (@dates) {
  /(\d+)(\D+)(\d+)/;
  my ($month, $day, $year) = ( $1,$2,$3);
  }

   },

 );


timethese( 1e5, \%try);
-


mak@freebus/usr/home/makperl t.pl
Benchmark: timing 10 iterations of regexp, unpack...
regexp: 15 wallclock secs (14.61 usr +  0.00 sys = 14.61 CPU)
unpack: 12 wallclock secs (11.17 usr +  0.00 sys = 11.17 CPU)


Best wishes,
 Maximmailto:[EMAIL PROTECTED]





Perl 2 EXE or other problem?

2001-07-03 Thread Stout, Joel R

I have the following in my script:

use Mail::Sender;

When using Perl2Exe I get the following error:

Warning: module Mail/Sender.config.pm not found

After install of Perl2Exe I ran the sample and it did fine.  The Perl script
runs without warnings and I use (-w; use strict;).  I am using Win32.

Any clues?



Re: A Split Question

2001-07-03 Thread Jos Boumans

on a side note, if you CAN use perls internal char classes you really want to do
that
firstly to avoid typos, secondly, they're much faster.
and if you're using the same regexp over and over again, you *might* want to
concider building it outside the loop with the /o switch

(this all performace bits of course)

so in short, try:
my ($d,$m,$y) = $string =~ /(\d+)(\D+)(\d+)/

\D is perfectly safe here, but tehn again, we know context... =)

hth,

Jos Boumans


snip

  I stand by my reply to this post. Sure, unpack is quicker. But if you use
  regex, i always prefer to use my own defined regex's
 
  my $dateis = 2Jul2001;
  my ($date,$month,$year) = $dateis =~ /([0-9]+)([A-Za-z]+)([0-9]+)/;
 

/snip




RE: Perl 2 EXE or other problem?

2001-07-03 Thread John Edwards

Check out the Perl2Exe documentation. It's covered in there. If that doesn't
help, mail the writer of Perl2Exe. I've had to do that before and found him
to respond quickly and he was very helpful.

http://www.indigostar.com/pxman.htm

John

-Original Message-
From: Stout, Joel R [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 17:16
To: 'perl beginners '
Subject: Perl 2 EXE or other problem?


I have the following in my script:

use Mail::Sender;

When using Perl2Exe I get the following error:

Warning: module Mail/Sender.config.pm not found

After install of Perl2Exe I ran the sample and it did fine.  The Perl script
runs without warnings and I use (-w; use strict;).  I am using Win32.

Any clues?


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





Re: Re[2]: A Split Question

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, Maxim Berlin wrote:

 Tuesday, July 03, 2001, Brett W. McCoy [EMAIL PROTECTED] wrote:

 Unpack works well with fixed format data like this.
   
Why would you use unpack when this can be easily split apart with a regex?
I'd think unpack would be overkill!
 
  why is it overkill any more that a regex?

 BWM Are you saying we should be using unpack rather than regular expressions?

 mak@freebus/usr/home/makperl t.pl
 Benchmark: timing 10 iterations of regexp, unpack...
 regexp: 15 wallclock secs (14.61 usr +  0.00 sys = 14.61 CPU)
 unpack: 12 wallclock secs (11.17 usr +  0.00 sys = 11.17 CPU)

I did some similar profiling using the Unix time command, and found it was
about even, after about 10 runs each, reading in a file and processing
10,000 dates -- they each averaged a little under 6 seconds each.  Both
actually went to under 5 seconds in a couple of instances, with the unpack
tending to be slightly faster (but not always -- sometimes the regex
version ran faster).

The slight performance gain you might get with unpack doesn't compare to
the flexibility of a regular expression.  If the date style changes to,
say, 02July01 (instead of 2July2001), the regular expression will still
work and the code does not need to be changed.  The code would need to be
modified for the unpack version to continue to work (since it was checking
for the length of the string).  I would prefer the general solution to the
more specific unless the performance gain of the latter is significant.
In this case, it isn't.

-- Brett
http://www.chapelperilous.net/btfwk/

An investment in knowledge always pays the best interest.
-- Benjamin Franklin




Telnet again

2001-07-03 Thread Vrunda Prabhu

Folks
I sent a message earlier asking for help on using Net::Telnet.  I thought,
I'd include my coe in a message.  I would like the telnet session to stay
open till the  user decides otherwise.  Any help is always appreciated.
Thanks 
Vrunda


MY CODE AT PRESENT:

#!/usr/bin/perl
use CGI qw/:standard/;
use Net::Telnet ();
# use Term::Readkey();

$q = new CGI;
$user = $q-param('user');
$pass = $q-param('pass');

$ip = '...';
$t=new Net::Telnet(Prompt='/\[.*\]\$ $/');
$t-open($ip);


$t-login($user, $pass);
@files=$t-cmd(ls -alg);
print Content-type:text/html\n\n;

print html; 
print ol;
foreach $file(@files)
{print li$file\n;}
print /ol;
print /html;
  
$t-close; 




Re: Re[2]: A Split Question

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, Maxim Berlin said:

 my ($month, $day, $year) = /(\d+)(\D+)(\d+)/;

I'd be evil and do:

  my ($mon, $day, $yr) = split /(\D+)/;

Now *that* is quite nice, in my opinion.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Re: Windows2000

2001-07-03 Thread Bryan DeLuca

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Your admin's concern is with the indexing infomation and Webbot 
configuration information that FrontPage keeps in _vti* directories that 
might possibly be overwritten or not updated.  Since FrontPage extended 
servers support DAV and DAV is a standardized extension to HTTP (It is also 
used by the Windows Web Folders feature) you might consider using DAV to 
transfer your files.

On Tuesday 03 July 2001 12:27 am, you scribed:
 Hello everyone:

 We are new to the list and need to find out the following:
 Our server Admin just told us that we are now on Windows2000 with FrontPage
 Extensions installed.
 They warned us about using FTP in order to transfer files. They said FTP
 would corrupt the FrontPage Extensions.

 They advised us to use our Network Places instead for file transfer.

 Does anyone know how we can tell our Windows2000 Professional Operating
 system (Network Places) that it is moving a .pl or .cgi, ect file so that
 we can be sure it does it in ASCII?



 Thanks,
 RL

- -- 

Bryan DeLuca
Kung Foo Master and general all around nice guy.

Public key available at:

ftp://maraca.supakewl.com/pub/bryan_pub.key
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7QfUAeV0gffcWWPYRAtLKAJ9GX0k1fcZo8WVg3+R4KjuU53g3qQCg1X/c
+qZo9EZqG/nnIc1tta4cnrM=
=fApQ
-END PGP SIGNATURE-



Re: Re[2]: A Split Question

2001-07-03 Thread Luke Bakken


  Unpack works well with fixed format data like this.

NB: *fixed format* - i.e. unchanging throughout the data.

 the flexibility of a regular expression.  If the date style changes to,
 say, 02July01 (instead of 2July2001), the regular expression will still

If the date style changed that much, you'd have a lot more than a simple
unpack or regex to change (19100 anyone?).




pointers to subs?

2001-07-03 Thread Pozsar Balazs


Hi all,

I would want to use a hash to keep pointers to functions, and then call
them, but i'm stuck.
So:

I create:
my %funcs=(
one=   \first,
two=   \second);

Then how can I call 'first'? Obviously, using %funcs, i mean :).

thanks,
Balazs Pozsar.
-- 





defining a new line seperator

2001-07-03 Thread charles

i'd like to define a new line separator as a simple blank line. i have
tried \n\n and even tried ^$ in the way of a regex, but to no avail. is
there a metacharacter specific to this?

-cjm




Re: defining a new line seperator

2001-07-03 Thread Pozsar Balazs


$/ is the var for this, so you should say:
 $/=\n\n;

have a nice day.


On Tue, 3 Jul 2001 [EMAIL PROTECTED] wrote:

 i'd like to define a new line separator as a simple blank line. i have
 tried \n\n and even tried ^$ in the way of a regex, but to no avail. is
 there a metacharacter specific to this?

 -cjm


pozsy
-- 





Variable Scope

2001-07-03 Thread Michael Dube

Ok... can someone give me a clue about the issue of variable scoping?  I
have a program that uses a logging module (Log::LogLite), and so I have an
object $log that has a -write method. I have a few custom packages that I
wrote that I want to be able to also write to the logfile.  What is the
syntax to be able to pass this object into the subroutines in my package?

I tried not doing anything and hoping there was magic in having it defined
in the parent module... nope.
$log-write(Got Here);

I tried scoping the variable to the parent by calling it
parent::$log-write... no luck.
parent::$log-write(Got Here);

I tried passing the object as a parm to the subroutine... that didn't work.
my($log) = @_;
$log-write(Got Here);

So... anyone got any suggestions for a perl newby?

Thanks,

Mike




RE: pointers to subs?

2001-07-03 Thread John Edwards

Err, why??

Try this

my %funcs=(
one= \first,
two= \second,
);

sub first {
print First;
}

sub second {
print Second;
}

{$funcs{'one'}};


It's messy and relies on you naming you subroutines to match the static data
stored in %funcs. It will introduce more possible points of failure in the
code, make it harder to debug and maintain. Unless you've got a really good
reason why you need to do this, I'd suggest you don't.

John

-Original Message-
From: Pozsar Balazs [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 17:33
To: [EMAIL PROTECTED]
Subject: pointers to subs?



Hi all,

I would want to use a hash to keep pointers to functions, and then call
them, but i'm stuck.
So:

I create:
my %funcs=(
one=   \first,
two=   \second);

Then how can I call 'first'? Obviously, using %funcs, i mean :).

thanks,
Balazs Pozsar.
-- 



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





Re: pointers to subs?

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, Pozsar Balazs said:

my %funcs=(
one=   \first,
two=   \second);

Then how can I call 'first'? Obviously, using %funcs, i mean :).

There are two (general) ways to dereference arrays, hashes, and functions:

  CREATE REFERENCEARROW SYNTAXSIGIL SYNTAX
  $x = \@array;   $x-[$idx]  $$x[$idx]
  $x = \%hash;$x-{$key}  $$x{$key}
  $x = \function;$x-(@args) $x(@args)

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




quotation marks

2001-07-03 Thread Pozsar Balazs

 The = (fat arrow) auto-quotes the left-hand operand as long as it's a
 bareword.

   foo = 'bar'

 is the same as

   'foo' = 'bar'

And are they the same as:

 foo = bar
 'foo' = bar
 ...
 and so on?

pozsy
-- 





RE: pointers to subs?

2001-07-03 Thread Pozsar Balazs

 The = (fat arrow) auto-quotes the left-hand operand as long as it's a
 bareword.

   foo = 'bar'

 is the same as

   'foo' = 'bar'

And also my experiences show that this auto-quotation applies for {}'s as
well:
 $hash{element} is the same as $hash{element} ?.


Balazs Pozsar.
-- 





Re: pointers to subs?

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, Pozsar Balazs wrote:

 I would want to use a hash to keep pointers to functions, and then call
 them, but i'm stuck.
 So:

 I create:
 my %funcs=(
 one=   \first,
 two=   \second);

 Then how can I call 'first'? Obviously, using %funcs, i mean :).

$funcs{one}-();
$funcs{two}-();

-- Brett
   http://www.chapelperilous.net/btfwk/

An investment in knowledge always pays the best interest.
-- Benjamin Franklin




RE: pointers to subs?

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, John Edwards wrote:

 It's messy and relies on you naming you subroutines to match the static data
 stored in %funcs. It will introduce more possible points of failure in the
 code, make it harder to debug and maintain. Unless you've got a really good
 reason why you need to do this, I'd suggest you don't.

Why do you say that?  I can think of a lot of reasons to create a hash of
function references.

-- Brett
   http://www.chapelperilous.net/btfwk/

An investment in knowledge always pays the best interest.
-- Benjamin Franklin





RE: pointers to subs?

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, Pozsar Balazs wrote:

 What's the difference between these two?:

   %actions = (
 login = \welcome,
 authent = \checkpass,
   );
 and
   %actions = (
 login = \welcome,
 authent = \checkpass,
   );

Nothing.  If you use the = operator, quotes around the keys are not
required.  Quotes are also not required when using single word keys hwne
retrieving a value:

$actions{login}-();

-- Brett
   http://www.chapelperilous.net/btfwk/

An investment in knowledge always pays the best interest.
-- Benjamin Franklin




Re: pointers to subs?

2001-07-03 Thread Michael Fowler

On Tue, Jul 03, 2001 at 01:12:34PM -0400, Brett W. McCoy wrote:
 Nothing.  If you use the = operator, quotes around the keys are not
 required.  Quotes are also not required when using single word keys hwne
 retrieving a value:

With = quotes around the keys are not -always- required.  The quotes are
required if the key isn't an identifier (matched by
/^[A-Za-z_][A-Za-z0-9_]*$/) or a number, or some notable exception.

Consider:

%foo = (
foo-bar =  1,  # tries to subtract 'bar' from 'foo'
-test   =  2,  # key -test
foo()   =  3,  # calls the function foo()
900 =  4,  # key 900
);


So = does what you mean, usually, but it does not always auto-quote its
left side.


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



RE: pointers to subs?

2001-07-03 Thread Paul


--- Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote:
 On Jul 3, John Edwards said:
 
 It's messy and relies on you naming you subroutines to match the
 static data
 stored in %funcs. It will introduce more possible points of failure
 in the
 code, make it harder to debug and maintain. Unless you've got a
 really good
 reason why you need to do this, I'd suggest you don't.
 
 I *strongly* disagree.  If you've never used a dispatch table, you're
 not aware of the power and simplicity they bring.
 
   %actions = (
 login = \welcome,
 authent = \checkpass,
 logout = \cleanup,
 request = \servepage,
   );
 
   if (my $function = $actions{$state}) { $function-(@_) }
   else { die unknown state '$state' }
 
 Dispatch tables (hashes of function references) are a Larry-send. ;)

lol ---
you can also build anonymous functions right into the table, if that
helps you maintain them more easily. 

   %funcs = (
 this = sub { 
 # code for this
 },
 that = sub { 
 # code for that
 },
 foo  = sub { 
 # code for foo
 },
 bar  = sub { 
 # code for bar
 },
   );

   my $key = somethingThatAssignsTheLookupKey();
   $func{$key}-(@funcArgs);



__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



RE: help on perl/tk

2001-07-03 Thread IMutlu

Hey,

When I ran it on windows machine with activestate perl, both frames looked
the same. Do they change size when you fill up the Listboxes?

Also use a loop for your radiobuttons, less code:
#Radiobuttons
foreach (qw/Smarpiece Deckbuild Scholar Discovery Tonyplot Devedit/){
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = $_,
  -value = $_,
  -anchor = 'w',
  -width = 17,
 )-pack;
}

Iso
-Original Message-
From: Jie Meng [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 4:43 PM
To: [EMAIL PROTECTED]
Subject: help on perl/tk


Hello everyone,

I am a newbie on perl/tk. I wrote a code as below, I want to make the size
of
Versions Frame and Manual Frame even, but the versions Frame always
bigger than the Manual Fram, can someone help me out? Thanks.

--
#!/home/jiem/bin/perl -w
use lib /home/jiem/personal/perl/perllib;

use Tk;
use Tk::LabFrame; 

# define variables
my $tool_name = ;
my $version = ;
my $manual = ;

# define main window
my $mw = MainWindow-new;
$mw-geometry (450x300+0+0);
$mw-resizable (0, 0);
$mw-title (Silvaco Tool's World);

# Product list
$prod_frame = $mw-LabFrame (-relief = 'ridge',
 -bd = 1,
 -label = Product List,
 -labelside='acrosstop'
)-pack (-side = 'left', -anchor = 'w', -fill
= 'y');
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = Smartspice,
  -value = Smartspice,
 )-pack;
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = Deckbuild ,
  -value = Deckbuild,
 )-pack;
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = Scholar   ,
  -value = Scholar,
 )-pack;
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = Discovery ,
  -value = Discovery,
 )-pack;
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = Tonyplot  ,
  -value = Tonyplot,
 )-pack;
$prod_frame-Radiobutton (-relief = 'flat',
  -variable=\$tool_name ,
  -text = Devedit   ,
  -value = Devedit,
 )-pack;

# Bottom Frame
$bot_frame = $mw-Frame (-relief = 'ridge',
 -bd = 1,
 )-pack (-side = 'bottom', -anchor = 's', -fill
= 'x');
$run_button = $bot_frame-Button (-text = Run,
  -command = sub { exit; },
  -relief = ridge,
 )-pack (-side = 'left', -expand = 1);
$manual_button = $bot_frame-Button (-text = Manual,
 -command = sub { exit; },
 -relief = ridge,
)-pack (-side = 'left', -expand = 1);

$exit_button = $bot_frame-Button (-text = Quit,
  -command = sub { exit; },
  -relief = ridge,
  )-pack (-side = 'left', -expand = 1);
  
# Versions Frame
$ver_frame = $mw-LabFrame (-bd = 1,
-label = Versions,
-labelside='acrosstop'
   )-pack (-side = 'left', -expand = 1, -fill =
'both');
$ver_listbox = $ver_frame-Scrolled (Listbox,
 -scrollbars =e,
)-pack(-fill = 'both', -expand = 1);

# Manual Frame
$man_frame = $mw-LabFrame (-bd = 1,
-label = Manual,
-labelside='acrosstop'
   )-pack (-side = 'right', -expand = 1, -fill =
'both'); 
$man_listbox = $man_frame-Scrolled (Listbox,
 -scrollbars =e,
)-pack(-fill = 'both', -expand = 1);

MainLoop;




Get free email and a permanent address at http://www.amexmail.com/?A=1



Re: pointers to subs?

2001-07-03 Thread Jos I. Boumans

For completeness, the arrow stringifies LHS *almost* always...

If your keys start with a number, but also have other characters following
them, or are just completely 'odd' (ie, \W), you must quote them.

For example:
%foo = ( 34foo = bar );
or even
%foo = ( '#)$*.#@' = bar );

note that double quotes allow intperlolation, whereas single quotes don't
and of course, the second case may be concidered Very Bad Thing To Do (tm);
keep your hash keys at least half way sane.

read more about these things at: http://www.sharemation.com/~perl/tut

hth,

Jos Boumans


- Original Message -
From: Brett W. McCoy [EMAIL PROTECTED]
To: Pozsar Balazs [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 7:12 PM
Subject: RE: pointers to subs?


 On Tue, 3 Jul 2001, Pozsar Balazs wrote:

  What's the difference between these two?:
 
%actions = (
  login = \welcome,
  authent = \checkpass,
);
  and
%actions = (
  login = \welcome,
  authent = \checkpass,
);

 Nothing.  If you use the = operator, quotes around the keys are not
 required.  Quotes are also not required when using single word keys hwne
 retrieving a value:

 $actions{login}-();

 -- Brett
http://www.chapelperilous.net/btfwk/
 
 An investment in knowledge always pays the best interest.
 -- Benjamin Franklin






Re: quotation marks

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, Paul said:

foo = 'bar'
'foo' = 'bar'
 
 And are they the same as:
 
  foo = bar
  'foo' = bar

Those aren't the same.
$foo is very different from '$foo'
I think = does interpolative double-ish quoting, doesn't it?

= does no interpolation.  None is possible/required.  A bareword is
matched by

  /^[A-Za-z_]\w*/

So there's no interpolation needed.

NOTE: -foo is a NOT bareword.  The unary - before that which WOULD be a
bareword makes it NOT a bareword.

NOTE 2: This is cool:

  print -foo; # -foo
  # print --foo;  # SYNTAX ERROR
  print +-foo;# -foo
  print -+-foo;   # +foo

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




MYSQL

2001-07-03 Thread Ryan Gralinski

My mail got all deleted by accident can someone please tell me the site
that had info on Databases (mysql) and accesing them from perl.

RYan





Re: quotation marks

2001-07-03 Thread Paul


--- Jeff 'japhy' Pinyan [EMAIL PROTECTED] wrote:
 On Jul 3, Paul said:
 
 foo = 'bar'
 'foo' = 'bar'
  
  And are they the same as:
  
   foo = bar
   'foo' = bar
 
 Those aren't the same.
 $foo is very different from '$foo'
 I think = does interpolative double-ish quoting, doesn't it?
 
 = does no interpolation.  None is possible/required.  A bareword is
 matched by
 
   /^[A-Za-z_]\w*/
 
 So there's no interpolation needed.

Good to know. Rather than interpolate, it just doesn't quote things
that would require interpolation. Makes sense.

 NOTE: -foo is a NOT bareword.  The unary - before that which WOULD be
 a bareword makes it NOT a bareword.
 
 NOTE 2: This is cool:
 
   print -foo; # -foo
   # print --foo;  # SYNTAX ERROR
   print +-foo;# -foo
   print -+-foo;   # +foo

This hurts my head.
If it's not a bareword, not a keyword, etc., would you say the unary
minus is quoting it? What gives?

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Re: MYSQL

2001-07-03 Thread Chas Owens

On 04 Jul 2001 01:45:23 -0400, Ryan Gralinski wrote:
 My mail got all deleted by accident can someone please tell me the site
 that had info on Databases (mysql) and accesing them from perl.
 
 RYan
 
 
 

Luckily for you there is an archive of the list on the web:
http://archive.develooper.com/beginners%40perl.org/

--
Today is Prickle-Prickle, the 38th day of Confusion in the YOLD 3167
P'tang!





Re: quotation marks

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, Paul said:

 NOTE: -foo is a NOT bareword.  The unary - before that which WOULD be
 a bareword makes it NOT a bareword.

Correction: -foo is NOT a bareword.  It is a unary - in front of a
bareword.

From perlop:

 Unary - performs arithmetic negation if the operand is
 numeric.  If the operand is an identifier, a string
 consisting of a minus sign concatenated with the identifier
 is returned.  Otherwise, if the string starts with a plus or
 minus, a string starting with the opposite sign is returned.
 One effect of these rules is that -bareword is equivalent to
 -bareword.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Problem with llama book script

2001-07-03 Thread Customer Service

O enlightened ones, here is my question:
I am going through the llama book  (which, by the way, is the most useful
tool
I have bought so far for perl reference) in order to learn perl.  On page 10
is a simple script which I copied and have attempted to execute for the last
1/2 hour.  Please tell me what is wrong!
I'm using ActiveStatePerl5.6.1 and Apache web server on M$ win98se.

##perl script   file name: gradation.pl ##
#!c:/perl/bin/perl -w

open(GRADES, c:\perl\eg\grades.txt) or die Can't open grades: $!\n;
while ($line = GRADES) {
($student, $grade) = split( , $line);
$grades{$student} .= $grade .  ;
}

foreach $student (sort keys %grades) {
$scores = 0;
$total = 0;
@grades = split( , $grades{$student});
foreach $grades (@grades) {
$total += $grade;
$scores++;
}
$average = $total / $scores;
print $student: $grades{$student}\tAverage: $average\n;
}

# my text file is as follows, and is called grades.txt in same path as
gradation.pl

Noel  25
Ben  76
Clementine  49
Norm  66
Chris  92
Doug  42
Carol  25
Ben  12
Clementine  0
Norm  66
...

# Resulting error messages

Unrecognized escape \p passed through at c:\perl\eg\gradation.pl Line 3
Unrecognized escape \g passed through at c:\perl\eg\gradation.pl Line 3
Can't open grades: No such file or directory
# That's it #


Thanks for any help.
Standing by with a water hose,
Nathan




Re: Problem with llama book script

2001-07-03 Thread Francis Henry

i'm a newbie too, but try this-

use slashes instead of backslashes, perl sees backslashes as escapes, so this:
open(GRADES, c:\perl\eg\grades.txt) or die Can't open grades: $!\n;

should be:
open(GRADES, c:/perl/eg/grades.txt) or die Can't open grades: $!\n;

lemme know if that helps!

Customer Service wrote:

 O enlightened ones, here is my question:
 I am going through the llama book  (which, by the way, is the most useful
 tool
 I have bought so far for perl reference) in order to learn perl.  On page 10
 is a simple script which I copied and have attempted to execute for the last
 1/2 hour.  Please tell me what is wrong!
 I'm using ActiveStatePerl5.6.1 and Apache web server on M$ win98se.

 ##perl script   file name: gradation.pl ##
 #!c:/perl/bin/perl -w

 open(GRADES, c:\perl\eg\grades.txt) or die Can't open grades: $!\n;
 while ($line = GRADES) {
 ($student, $grade) = split( , $line);
 $grades{$student} .= $grade .  ;
 }

 foreach $student (sort keys %grades) {
 $scores = 0;
 $total = 0;
 @grades = split( , $grades{$student});
 foreach $grades (@grades) {
 $total += $grade;
 $scores++;
 }
 $average = $total / $scores;
 print $student: $grades{$student}\tAverage: $average\n;
 }

 # my text file is as follows, and is called grades.txt in same path as
 gradation.pl

 Noel  25
 Ben  76
 Clementine  49
 Norm  66
 Chris  92
 Doug  42
 Carol  25
 Ben  12
 Clementine  0
 Norm  66
 ...

 # Resulting error messages

 Unrecognized escape \p passed through at c:\perl\eg\gradation.pl Line 3
 Unrecognized escape \g passed through at c:\perl\eg\gradation.pl Line 3
 Can't open grades: No such file or directory
 # That's it #

 Thanks for any help.
 Standing by with a water hose,
 Nathan



Re: Reference found where even-sized list expected

2001-07-03 Thread Paul


--- Pozsar Balazs [EMAIL PROTECTED] wrote:
 
 hi again,
 
 I get this warning:
 Reference found where even-sized list expected at ./n.pl line 94.

It usually means you're using {} instead of () to assign hash values.
=o)

 when running my script, and i don't understand what does it mean.
 Please explain. Here are the relevant lines:
 
 94:   my %args = {

yep. --^

 95:   descriptor  =  /usr/lib/nitro/all.xml,
 96:   build   =  {
 97:   cleanup =  1,
 98:   bindir  =  $origwd/binaries
 99:   }
 100:  };
^

{} is the anonymous hash constructor; it returns a reference to hash
space that it allocates. You've created a hash with no name, and
returned a reference to it to be stored in %args, which expects a key
AND a value.

Use () instead of {} and it'll do what you wanted.

__
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/



Re: Problem with llama book script

2001-07-03 Thread Jos I. Boumans

you might want to avoid the complexity here and just say:
open(GRADES, grades.txt);

your problem are the \ marks... you'll need to use \\ in your example,
seeing that \ is the escape character
iirc, you can use / in perl paths too, even on a windows machine, but i'm
not 100% on that one.

try it and tell us if it works

Jos Boumans

 open(GRADES, c:\perl\eg\grades.txt) or die Can't open grades: $!\n;

 # my text file is as follows, and is called grades.txt in same path
as
 gradation.pl




Re: Reference found where even-sized list expected

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, Pozsar Balazs wrote:

 I get this warning:
 Reference found where even-sized list expected at ./n.pl line 94.

 when running my script, and i don't understand what does it mean.
 Please explain. Here are the relevant lines:

 94:   my %args = {
 95:   descriptor  =  /usr/lib/nitro/all.xml,
 96:   build   =  {
 97:   cleanup =  1,
 98:   bindir  =  $origwd/binaries
 99:   }
 100:  };

You are using braces where you should be using parentheses.  The curly
braces are used when you are creating an anonymous hash, as you do
correctly for the binddir key.

my %args = (
#hash values
);
   http://www.chapelperilous.net/btfwk/

An investment in knowledge always pays the best interest.
-- Benjamin Franklin




Re: Windows2000

2001-07-03 Thread RL Autry

At 05:15 AM 7/3/2001, Aaron Craig wrote:
  ie, you've got nothing to worry about :)

Thanks Aaron that helps more than you know.

I keep replying to these posts but it is not going to the list.
It is going to the individual who sent it. People have suggested
that I reply to the list so I can get more help on this. But when
I click reply it addresses it to the individual. So this time I clicked
on reply to all. That seems to be the only way I can get a message
in the form of a reply to the list.

Am I doing something wrong or is that just the way this list works?

Thanks,
RL




Re: Editor

2001-07-03 Thread Tyler Longren

Context is my choice:
http://www.fixedsys.com/context/

Tyler

- Original Message -
From: Bill Pierson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 2:33 PM
Subject: Editor


Hello again, all.

May I get some suggestions for any Windows-based PERL development tools?
Preferably, free ones?

Thanks,
--Bill






Re: Windows2000

2001-07-03 Thread RL Autry

At 11:38 AM 7/3/2001, Bryan DeLuca wrote:
  Since FrontPage extended
servers support DAV and DAV is a standardized extension to HTTP (It is also
used by the Windows Web Folders feature) you might consider using DAV to
transfer your files.

What does DAV stand for and how do I use it?

RL




Re: Editor

2001-07-03 Thread Luke Bakken

www.vim.org


On Tue, 3 Jul 2001, Bill Pierson wrote:

 Hello again, all.

 May I get some suggestions for any Windows-based PERL development tools? Preferably, 
free ones?

 Thanks,
 --Bill






Re: Reference found where even-sized list expected

2001-07-03 Thread Brett W. McCoy

On Tue, 3 Jul 2001, Brett W. McCoy wrote:

 You are using braces where you should be using parentheses.  The curly
 braces are used when you are creating an anonymous hash, as you do
 correctly for the binddir key.

Sorry, I meant the build key. :-)

-- Brett





Re: Windows2000

2001-07-03 Thread Casey West

On Tue, Jul 03, 2001 at 02:45:20PM -0500, RL Autry wrote:
: At 05:15 AM 7/3/2001, Aaron Craig wrote:
:   ie, you've got nothing to worry about :)
: 
: Thanks Aaron that helps more than you know.
: 
: I keep replying to these posts but it is not going to the list.
: It is going to the individual who sent it. People have suggested
: that I reply to the list so I can get more help on this. But when
: I click reply it addresses it to the individual. So this time I clicked
: on reply to all. That seems to be the only way I can get a message
: in the form of a reply to the list.
: 
: Am I doing something wrong or is that just the way this list works?

You are doing this correctly.  It is the way this list (and every
  other list on perl.org and many, many others work).

  Casey West

-- 
Shooting yourself in the foot with MS-Windows
The gun blows up in your hand.



error

2001-07-03 Thread RL Autry

Can someone go here and tell me what this error message means in English?
I am still learning Perl, English I know --- well kinda ---  LOL


http://www.cyberdzyns.com/cgi-bin/wsearch.pl

Thanks,
RL




RE: Reference found where even-sized list expected

2001-07-03 Thread Ross, Jonathan C.


 I get this warning:
 Reference found where even-sized list expected at ./n.pl line 94.
 
 when running my script, and i don't understand what does it mean.
 Please explain. Here are the relevant lines:
 
 94:   my %args = {
 95:   descriptor  =  /usr/lib/nitro/all.xml,
 96:   build   =  {
 97:   cleanup =  1,
 98:   bindir  =  $origwd/binaries
 99:   }
 100:  };
 

You've declared %args as a hash, so Perl expects the initializer to be
a list of key,value pairs:

%h = (a = 1, b = 2);

$x = $h{'a'};   # $x gets 1

Instead, you've provided a hash reference.  Perl sees that as a key in
the initializer list, and it wants the value (hence the even-sized
list error.)

References are scalar values, so use $args, not %args, e.g.

$h = {a = 1, b = 2);

$x = $h-{'a'}; # $x gets 1

Regards,
Jonathan



Re: error

2001-07-03 Thread Jos I. Boumans

means you have either 'use uid' or 'require uid' or something of the like in
your script at line 3

check it for errors...

Jos

- Original Message -
From: RL Autry [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, July 03, 2001 9:55 PM
Subject: error


 Can someone go here and tell me what this error message means in English?
 I am still learning Perl, English I know --- well kinda ---  LOL


 http://www.cyberdzyns.com/cgi-bin/wsearch.pl

 Thanks,
 RL






Re: Windows2000

2001-07-03 Thread Chas Owens

Hit reply to all.  Also consider removing the other addresses.

On 03 Jul 2001 14:45:20 -0500, RL Autry wrote:
 At 05:15 AM 7/3/2001, Aaron Craig wrote:
   ie, you've got nothing to worry about :)
 
 Thanks Aaron that helps more than you know.
 
 I keep replying to these posts but it is not going to the list.
 It is going to the individual who sent it. People have suggested
 that I reply to the list so I can get more help on this. But when
 I click reply it addresses it to the individual. So this time I clicked
 on reply to all. That seems to be the only way I can get a message
 in the form of a reply to the list.
 
 Am I doing something wrong or is that just the way this list works?
 
 Thanks,
 RL
 
 
--
Today is Prickle-Prickle, the 38th day of Confusion in the YOLD 3167
Frink!





Re: error

2001-07-03 Thread Jeff 'japhy' Pinyan

On Jul 3, RL Autry said:

Can someone go here and tell me what this error message means in English?
I am still learning Perl, English I know --- well kinda ---  LOL

CGI Error
The specified CGI application misbehaved by not returning a complete set
of HTTP headers. The headers it did return are:

Can't locate uid in @INC (@INC contains: F:/Perl/lib F:/Perl/site/lib
.) at d:\63.249.246.195\cgi-bin\wsearch.pl line 3.

You did something like:

  require uid;

I don't know why.

-- 
Jeff japhy Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk?  http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
**  Manning Publications, Co, is publishing my Perl Regex book  **




Re: Windows2000

2001-07-03 Thread Bryan DeLuca

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Check out.

http://www.webdav.org

- From the site:

WebDAV stands for Web-based Distributed Authoring and Versioning. 
It is a set of extensions to the HTTP protocol which allows users to 
collaboratively edit and manage files on remote web servers. 

Here is the part that you probably want to look at:

http://www.webdav.org/perldav/

I think that WebDAV is pretty darn cool.  Hope this helps.

On Tuesday 03 July 2001 02:49 pm, RL Autry scribed:
 At 11:38 AM 7/3/2001, Bryan DeLuca wrote:
   Since FrontPage extended
 servers support DAV and DAV is a standardized extension to HTTP (It is
  also used by the Windows Web Folders feature) you might consider using
  DAV to transfer your files.

 What does DAV stand for and how do I use it?

 RL

- -- 

Bryan DeLuca
Kung Foo Master and general all around nice guy.

Public key available at:

ftp://maraca.supakewl.com/pub/bryan_pub.key
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7QinheV0gffcWWPYRAufJAJ460BRo+ln/Z+DuVsiWmJ9+xCTUHwCgjkGt
XS7PXHLdTOA5NWA+C54uYdM=
=dUeF
-END PGP SIGNATURE-



Re[4]: A Split Question

2001-07-03 Thread Maxim Berlin

Hello Brett,

Tuesday, July 03, 2001, Brett W. McCoy [EMAIL PROTECTED] wrote:

 Unpack works well with fixed format data like this.
   
Why would you use unpack when this can be easily split apart with a regex?
I'd think unpack would be overkill!
 
  why is it overkill any more that a regex?

 BWM Are you saying we should be using unpack rather than regular expressions?
[...]

BWM The slight performance gain you might get with unpack doesn't compare to
BWM the flexibility of a regular expression.  If the date style changes to,
BWM say, 02July01 (instead of 2July2001), the regular expression will still
BWM work and the code does not need to be changed.  The code would need to be
BWM modified for the unpack version to continue to work (since it was checking
BWM for the length of the string).  I would prefer the general solution to the
BWM more specific unless the performance gain of the latter is significant.
BWM In this case, it isn't.

in  my  opinion, regexp's is the slowest way to do something - payment
for flexibility. but, in most cases, speed grows very little and growing
does not matter.

btw,  unpack  isn't  faster method for fixed strings parsing. everyone
can throw rock at me, but substr works faster :)

   'subst' = sub {

   my ( $month, $day, $year );
   my $a;
   for my $date (@dates)
   {
my $j=0;
$day = substr ( $date, $j++, 1 );
$a   = substr ( $date, $j, 1 );
if ( ord($a) = 57 )
{
  $day .= $a;
  $j++;
}

$month .= substr ( $date, $j, 3 );
$year   = substr ( $date, $j+3, 4 );
   }
   }


Best wishes,
 Maximmailto:[EMAIL PROTECTED]





RE: Reference found where even-sized list expected

2001-07-03 Thread Grant McLean

 From: Pozsar Balazs [mailto:[EMAIL PROTECTED]]

 I get this warning:
 Reference found where even-sized list expected at ./n.pl line 94.

Plenty of people have given you translations of the error message,
hopefully changing the curly brackets to round brackets has fixed 
your problem.

I just wanted to point out that if you're having trouble 
understanding a Perl error message, it might help to include this
line near the top of your script:

  use diagnostics;

This tells Perl to augment errors and warnings with more verbose
explanations of what went wrong.  In your case it would have said:

  Reference found where even-sized list expected at ./n.pl line 94.
(W misc) You gave a single reference where Perl was expecting a list
with an even number of elements (for assignment to a hash). This usually
means that you used the anon hash constructor when you meant to use
parens. In any case, a hash requires key/value pairs.

%hash = { one = 1, two = 2, };# WRONG
%hash = [ qw/ an anon array / ];# WRONG
%hash = ( one = 1, two = 2, );# right
%hash = qw( one 1 two 2 );  # also fine

Which may or may not have helped :-)

Regards
Grant

=
Grant McLean   | email: [EMAIL PROTECTED] | Lvl 6, BP House
The Web Limited| WWW:   www.web.co.nz| 20 Customhouse Quay
Internet Solutions | Tel:   +64 4 495 8250   | Box 1195, Wellington
Awesome service| Fax:   +64 4 495 8259   | New Zealand






RE: Editor

2001-07-03 Thread Kris G Findlay


i use synedit its free and very good !! check out www.mkidesign.com or
http://synedit.hypermart.net
-Original Message-
From: Luke Bakken [mailto:[EMAIL PROTECTED]]
Sent: 03 July 2001 20:35
To: Bill Pierson
Cc: [EMAIL PROTECTED]
Subject: Re: Editor


www.vim.org


On Tue, 3 Jul 2001, Bill Pierson wrote:

 Hello again, all.

 May I get some suggestions for any Windows-based PERL development tools?
Preferably, free ones?

 Thanks,
 --Bill







pack function

2001-07-03 Thread Jia Fu Cen

Hi:

Anybody know how the '@' parameter works for the pack function?
Specifically, I'm looking to use the function to pack integer values 
(short's and long's too).
A few good examples would be greatly appreciated.

Thanks,
Jia Fu




Re: error

2001-07-03 Thread Chas Owens

perldoc perlport has a lot of good info about cross platform Perl.

On 03 Jul 2001 17:12:46 -0500, RL Autry wrote:
 At 03:13 PM 7/3/2001, Jeff 'japhy' Pinyan wrote:
 You did something like:
 
require uid;
 
 I don't know why.
 
 
 This was originally on a UNIX machine.
 How can you know when you have a script that will work with your operating 
 system?
 In this case Windows2000 Server.
 
 
 
 Thanks,
 RL
 
 
--
Today is Prickle-Prickle, the 38th day of Confusion in the YOLD 3167
Pzat!





Help !

2001-07-03 Thread Amir Hejazi


Friends,
Perl on Solaris question.
I need a simple example with actual codes to use sendmail and send an
existing file,
i.e. /etc/hosts to an address i.e. [EMAIL PROTECTED] , from within a perl
program.
In other words I need the actual code in a perl to send /etc/hosts to a
user.

Thanks ... Amir.





Re: Help !

2001-07-03 Thread Paul Johnson

On Tue, Jul 03, 2001 at 03:12:30PM -0700, Amir Hejazi wrote:

 In other words I need the actual code in a perl to send /etc/hosts to a
 user.

You'll find lots of people here who are willing to spend time helping
you to learn Perl, but I don't know that you'll find any who will be
willing to just do your work for you.

If you are wanting to learn Perl, let us know how far you have got.  If
you have any code, post it.  If you have problems with any particular
aspects of this job, be more specific.  If you just want the job done,
ask for a quote.

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



Re: Help !

2001-07-03 Thread Paul Johnson

On Tue, Jul 03, 2001 at 03:57:54PM -0700, Amir Hejazi wrote:
 I just wanted to save people some time.
 To answer your question, I have been in 2 perl programming classes and doing
 some light
 perl scripting for couple of years to do my sysadmin tasks.
 Now , I need to send a file which is generated by some other part of the
 codes to a
 specific user, I tried so many different ways of invoking
 /usr/lib/sendmail within
 my script with on avail, I downloaded the Mail::Mailer module from CPAN and
 I used
 it the same way the Perl Cookbook instructs and I am getting the
 following:
 Can't locate object method new via package Mail::Mailer.
 Please refer to Page 650-653 of O'Reilly's Perl Cookbook.

Now we're getting somewhere!  Unfortunately, I don't have access to the
Cookbook at the moment, but I'll do a bit of guessing.  If I'm wrong or
you need extra help it will probably be worth your while to actually
post your code.

My guess is that you have forgotton the line

  use Mail::Mailer;

near the top of your program, and that you are using a version
of Perl  5.6.1 which is the current stable version.  That's probably
not a problem as long as it's not too old.

 Also I would appreciate a quote for a simple , few lines, perl script that
 sends a
 file to a user .

I suspect you'll get it for free if you're willing to be a party to its
creation.  For my part, I wouldn't bother with anything so small on a
commercial basis.  I've already spent more time writing mail than I
would writing the program :-)  Others may feel differently.

 Thanks ... Amir.

Sorry if my first message seemed a little curt.  You came across as
wanting a solution without investing any effort.  I'm glad to see that's
not the case.

Next time, you may find it to your advantage to use a more descriptive
subject line and provide as many details as you can.  That way you'll be
much more likely to receive the help you're after.

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



Getopt::STD

2001-07-03 Thread charles

I've read through
http://search.cpan.org/doc/JHI/perl-5.7.1/lib/Getopt/Std.pm

and it seems as though the following syntax should work:

getopt(nh,\%option);

however, it does not. when i use getopts rather than getopt

getopts(nh,\%option);

it does work. did i misread the cpan page that i referenced?




  1   2   >