Re: SV: Module to encrypt/store/retrieve/decrypt passwords

2006-06-23 Thread DZ-Jay
On Jun 23, 2006, at 05:10, Henrik Schak Hansen wrote: > I have username/passwords in a database which dosn't offer a > encryption function, so I encrypt the password using perl, but the key > is stored in a text file, so if anybody get access to the server they > would be able to retrieve all

Re: auto-detecting file encoding

2006-06-19 Thread DZ-Jay
Hello: The problem is that Unicode files do not have contain the byte mark header, and in fact, the ones I'm attempting to decode, don't. As I said before, most of them are Windows-1252, some of them are Latin-1, and still some are UTF-8 -- without a special byte mark. The problem is that o

Re: auto-detecting file encoding

2006-06-19 Thread DZ-Jay
On Jun 18, 2006, at 22:06, Jerry Yang wrote: Hi, The file in UTF-8 should have a BOM like this "EF BB BF" Bytes Encoding Form 00 00 FE FF UTF-32, big-endian FF FE 00 00 UTF-32, little-endian FE FF UTF-16, big-endian FF FE UTF-16, little-endian EF BB BF UTF-8 Should, but don't have t

Re: date manipulation

2006-05-26 Thread DZ-Jay
If it is a flat-file type of database, and the dates are in a recognizable and consistent format, you could use a regexp to do it really quick. By the way, why would you want to change a date from last century to the current? Just curious. dZ. On May 26, 2006, at 03:56, Eko Budihart

Re: Ordering HASH

2006-05-25 Thread DZ-Jay
On May 25, 2006, at 02:05, <[EMAIL PROTECTED]> wrote: Hi I am trying to order the keys of a hash in the order it was added .i.e, I am adding elements in the hash one by one and I want the printing of the hash in the same order what should I do to get this happening I thought of adding a coun

Re: creating an excel file

2006-04-08 Thread DZ-Jay
On Apr 8, 2006, at 00:03, Eko Budiharto wrote: hi, I would like to import some data from mysql and write into an excel file. Do you mind if you can tell me which module I can use to do that? I read in the cpan.org, but I am not sure which one I should use. There are Spreadsheet::WriteE

Re: ot - cgi & perl & processes

2006-04-07 Thread DZ-Jay
On Apr 6, 2006, at 15:29, Hon Shi wrote: Yah, ot I know, but who else writes CGIs but perl guys? :-) "However, the CGI model has an important drawback: a web server that wants to use a CGI program must call a new copy in responce to every incoming web request." With respect to perl, is tha

Re: foreach question

2006-04-07 Thread DZ-Jay
On Apr 6, 2006, at 15:25, Conrad, Bill (ThomasTech) wrote: I thought that Perl had another internal variable that contained the numerical index of each array entry without having to count them. I guess what I thought was happening internally was that Perl was maintaining an index of @L

Re: Flocking a DBM files

2006-02-07 Thread DZ-Jay
Peter Scott wrote: On Mon, 06 Feb 2006 11:36:49 -0500, DZ-Jay wrote: I've been using for a while the locking mechanism for DBM files described in the Perl Cookbook, recipe 14.5, basically, locking the filehandle returned by tie: $db = tie() $fd = $db-fd; open(

Re: Flocking a DBM files

2006-02-07 Thread DZ-Jay
On Feb 6, 2006, at 17:57, David Nicol wrote: i used to always open a separate file explicitly for locking, and flock that file, instead of fooling around with db internals. DBM, in particular, opens two files. Which one, if either, does tie() return? What if you switch to a database that do

Flocking a DBM files

2006-02-06 Thread DZ-Jay
Hello: I've been using for a while the locking mechanism for DBM files described in the Perl Cookbook, recipe 14.5, basically, locking the filehandle returned by tie: $db = tie() $fd = $db-fd; open(DB_FH, "+<&=$fd") or die(...); flock(DB_FH); ... But I have rea

Re: Strange behaviour in Perl

2006-01-25 Thread DZ-Jay
Arijit Das wrote: > I am just wondering why is this giving a strange result. Any clues...? > > bash-2.01$ echo 4.56 | perl -p -e 'my $var1 = ; $var2 = $var1 * 100; print $var2;' > 04.56 > bash-2.01$ > > I am expecting 456 in the ouput instead of 4.56 > > Am I missing anything...? > Remov

Re: [Perl-unix-users] Strange behaviour in Perl

2006-01-25 Thread DZ-Jay
Arijit Das wrote: I am just wondering why is this giving a strange result. Any clues...? This is from the Perl In A Nutshell book: -- -p: Causes Perl to assume the following loop around your script, which makes it iterate over filename arguments: LINE: while (<>) { .

Re: How do I set a Sockets underlying receive buffer size?

2006-01-24 Thread DZ-Jay
On Jan 23, 2006, at 23:54, <[EMAIL PROTECTED]> wrote: my $rcv_buf_size = $s->sockopt($SOCKET::SO_RCVBUF); I don't think that $ goes in SO_RCVBUF, as I believe it is a constant, and thus works as a parameter-less sub. Try this: my $rcv_buf_size = $s->sockopt(SO_RCVBUF); dZ. ___

Re: ignoring exceptions

2006-01-19 Thread DZ-Jay
DZ-Jay wrote: Yes. And as a bonus, I don't have to separate the sections by commas because each block will be executed in turn, and its return value (usually 1, or maybe even a reference to its closure) is taken as an argument to the previous block, so try {} CATCH {} FINALLY {}; i

Re: ignoring exceptions

2006-01-19 Thread DZ-Jay
David Nicol wrote: On 1/19/06, DZ-Jay <[EMAIL PROTECTED]> wrote: Hello: This might sound like a stupid question, I'm guessing that your current syntax works because you have declared prototypes for CATCH and POST of (\&) which coerces the block given as their arguments

ignoring exceptions

2006-01-19 Thread DZ-Jay
Hello: This might sound like a stupid question, but I thought I'd ask anyway just in case there is some hidden magic in Perl that I am not aware of. My question is this: I am attempting to write an Exception handler class for Perl 5.x (don't ask why, lets just say its an experiment or test

Re: flocking IO::Files

2006-01-05 Thread DZ-Jay
Brian Raven wrote: However, before you start creating your own derived class I suggest you check whether somebody has already done it. If you check CPAN (www.cpan.org) you will find IO::File::flock for example. HTH Thanks, that's what I thought, yet they implemented support to fcntl() and io

flocking IO::Files

2006-01-04 Thread DZ-Jay
Hello: I was looking at the IO::File and IO::Handle documentation and noticed that, even though it includes a front-end to most built-in functions that operate on filehandles, it does not mention flock at all. Furthermore, the source code to IO::Handle has this: #

Re: Best module for sending e-mail?

2005-12-27 Thread DZ-Jay
On Dec 27, 2005, at 16:13, Brian H. Oak wrote: Thanks for the suggestion, but Mail::Sender fails pretty soon down the list of requirements: Mail::Sender can only send mail to a server on port 25/TCP. As far as I can tell, Mail::Sender only fulfills the first item on the requirements list. Th

Re: Passing arguments by value

2005-12-15 Thread DZ-Jay
[EMAIL PROTECTED] wrote: I've been following this debate all week and noticed one thing missing... No-one has mentioned that it's bad programming practice to rely on a sub to modify an argument. If you want to modify a value, it should be explicitly returned, viz.: sub add_one { my $in_var =

Re: Help splitting fields with regexp

2005-12-15 Thread DZ-Jay
[EMAIL PROTECTED] wrote: ok. well i don't have formal reg exp training,. i've used an oreilly pres book to teach myself and have been told by others that i seem really good with them. considering what i've seen here, Brian Raven and Bill Luebkert are both much better and also explain VERY well.

Re: Setting File and Directory Group and Permissions via Net::FTP

2005-12-13 Thread DZ-Jay
[EMAIL PROTECTED] wrote: As the destination is a linux system I would look into the umask of the destination folder. Some FTP server also have their own umask settings which will force all new files to that permissions setting on creation. Permissions can be changed after the fact of course. M

Re: Setting File and Directory Group and Permissions via Net::FTP

2005-12-13 Thread DZ-Jay
Cutts III, James H. wrote: I can't seem find out how to change the permissions via the Net::FTP module. I can do it manually from the command line via the chgmod command but that defeats the purpose of automation. From the Net::FTP man page: START: quot (CMD [,ARGS]) Send a command,

Re: Help splitting fields with regexp

2005-12-12 Thread DZ-Jay
On Dec 12, 2005, at 07:51, Brian Raven wrote: First, could you modify your posting style. It is impossible to determine from the above who said what. Sorry, I just noticed this. I was having problems posting from my mail client and I copy+pasted the source of the message into an SMTP telnet

Re: Help splitting fields with regexp

2005-12-12 Thread DZ-Jay
Reposting with quotes include (sorry!). See below. On Dec 12, 2005, at 04:40, $Bill Luebkert wrote: DZ-Jay wrote: But I did specify the rules: 1. Split on a specified delimiter (for the moment I'm aiming for [,;]), but ideally I would like it to be variable. 2. As opposed to CSV

Re: Help splitting fields with regexp

2005-12-12 Thread DZ-Jay
On Dec 12, 2005, at 08:53, [EMAIL PROTECTED] wrote: DZ- reg exp is greedy by default, but perl has a modifier to stop that. Thanks, I was aware of that. haven't tested to prove that works correctly, but in theory it should. ? immediately after * or + will make it non-greedy I forgot to m

Re: Help splitting fields with regexp

2005-12-11 Thread DZ-Jay
On Dec 11, 2005, at 09:06, $Bill Luebkert wrote: DZ-Jay wrote: Pretty ingenious, albeit a bit of cheating, uh? :) but if all else fails, I'll probably go with that, thanks! I still wonder if there is a single regexp that could do what I want, and if so, I'd like to learn about it.

Re: Help splitting fields with regexp

2005-12-11 Thread DZ-Jay
On Dec 10, 2005, at 22:54, $Bill Luebkert wrote: $_ = q{"LastName, First Name" , "Name" , ; FirstName LastName, address; "First \"nick\" Last" address}; s/\\"/\003/g; # handle embedded \" s/"([^"]+)"/\001$1\002/g;# handle open/close

Re: Passing arguments by value

2005-12-10 Thread DZ-Jay
On Dec 10, 2005, at 05:30, Joseph C. Bautista wrote: Sorry bill for the lack of sample on my part. But I was wondering if its possible to PERL to pass an argument "byref" or "byval" like that of visual basic Perhaps a bit of an explanation will help clarify. Yes, it is possible, though its

Re: Module Locations

2005-12-02 Thread DZ-Jay
Hello: There are two things you can do: 1. Add the current directory to the @INC array in the command line: C:\current\dir\whateverscript.pl -I c:/current/dir (This also works in the she-bang line: #! /usr/bin/perl -I c:/current/dir 2. Add the current directory to the

Re: Perl NET::FTP limitations

2005-12-01 Thread DZ-Jay
use Archive::Zip dZ. Mittal, Manish wrote: Is there a way to archive the files from perl? These files are traded twice and sometimes thrice daily. Manish -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dr.Ruud Sent: Wednesday, November 30,