RE: eval problem
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: 01 October 2001 15:16 > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: eval problem > > > > > Hi everybody, > > I am facing a little problem with eval in perl. > > say I do the following: > > $a = "print \"hi\"" > > eval($a) > hi> $b = eval($a) > hi> print $b > 1> > > The above piece of code, prints the output of eval statement > on the STDOUT, and > I only get the return status of the EXPR in eval statement. > But I have no way to capture this output in some variable. > > Instead of this behaviour of eval, Can I get what I want > .i.e.. Can I capture > the output in some variable. > Like here I am printing "hi" on stdout. But I want this "hi" > to be stored in > some variable also. > > Please help, > > TIA, > -Mini. Rather than use the eval command, use backticks like this $A = `echo "Hello World"`; print "Command has run, \$A is:"; print $A; $A will contain the output of the command executed inside the backticks HTH Rod the IFFO Mailto:[EMAIL PROTECTED] Tel: +44-1293-584145 Mob: +44-7711-553080 Fax: +44-1293-584994 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
more on date counting
Hi I am trying to work out how to determine how many days are between a set of dates excluding weekends.. So far I have figured out how to subtract one date from the other, see below. The next section I would like help with is the bit that figures out how to ignore dates that are weekends. use Date::Calc qw(:all); $mon = (1..12) [(localtime)[4]]; $yr=1900+$year; $wdays = (0..6) [(localtime)[6]]; $day1 = 26; $Dd = Delta_Days($yr,$nmon,$day1, $yr,$mon,$wdays); print $Dd; TIA Toni
using rand
i'm taking an intro to programming with PERL class. one of the problems asks us to do the following: show how to creat a random number inthe following range: 5 to 15 -10 to 20 the documentation for rand and srand are not too useful. Any help would be great. thanks, eric -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Slightly off-topic - calling all weather and Perl enthusiasts!
Fellow Perl heads... Over the course of the last five months I've been developing a group of scripts to gather weather information, parse and dump into SQL DB, and display via CGI. This little side project has quickly grown in demand, surprised to say. Information can be found at http://vista.riven.net/~moose/fumblings/weather. Getting to the point, I need help in several areas: a) Individuals who understand weather based mathematical computation. b) Individuals with SQL and CGI understanding. c) Individuals who can clean up code before publishing. Anyone willing to help out, especially in the area of weather formulas, would be most appreciated. I appreciate everyone's time, and I apologize for wasting list space. Regards, Jade -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
making use of Crypt::RSA->email
Hi all, In this weeks oreillynet.com there was a usefull article mentioned (http://www.perl.com/pub/a/2001/09/26/crypto1.html) on using crypt::RSA to encrypt/decrypt and sign messages. Has anyone got any examples of actually using this module with Mail::Sender to send signed or encrypted messages? I'm totally new to cryptography and have no real idea what I'm about to dive into, but basically I want to be able to automatically generate emails that will work with programs like kmail which has PGP/GPG support built in. Sorry to be vague, but I'm at the bottom of this hill. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dot-named sub
Hi: I am in need of a tip to name a sub with a '.' (dot) as sub www.com { bla, bla } Any suggestion? Thanks in advance, Jose Luis Sancho -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dot-named sub
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Jos? Luis Sancho) wrote: > I am in need of a tip to name a sub with a '.' (dot) as > > sub www.com { > bla, bla > } you can't use a full stop. use an underscore instead. sub www_com { } -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI script to change user's password, and login.
Dear Wee Keong, I had written something for Perl on windows for login, password. login.cgi will call check.cgi and check.cgi will call password.cgi. a bit messy. but you can try to use. The scripts will create html. it is not from apache. To prompt users in from apache, you have to set the private_groups and private users, also set the httpd.conf files. this is some thing I know. there should be more ref. Thanks and cheers, Andrew --- Tan Wee Keong <[EMAIL PROTECTED]> wrote: > Hi, > > Recently I've received a task to write a script > (CGI) to allow changing > of user password on a web page. Basically I'm very > new to CGIs and is > facing a tremendous problem starting this task. > > Basically, the script is supposed to run on Apache > (ran as "nobody") and > allow users to change their system password via web > interface. I'm not > too sure whether it can be done this way or is it > right to be done this > way. Therefore I seek help from here to reach a > conclusion. > > Can any gurus advise me? > > WK > > > -- > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > Do You Yahoo!? Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk or your free @yahoo.ie address at http://mail.yahoo.ie login.cgi password.cgi check.cgi -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
extraction
I have wrote the following code: while() { print TEMP "$1\n" if(m/(< a href=\"\/rdn\?oid.*rub); } The finding lines are like that: "gqgfqsgdkg< a href="rdn?oiddsfhlhfdsrub=lhfdlhg" class sljdfsgkjfd" I only want to extract the underlined string. How can i do to stop the extraction at "class" ? Thanks Franck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI script to change user's password.
its possible and its very easy. You can even creat and delete users. Just read about invoking shell scripts or executing system commands. But as you are changing the system passwords. first you should know about implementing Secure Socket Layer (SSL), other wise it would be easier for hacker to tap in and get the passwords. I am sure there would be some read packages to do all user management tasks. May be Gurus can put for light on the subject. Rajeev - Original Message - From: "Tan Wee Keong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 2:02 PM Subject: CGI script to change user's password. > Hi, > > Recently I've received a task to write a script (CGI) to allow changing > of user password on a web page. Basically I'm very new to CGIs and is > facing a tremendous problem starting this task. > > Basically, the script is supposed to run on Apache (ran as "nobody") and > allow users to change their system password via web interface. I'm not > too sure whether it can be done this way or is it right to be done this > way. Therefore I seek help from here to reach a conclusion. > > Can any gurus advise me? > > WK > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dot-named sub
On Tue, 2 Oct 2001, José Luis Sancho wrote: > I am in need of a tip to name a sub with a '.' (dot) as > > sub www.com { > bla, bla > } I don't think you can use dots in sub or variables names. Use an underscore _ instead. -- Brett http://www.chapelperilous.net/ The bugs you have to avoid are the ones that give the user not only the inclination to get on a plane, but also the time. -- Kay Bostic -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dot-named sub
Well I have a way around. I have not done this but sure will work. may be gurus and give a code for this. If we cannot use dot in a sub routine name, but surely can use as a alias. All we need to do is to have an hash table and assing the functional as the value to the key which "can" have a "dot" Applogies in advance if I am worng, I just could not resist taking chances. Rajeev Rumale - Original Message - From: "Brett W. McCoy" <[EMAIL PROTECTED]> To: "José Luis Sancho" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 7:38 PM Subject: Re: dot-named sub > On Tue, 2 Oct 2001, José Luis Sancho wrote: > > > I am in need of a tip to name a sub with a '.' (dot) as > > > > sub www.com { > > bla, bla > > } > > I don't think you can use dots in sub or variables names. Use an > underscore _ instead. > > -- Brett > http://www.chapelperilous.net/ > > The bugs you have to avoid are the ones that give the user not only > the inclination to get on a plane, but also the time. > -- Kay Bostic > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI script to change user's password.
>> Hi, >> >> Recently I've received a task to write a script (CGI) to allow changing >> of user password on a web page. Basically I'm very new to CGIs and is >> facing a tremendous problem starting this task. >> >> Basically, the script is supposed to run on Apache (ran as "nobody") and >> allow users to change their system password via web interface. I'm not >> too sure whether it can be done this way or is it right to be done this >> way. Therefore I seek help from here to reach a conclusion. >> >> Can any gurus advise me? And for a really basic example (older than dirt itself) -- See http://web.fccj.org/~wcjones/WebPass.html -Sx- PS - if you are on Unix - Lincoln even wrote his own system; see "How Do I Change Passwords?" in the WWW Security Faq - http://www.w3.org/Security/Faq/www-security-faq.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dot-named sub
On Tue, 2 Oct 2001, Rajeev Rumale wrote: > Well I have a way around. I have not done this but sure will work. may be > gurus and give a code for this. > > If we cannot use dot in a sub routine name, but surely can use as a alias. > > All we need to do is to have an hash table and assing the functional as the > value to the key which "can" have a "dot" > > Applogies in advance if I am worng, I just could not resist taking chances. You mean if you do something like: my %subs; $subs{'www.com'} = sub { .. } Yes, then you can use dots, in the hash keys that dereference to anonymous subroutines. The next question is, why do you *need* to have subroutine names with dots in them? -- Brett http://www.chapelperilous.net/ You need more time; and you probably always will. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: more on date counting
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 02, 2001 3:46 AM > To: [EMAIL PROTECTED] > Subject: more on date counting > > > Hi > I am trying to work out how to determine how many days are > between a set > of dates excluding weekends.. > > So far I have figured out how to subtract one date from the > other, see > below. > > The next section I would like help with is the bit that > figures out how to > ignore dates that are weekends. > > > use Date::Calc qw(:all); > $mon = (1..12) [(localtime)[4]]; This is very inefficient. Why not just (localtime)[4]+1 ? > $yr=1900+$year; Where did $year come from? > $wdays = (0..6) [(localtime)[6]]; This is no different from just (localtime)[6]. It is also day of the WEEK, but Delta_Days below needs day of MONTH. > $day1 = 26; > > > $Dd = Delta_Days($yr,$nmon,$day1, $yr,$mon,$wdays); > print $Dd; Anyway, assuming you can get $Dd to correctly reflect total days between the two dates, here's the algorithm I would use: $Dd represents some whole number of weeks (0 or more), plus a partial week of 0-6 days. Find the whole number of weeks and multiply by 5, since each week has 5 non-weekend days. For the partial week ends on the week day of your ending date, working backwards, add 1 to the total for each day of this partial week which is not a weekend day. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using rand
> -Original Message- > From: eric [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 02, 2001 4:12 AM > To: [EMAIL PROTECTED] > Subject: using rand > > > i'm taking an intro to programming with PERL class. one of > the problems > asks us to do the following: > show how to creat a random number inthe following range: > 5 to 15 > -10 to 20 > > the documentation for rand and srand are not too useful. Well, they're extremely useful in telling what those routines do, so I don't understand your complaint. Anyway, since rand(x) generates a random number in the range 0 <= n < x, it should be trivial to map that to the range a <= n < b, right? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DB connect fail
I found that the problem was unrelated to this. The web server configuration was changed to run under "root", which was not configured with the environment setup properly. Once this was identified and corrected the script is running properly. Thanks. Carlin -Original Message- From: Thater, William [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 8:38 AM To: Carlin Anderson Cc: '[EMAIL PROTECTED]' Subject: Re: DB connect fail Carlin Anderson wrote: > I have 2 Sun/Oracle installtions where the first installation (QA) is a > single unit system (web server, application, db server all on the same unit) > , and the second installation (Production) is a 2 unit system where the > database is separate from the web server and application code. > > On the QA system, I can connect to the database and execute queries without > problem. On the production system, however, I am receiving this error: > > Couldn't connect to database: ORA-12154 (DBD ERROR: OCIServerAttach) > > I can connect using sqlplus and the same TNS name, so I don't think the TNS > configuration is the issue. We are using Oracle 8.1.7 on both systems now > (production was just upgraded from 8.1.6). > > Ideas anyone? are you using service names or SID? have you tried using ? are you sure the TNS connect string is being passed correctly? do you have multiple ORACLE homes and are you sure it's accessing the correct TNSNAMES.ora? is TWO_TASK set? -- Bill "Shrek" Thater ORACLE DBA Telergy,Inc. [EMAIL PROTECTED] You gotta program like you don't need the money, You gotta compile like you'll never get hurt, You gotta run like there's nobody watching, It's gotta come from the heart if you want it to work. You can't get where you want to go if you don't know where you are -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using rand
On Oct 2, Bob Showalter said: >> -Original Message- >> From: eric [mailto:[EMAIL PROTECTED]] >> >> show how to creat a random number inthe following range: >> 5 to 15 >> -10 to 20 >> >> the documentation for rand and srand are not too useful. > >Well, they're extremely useful in telling what those routines >do, so I don't understand your complaint. > >Anyway, since rand(x) generates a random number in the range >0 <= n < x, it should be trivial to map that to the range >a <= n < b, right? Yes, the rand() function returns some value greater than or equal to 0 and less than the value you pass it (which defaults to 1). If you want an integer in the range from 0 to $N - 1, you would do: $val = int rand($N); If you then want an interger in the range from 1 to $N, you'd add 1 to the RETURNED value: $val = 1 + int rand($N); Use this to figure out how to shift the ranges to get numbers from 5 to 15 and -10 to 20. 0 <= rand(N) < N 0 + A <= rand(N) + A < N + A -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dot-named sub
Great ! I just never used that. so could not gvie the code. Wel coming your question Why we need to put dot in name ? Well only "_brian_d_foy <[EMAIL PROTECTED]>" can answer that , as he/she has posted the question. with regards Rajeev Rumale - Original Message - From: "Brett W. McCoy" <[EMAIL PROTECTED]> To: "Rajeev Rumale" <[EMAIL PROTECTED]> Cc: "José Luis Sancho" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 8:53 PM Subject: Re: dot-named sub > On Tue, 2 Oct 2001, Rajeev Rumale wrote: > > > Well I have a way around. I have not done this but sure will work. may be > > gurus and give a code for this. > > > > If we cannot use dot in a sub routine name, but surely can use as a alias. > > > > All we need to do is to have an hash table and assing the functional as the > > value to the key which "can" have a "dot" > > > > Applogies in advance if I am worng, I just could not resist taking chances. > > You mean if you do something like: > > my %subs; > > $subs{'www.com'} = sub { .. } > > Yes, then you can use dots, in the hash keys that dereference to anonymous > subroutines. The next question is, why do you *need* to have subroutine > names with dots in them? > > -- Brett > http://www.chapelperilous.net/ > > You need more time; and you probably always will. > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Max Function
or you could do it like this $maximum = max (@any_array); #(don't use hashes here) you need to declare the sub max sub max { my $max = shift(@_); for my $item (@_) { $max = $item if $max < $item; } return $max; } this is from the camel book it look prettier to me but that's a matter of taste ;) maybe it's even faster because there's no split or sort involved greetings Remco Schoeman -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: donderdag 27 september 2001 22.04 Cc: [EMAIL PROTECTED] Subject: Max Function I am finding the maximum (Max) of given numbers using this technique. Am I justified using this approach, or there is a straight-forward way to do it in Perl? my(@arrY) = split(",",$yVals); my(@cpyArrY)= sort{$b<=>$a}(@arrY); $yMax = shift(@cpyArrY); thanks in advance, Rex -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
matching
Hi! I have wrote the following code: while () { if(m/(http:\/\/www.01net.com\/rdn?oid=[0-9].*&rub=[0-9].*)/ ) { print TEMP2 "$1\n" ; } } The matching doesn't work ! want to match for example : http://www.01net.com/rdn?oid=54682&rub=12456 Can anybody help me ? Thanks Franck -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: matching
On Tue, 2 Oct 2001, COLLINEAU Franck FTRD/DMI/TAM wrote: > I have wrote the following code: > > while () > { > if(m/(http:\/\/www.01net.com\/rdn?oid=[0-9].*&rub=[0-9].*)/ ) > { > print TEMP2 "$1\n" ; > } > } > > The matching doesn't work ! want to match for example : > http://www.01net.com/rdn?oid=54682&rub=12456 > Can anybody help me ? You will also need to escape the . and ? -- Brett http://www.chapelperilous.net/ Ambition, n: An overmastering desire to be vilified by enemies while living and made ridiculous by friends when dead. -- Ambrose Bierce -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: matching
> -Original Message- > From: COLLINEAU Franck FTRD/DMI/TAM > [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 02, 2001 11:08 AM > To: Perl (E-mail) > Subject: matching > > > Hi! > > I have wrote the following code: > > while () > { > if(m/(http:\/\/www.01net.com\/rdn?oid=[0-9].*&rub=[0-9].*)/ ) ^ ^^ The chars marked are regex meta chars. You especially need to escape the question mark. > { > print TEMP2 "$1\n" ; > } > } > > The matching doesn't work ! want to match for example : > http://www.01net.com/rdn?oid=54682&rub=12456 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modifying a text file with perl.
While this is completely accurate for the sample data you provided it will substitute all 1's with 0's. Is there any chance of 1's in earlier fields, or an 11, 12, 21, 151, etc in the last field. The second solution offered is more precise... $oldline =~ /^(.+\, )(.)$/; if ($2 == 1) { $2 = 0; } $newline = $1.$2; But again may fail with any significant variation in your data (e.g. multiple digit number in 3rd field would just be erased since it would not match the regular expression (.) and $2 would be undefined (or null, not sure). I'd suggest a slightly modified... $oldline =~ /^(.+\, )(.*)$/; which would load everything after the last comma into $2. One last note: is your data comma delimited or comma-space delimited per your example. If it's really comma only remove the space in the regular expression. paul. "Gary Tam" <[EMAIL PROTECTED]To: "'Daniel Falkenberg'" .au> <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> 10/01/2001 cc: 09:31 PM Subject: RE: Modifying a text file with perl. Please respond to gtam Daniel, The following code will do. undef $/; open (INPUT, "test") || die "Can't open the input file"; $data=; close INPUT; open (OUTPUT, ">test") || die "Can't open the output file"; $data =~ s/1/0/g; print OUTPUT $data; close OUTPUT; Cheers, Gary -Original Message- From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 2 October 2001 12:54 To: [EMAIL PROTECTED] Subject: Modifying a text file with perl. List, I have comma seperated text file here with 3 entries per line... hello, world, 1 Is it possible with perl to change that value of 1 to 0? Regards, Daniel Falkenberg == VINTEK CONSULTING PTY LTD (ACN 088 825 209) Email: [EMAIL PROTECTED] WWW:http://www.vintek.net Tel:(08) 8523 5035 Fax:(08) 8523 2104 Snail: P.O. Box 312 Gawler SA 5118 == -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
append line
Hi all, I have 2 files comma delimited that I want to merge based on similarity of first and last entry file1 looks like this alpha,1,2,3,K delta,3,4,5 file2 looks like this: beta,2,3,4 alpha,33,22,35,K the output I am looking for is: alpha,1,2,3,33,22,35 basically I want to append content of a line of file 1 if the first element and last element are same in both files is same . Thanks for your help I.S __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Modifying a text file with perl.
On Tue, 2 Oct 2001 [EMAIL PROTECTED] wrote: > While this is completely accurate for the sample data you provided it will > substitute all 1's with 0's. Is there any chance of 1's in earlier fields, > or an 11, 12, 21, 151, etc in the last field. For that matter, if you want a consistent and more robust way of modifying comma-separated files, look into using the various Text::* modules (CSV, CSV_XS, xSV, etc), or, my favorite, DBD::CSV, which lets you manipulate a CSV file with SQL (very simple to modify values in a consistent fashion!) via the DBI. -- Brett http://www.chapelperilous.net/ This sentence no verb. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: append line
How big are the files? If they are not too large, I would suggest reading each file into a hash, then create a new file if the right parts of the two hashes match. Do you only want to merge the data if the line ends in something other than a number, or is it OK to merge if they both end in the same number? Something like this pseudo code open file 1 open file 2 while { split line into $pre,$data and $post elements $hash1{$pre) = $pre; $hash1{$pre}{'data'} = $data; $hash1{$pre}{'post'} = $post; } do the same split/store for file 2 open file 3 for writing foreach $key(keys %hash1) { do tests here e.g if $hash1{$key}{'post'} eq $hash2{$key}{'post'} (this will check that the same beginning and end match in the two hashes) If you get a match then print FILE3 "$pre,$hash1{$pre}{'data'},$hash2{$pre}{'data'}\n"; } HTH John -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: 02 October 2001 17:03 To: [EMAIL PROTECTED] Subject: append line Hi all, I have 2 files comma delimited that I want to merge based on similarity of first and last entry file1 looks like this alpha,1,2,3,K delta,3,4,5 file2 looks like this: beta,2,3,4 alpha,33,22,35,K the output I am looking for is: alpha,1,2,3,33,22,35 basically I want to append content of a line of file 1 if the first element and last element are same in both files is same . Thanks for your help I.S __ Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --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. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eval problem
On Mon, Oct 01, 2001 at 07:46:24PM +0530, [EMAIL PROTECTED] wrote: > Instead of this behaviour of eval, Can I get what I want .i.e.. Can I > capture the output in some variable. Like here I am printing "hi" on > stdout. But I want this "hi" to be stored in some variable also. So you want to store what you print in a variable, as well as print it out, and you think eval is the answer? It isn't. The simplest answer is: store what you're printing in a variable, then print it. my $stuff_to_print = "hi"; print $stuff_to_print; Now you have a variable, $stuff_to_print, with a value of "hi", and you've printed it out. You could also make your own print function that appends to the variable of your choice: sub append_and_print (\$@) { my($var_ref, @stuff_to_print) = @_; $$var_ref = '' unless defined($$var_ref); my $sep = defined($,) ? $, : ""; $$var_ref .= join($sep, @stuff_to_print); print @stuff_to_print; } append_and_print($stuff_to_print, "hi"); Now $stuff_to_print has the value "hi", and it's been printed. You could also setup a tied handle, one that appends to a variable on each print. The implementation is a little more complex, so I've omitted it. The bottom line is, what are you trying to accomplish with this? Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: matching
At 11:16 AM 10/2/2001 -0400, Bob Showalter wrote: >> -Original Message- >> From: COLLINEAU Franck FTRD/DMI/TAM >> [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, October 02, 2001 11:08 AM >> To: Perl (E-mail) >> Subject: matching >> >> >> Hi! >> >> I have wrote the following code: >> >> while () >> { >> if(m/(http:\/\/www.01net.com\/rdn?oid=[0-9].*&rub=[0-9].*)/ ) >^ ^^ ^ ^ Aren't those .'s unnecessary as well?. >The chars marked are regex meta chars. You especially need to escape the >question mark. > >> { >> print TEMP2 "$1\n" ; >> } >> } >> >> The matching doesn't work ! want to match for example : >> http://www.01net.com/rdn?oid=54682&rub=12456 > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: matching
On Wed, 3 Oct 2001, Zander Collier wrote: > >> while () > >> { > >> if(m/(http:\/\/www.01net.com\/rdn?oid=[0-9].*&rub=[0-9].*)/ ) > >^ ^^ > ^ ^ > Aren't those .'s unnecessary as well?. Yes, actually they are, just need the asterisk for the digit. -- Brett http://www.chapelperilous.net/ You never gain something but that you lose something. -- Thoreau -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eval problem
--- Michael Fowler <[EMAIL PROTECTED]> wrote: > You could also make your own print function that appends to the variable of > your choice: > > sub append_and_print (\$@) { > my($var_ref, @stuff_to_print) = @_; > > $$var_ref = '' unless defined($$var_ref); > my $sep = defined($,) ? $, : ""; > $$var_ref .= join($sep, @stuff_to_print); > > print @stuff_to_print; > } > > append_and_print($stuff_to_print, "hi"); Michael, I'd be very careful about recommending something like the above to someone who's not terribly familiar with Perl. It's going to bite them and bite them badly. I don't particularly care for prototypes (http://www.perl.com/pub/a/language/misc/fmproto.html), so I rarely use them (some many have seen the "try/catch" snippet I posted the other day (and stole from someone else). That used prototypes, so just pretend I didn't mention it :) One of the problems with prototypes is that they are not prototypes, at least not in the sense that other programming languages use them. Instead, they allow us, amongt other things, to force function arguments into a particular context. In your example, the first argument *doesn't* have to have a scalar value. If you pass an array or hash reference as the first argument, it is silently coerced into scalar context. Run the following snippet: use strict; use warnings; sub append_and_print(\$@); my $stuff_to_print = ["Foo"]; append_and_print $stuff_to_print, "hi", " there\n"; print $stuff_to_print; sub append_and_print (\$@) { my($var_ref, @stuff_to_print) = @_; $$var_ref = '' unless defined($$var_ref); my $sep = defined($,) ? $, : ""; $$var_ref .= join($sep, @stuff_to_print); print @stuff_to_print; } It runs fine and you don't get any warnings, but the output may not be what one expects: hi there ARRAY(0x1a7f018)hi there That's because the first argument is an array ref that gets stringified! In your example, that's likely to be caught quickly because this is stuff to be printed and therefore will have an immediate visual response for the programmer. However, if this is some obscure subroutine that's munging internal data, it will silently corrupt that data and this could be a nasty bug to track down. There is one other problem I have with it. Many times, new Perl programmers ask why the following doesn't work: while (<>) { my $line = chomp; # do more stuff here } That's because chomp acts directly on the variable in question (in this case, $_) and returns the number of characters that it chomped. There are a few functions in Perl that act directly on the variable, but these cause much confusion. In your routine above, I would return the new data, rather than directly changing the first argument passed to it. Cheers, Curtis "Ovid" Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eval problem
> One of the problems with prototypes is that they are not prototypes, at > least not in the sense that other programming languages use them. I am aware of this "problem", which, personally, I don't consider a problem, because it is documented fairly clearly. > Instead, they allow us, amongt other things, to force function arguments > into a particular context. In your example, the first argument *doesn't* > have to have a scalar value. I wasn't using the prototype to check the parameters, I was using it to ease the use of the function. Without the prototype the function would have to be called thusly: append_and_print(\$stuff_to_print, "hi", " there\n"); The prototype serves simply to enreference $stuff_to_print, so it doesn't have to be enreferenced by the programmer using it. It was meant for nothing more. With both solutions there is the possibility of passing a reference to another type of data. The only solution, if this is considered a serious enough problem, is to check the parameters more thoroughly. The code snippet I gave was but an example of one solution, it was not meant to be used without examination by the person using it. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: dot-named sub
In article <00a201c14b46$2d177330$9f01a8c0@Jaya>, [EMAIL PROTECTED] (Rajeev Rumale) wrote: > Well only "_brian_d_foy <[EMAIL PROTECTED]>" can answer that , as he/she has > posted the question. i posted the answer, not the question. :) -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: matching
In article <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>, COLLINEAU wrote: > The matching doesn't work ! want to match for example : > http://www.01net.com/rdn?oid=54682&rub=12456 use HTML::SimpleLinkExtor http://search.cpan.org/search?dist=HTML-SimpleLinkExtor -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Storing a Decryptable Password?
I have a need to store a user's password in a configuration file: - the password should NOT be in plain text. - the password should be decryptable so that we don't have to ask the user each time (as per the common Unix crypt ideal). Any ideas? There's always the cheap sort of rot13, binary, decimal sort of madness, but I was looking for something a bit more "hard to deciper at a glance". I know the inherent risks with having a decryptable, but I'll take those over the obvious risks of plaintest stored passwords. Thoughts? -- Morbus Iff ( i am your scary godmother ) http://www.disobey.com/ && http://www.gamegrene.com/ please me: http://www.amazon.com/exec/obidos/wishlist/25USVJDH68554 icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI script to change user's password.
In article <006301c14b33$25b5c7d0$9f01a8c0@Jaya>, [EMAIL PROTECTED] (Rajeev Rumale) wrote: > I am sure there would be some read packages to do all user management tasks. > May be Gurus can put for light on the subject. just search CPAN for HTTPD::UserAdmin. http://search.cpan.org/search?dist=HTTPD-User-Manage -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
FW: Storing a Decryptable Password?
Read this article, which implements RC4 Symmetric encryption in VBScript. http://www.4guysfromrolla.com/webtech/010100-1.shtml I mimicked the idea by creating a Perl DLL which would encrypt a plain-text password. The logic behind a symmetric encryption is that you provide a key which would encrypt a plain-text password to an encrypted string. When you pass the encrypted string to the encrypting engine, with the same key you used to encrypt, you get the decrypted string back. Now, what can be the key for your problem? Just treat the user's password itself as the key that would hash itself. So if the user's password is : rexarul, you encrypt it to some junk string using rexarul as the key. This way, you need not ask the user again to type his/her key. This works. -- Rex -Original Message- From: Morbus Iff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:09 PM To: [EMAIL PROTECTED] Subject: Storing a Decryptable Password? I have a need to store a user's password in a configuration file: - the password should NOT be in plain text. - the password should be decryptable so that we don't have to ask the user each time (as per the common Unix crypt ideal). Any ideas? There's always the cheap sort of rot13, binary, decimal sort of madness, but I was looking for something a bit more "hard to deciper at a glance". I know the inherent risks with having a decryptable, but I'll take those over the obvious risks of plaintest stored passwords. Thoughts? -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Storing a Decryptable Password?
By using Perl Development Kit of Activestate Corp: http://aspn.activestate.com/ASPN/Downloads/PDK/ -Original Message- From: Barry McClintock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:33 PM To: '[EMAIL PROTECTED]' Subject: RE: Storing a Decryptable Password? how do you write a Perl DLL? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:22 PM To: [EMAIL PROTECTED] Subject: FW: Storing a Decryptable Password? Read this article, which implements RC4 Symmetric encryption in VBScript. http://www.4guysfromrolla.com/webtech/010100-1.shtml I mimicked the idea by creating a Perl DLL which would encrypt a plain-text password. The logic behind a symmetric encryption is that you provide a key which would encrypt a plain-text password to an encrypted string. When you pass the encrypted string to the encrypting engine, with the same key you used to encrypt, you get the decrypted string back. Now, what can be the key for your problem? Just treat the user's password itself as the key that would hash itself. So if the user's password is : rexarul, you encrypt it to some junk string using rexarul as the key. This way, you need not ask the user again to type his/her key. This works. -- Rex -Original Message- From: Morbus Iff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:09 PM To: [EMAIL PROTECTED] Subject: Storing a Decryptable Password? I have a need to store a user's password in a configuration file: - the password should NOT be in plain text. - the password should be decryptable so that we don't have to ask the user each time (as per the common Unix crypt ideal). Any ideas? There's always the cheap sort of rot13, binary, decimal sort of madness, but I was looking for something a bit more "hard to deciper at a glance". I know the inherent risks with having a decryptable, but I'll take those over the obvious risks of plaintest stored passwords. Thoughts? -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Storing a Decryptable Password?
-Original Message- From: Arul, Rex Sent: Tuesday, October 02, 2001 4:43 PM To: 'Barry McClintock' Cc: '[EMAIL PROTECTED]' Subject: RE: Storing a Decryptable Password? By using Perl Development Kit of Activestate Corp: http://aspn.activestate.com/ASPN/Downloads/PDK/ -Original Message- From: Barry McClintock [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:33 PM To: '[EMAIL PROTECTED]' Subject: RE: Storing a Decryptable Password? how do you write a Perl DLL? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:22 PM To: [EMAIL PROTECTED] Subject: FW: Storing a Decryptable Password? Also, I forgot to mention about the following options, since I thought Morbus wanted encryption/decryption capabilities. If all your concern is to just store 'some function of a plain text password' without any need for decrypting it back (One-way encryption), then you can use the glorious modules of Perl: DIGEST::SHA1 (160 bits) or DIGEST::MD5(128 bits). This would produce the message digests which can be stored in the database. Nobody should mathematically be possible to guess the password with 1 in 2 power 160 chances. You can even try to use some function of username and password or just password alongwith the password itself to be fed into the factory classes of DIGEST to get the password you want. If you want to authenticate the user, you can still do by comparing the password digests without the need to decrypt them. Thanks, Rex -Original Message- Read this article, which implements RC4 Symmetric encryption in VBScript. http://www.4guysfromrolla.com/webtech/010100-1.shtml I mimicked the idea by creating a Perl DLL which would encrypt a plain-text password. The logic behind a symmetric encryption is that you provide a key which would encrypt a plain-text password to an encrypted string. When you pass the encrypted string to the encrypting engine, with the same key you used to encrypt, you get the decrypted string back. Now, what can be the key for your problem? Just treat the user's password itself as the key that would hash itself. So if the user's password is : rexarul, you encrypt it to some junk string using rexarul as the key. This way, you need not ask the user again to type his/her key. This works. -- Rex -Original Message- From: Morbus Iff [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 4:09 PM To: [EMAIL PROTECTED] Subject: Storing a Decryptable Password? I have a need to store a user's password in a configuration file: - the password should NOT be in plain text. - the password should be decryptable so that we don't have to ask the user each time (as per the common Unix crypt ideal). Any ideas? There's always the cheap sort of rot13, binary, decimal sort of madness, but I was looking for something a bit more "hard to deciper at a glance". I know the inherent risks with having a decryptable, but I'll take those over the obvious risks of plaintest stored passwords. Thoughts? -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Getting frustrated. DBI Access 97 issues.
Hello group. I need someone who has a lot of experience to help me...possibly on an on going basis because I have asked for help on this issue before to no avail. Everyone says that it looks right...but it is not right. Something is wrong. When I click the link (with a freshly erased browser cache) to this CGI script, it seems to run fine. I get a complete page, but when I click "refresh" it starts perl...and then crashes. " Perl This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor. " I thought maybe it was a bug in active state perl, so I upgraded to the most recent release. That did not help. I though that maybe it was a bug in the DBM module. I upgraded to the latest release. That did not help. I am not seeing any errors showing up in my apache error log. I really need help with this. Can someone please help? I have 3 scripts with the same problem. They are identical except for the SQL statements, so I'll only post one. #!c:\perl\bin\perl -w use DBI; $dbh = DBI->connect('dbi:ODBC:gallery'); $sqlstatement="SELECT name, artist, picture, price, sold, pid, description FROM gallery ORDER BY pid"; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; print "Content-type: text/html\n\n"; print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; while (@row=$sth->fetchrow_array) { print qq~\n\n\n~; print qq~\n~; print qq~http://localhost:8080/wholesalegallery/galleryphotos/fullsize/~; print qq~$row[2].jpg~; print qq~">http://localhost:8080/wholesalegallery/galleryphotos/thumbs/$row[2]~; print qq~.jpg">\n~; print qq~Product name: $row[0]\n~; print qq~Description: $row[6]\n~; print qq~Artist: $row[1]\n~; print qq~Price: \$~; printf "%.2f", $row[3]; print qq~\n~; if ($row[4] == 1) { print qq~SOLD\n~; print qq~\n~; } else { print qq~FOR SALE\n~; print qq~BUY \n~; } print qq~\n~; } print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; My system is a PII-300 mhz with 96 megs ram. Windows 98 ActiveState Perl Apache Web Server Please ignore my ugly code. I'm new and I just want to get this going before I worry about making it "beautiful". And while you're looking at it. Is there a way to pass the NAME (not the value) of the "buy" checkbox to another cgi script? Thanks for your help.
RE: Getting frustrated. DBI Access 97 issues.
After finishing your query, please make it a point to explicitly relieve the database objects. This includes statements like these: $dbh->disconnect; undef $dbh; In fact, I do undef $sth too, even though that is not needed. However, please consider doing the above as it might be a problem with DBI not relieving the tied up resources in the first query. -- Rex -Original Message- From: SAWMaster [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 5:03 PM To: [EMAIL PROTECTED] Subject: Getting frustrated. DBI Access 97 issues. Hello group. I need someone who has a lot of experience to help me...possibly on an on going basis because I have asked for help on this issue before to no avail. Everyone says that it looks right...but it is not right. Something is wrong. When I click the link (with a freshly erased browser cache) to this CGI script, it seems to run fine. I get a complete page, but when I click "refresh" it starts perl...and then crashes. " Perl This program has performed an illegal operation and will be shut down. If the problem persists, contact the program vendor. " I thought maybe it was a bug in active state perl, so I upgraded to the most recent release. That did not help. I though that maybe it was a bug in the DBM module. I upgraded to the latest release. That did not help. I am not seeing any errors showing up in my apache error log. I really need help with this. Can someone please help? I have 3 scripts with the same problem. They are identical except for the SQL statements, so I'll only post one. #!c:\perl\bin\perl -w use DBI; $dbh = DBI->connect('dbi:ODBC:gallery'); $sqlstatement="SELECT name, artist, picture, price, sold, pid, description FROM gallery ORDER BY pid"; $sth = $dbh->prepare($sqlstatement); $sth->execute || die "Could not execute SQL statement ... maybe invalid?"; print "Content-type: text/html\n\n"; print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; while (@row=$sth->fetchrow_array) { print qq~\n\n\n~; print qq~\n~; print qq~http://localhost:8080/wholesalegallery/galleryphotos/fullsize/~; print qq~$row[2].jpg~; print qq~">http://localhost:8080/wholesalegallery/galleryphotos/thumbs/$row[2]~; print qq~.jpg">\n~; print qq~Product name: $row[0]\n~; print qq~Description: $row[6]\n~; print qq~Artist: $row[1]\n~; print qq~Price: \$~; printf "%.2f", $row[3]; print qq~\n~; if ($row[4] == 1) { print qq~SOLD\n~; print qq~\n~; } else { print qq~FOR SALE\n~; print qq~BUY \n~; } print qq~\n~; } print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; print qq~\n~; My system is a PII-300 mhz with 96 megs ram. Windows 98 ActiveState Perl Apache Web Server Please ignore my ugly code. I'm new and I just want to get this going before I worry about making it "beautiful". And while you're looking at it. Is there a way to pass the NAME (not the value) of the "buy" checkbox to another cgi script? Thanks for your help. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Please Stop (was: Re: eval problem)
With all due respect, if you're going to discuss the minutae, nuances, and other "advanced" Perl stuff, could you please do so on another list? This is [EMAIL PROTECTED] Publicly arguing this sort of thing on this list, at least to me, makes it more intimidating to post what will be my silly neophyte questions. I say this because of the recent banter that has been going (and this particular thread isn't the only example), I conclude that I will not be told the simplest way to solve my problem and as such, I won't be improving my fundamental Perl skills. I will be told of the most difficult way to do such. I will not be able to implement it, and will likely grow even more frustrated with my problem rather than having received some courteous help in having it solved, and then moving on. I joined this list to read what other beginners are doing, how and what they're learning, and how they're moving on. I joined in the hope that one day I can get to the point where I can help others. Here's the two problems *I* perceive: - Too many complicated and complex answers to what are simple questions. - A tad to much eagerness to interject one's personal "Perl brilliance" to the mailing list. Please remember the best way to impress us n0oBs is to answer our simple questions simply. If you are advanced, and are on this list helping us n0oBs out, please don't be defensive reading this. Please consider that someone, who calls himself a "beginner" is finding this to be a mailing list whose content (much advanced stuff) doesn't match with the title ([EMAIL PROTECTED]). Please also consider that I'm probably not the only n0oB dissatisfied with the list. You could also say "Don't like it? Leave." True. However, I am trying to help fix what I perceive to be a problem, instead of leaving. If nothing changes, I will. Thank you for your time and consideration, -Zander At 11:37 AM 10/2/2001 -0800, Michael Fowler wrote: >> One of the problems with prototypes is that they are not prototypes, at >> least not in the sense that other programming languages use them. > >I am aware of this "problem", which, personally, I don't consider a problem, >because it is documented fairly clearly. > > >> Instead, they allow us, amongt other things, to force function arguments >> into a particular context. In your example, the first argument *doesn't* >> have to have a scalar value. > >I wasn't using the prototype to check the parameters, I was using it to ease >the use of the function. Without the prototype the function would have to >be called thusly: > >append_and_print(\$stuff_to_print, "hi", " there\n"); > >The prototype serves simply to enreference $stuff_to_print, so it doesn't >have to be enreferenced by the programmer using it. It was meant for >nothing more. With both solutions there is the possibility of passing a >reference to another type of data. The only solution, if this is considered >a serious enough problem, is to check the parameters more thoroughly. The >code snippet I gave was but an example of one solution, it was not meant to >be used without examination by the person using it. > > >Michael >-- >Administrator www.shoebox.net >Programmer, System Administrator www.gallanttech.com >-- > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Stop (was: Re: eval problem)
On Wed, 3 Oct 2001, Zander Collier wrote: > With all due respect, if you're going to discuss the minutae, > nuances, and other "advanced" Perl stuff, could you please do > so on another list? I'm inclined to agree... however, I think it is helpful for beginners also to be amongst more advanced conversation to get a better feel for the language, even if they can't follow a lot of it, without being stuck on one of the really advanced lists (like perl-porters or perl-friends). While the simplest answer is usually the best one (Occam's razor), delving into deeper or more rigorous solutions can never hurt, and the chance that something really cool that can be used in a programmer's toolbox may come about. I have found, being neither a beginner nor an expert like some of the other people on this list, that I can follow the advanced discussions here more easily than I can on the hardcore Perl lists -- the advanced folks here seem to have a better knack at explaining things, which, I guess, is one of the reasons they are on this list -- they like to explain complex topics to make them understandable to those seeking understanding. -- Brett http://www.chapelperilous.net/ Oh, yeah, life goes on, long after the thrill of livin' is gone. -- John Cougar, "Jack and Diane" -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Storing a Decryptable Password?
You could limit the password complexity to a level to where you could use a brute force attack to crack it in a few (seconds|minutes|hours). Of course that means that someone else would be able to as well, but if they can get to the encrypted passwords then your in trouble already. The password complexity could be lowered by: * only encrypting the first ? characters of the actual password, storing the rest in plain text. * converting it to all lower case. * restricting use of non alpahbet characters - Johnathan Morbus Iff wrote: > I have a need to store a user's password in a configuration file: > > - the password should NOT be in plain text. > - the password should be decryptable so that we >don't have to ask the user each time (as per >the common Unix crypt ideal). > > Any ideas? There's always the cheap sort of rot13, binary, decimal > sort of madness, but I was looking for something a bit more "hard to > deciper at a glance". I know the inherent risks with having a > decryptable, but I'll take those over the obvious risks of plaintest > stored passwords. > > Thoughts? > > > -- > Morbus Iff ( i am your scary godmother ) > http://www.disobey.com/ && http://www.gamegrene.com/ > please me: http://www.amazon.com/exec/obidos/wishlist/25USVJDH68554 > icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus > > > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Stop (was: Re: eval problem)
At 05:56 PM 10/2/01 -0400, Brett W. McCoy wrote: >On Wed, 3 Oct 2001, Zander Collier wrote: > > > With all due respect, if you're going to discuss the minutae, > > nuances, and other "advanced" Perl stuff, could you please do > > so on another list? > >I'm inclined to agree... however, I think it is helpful for beginners also >to be amongst more advanced conversation to get a better feel for the >language, even if they can't follow a lot of it, without being stuck on >one of the really advanced lists (like perl-porters or perl-friends). While this is true, it's seldom clear to the beginner when this list has diverted to esoterica. It's *critical* for a beginner to know what they *don't* need to pay attention to at the beginning, and we do them a disservice by commingling easy and not-so-easy stuff. So I'd back Zander, and ask people who want to get into advanced stuff to take it somewhere like comp.lang.perl.{misc,moderated}. There are plenty of places for intermediate or advanced talk, but precious few for the beginner. -- Peter Scott Pacific Systems Design Technologies http://www.perldebugged.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Stop (was: Re: eval problem)
--- Zander Collier <[EMAIL PROTECTED]> wrote: > With all due respect, if you're going to discuss the minutae, > nuances, and other "advanced" Perl stuff, could you please do > so on another list? > > This is [EMAIL PROTECTED] Mea Culpa. While I do have some reservations about how prototypes were used in a particular example, I'll try to be more sensitive about the "beginners" aspect of things. Cheers, Curtis "Ovid" Poe = Senior Programmer Onsite! Technology (http://www.onsitetech.com/) "Ovid" on http://www.perlmonks.org/ __ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
variable variable-names
Hi all, I'm trying to write a script that will pull out values for form data radio buttons for muliple answers. This is what a standard line looks like: Blah For each question I've tried to make up a separate set of arrays containing the button values: open (QUES, ") { chomp $line; if ($line =~ m|[^"]*NAME="answer(\d)"\s*VALUE="([^"]*)"|) { $num = $1; $value_label = $2; push @question_$num, $value_label; } } but I keep getting the following error message: Scalar found where operator expected at ./grab_qustions.pl line 45, at end of line (missing operator before ?) syntax error at ./grab_questions.pl line 45, near "@question_$num" I've also tried using @question_${num}, but that soesn't work either. From the error message, I'm assuming that I am making multiple errors, but I'm stumped. Can anyone help? Thanks, Drunken Master = "Still pond, frog jumps in. Splash!" "There he goes...one of God's own prototypes. A high-powered mutant of some sort, never meant for mass production... Too weird to live, and too rare to die..." AIM: TaoJonesin __ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Stop (was: Re: eval problem)
> While this is true, it's seldom clear to the beginner when this list has > diverted to esoterica. It's *critical* for a beginner to know what they > *don't* need to pay attention to at the beginning, and we do them a > disservice by commingling easy and not-so-easy stuff. > > So I'd back Zander, and ask people who want to get into advanced stuff to > take it somewhere like comp.lang.perl.{misc,moderated}. There are plenty > of places for intermediate or advanced talk, but precious few for the > beginner. Well, being somewhat of a beginner myself, I think it is very helpful to look at stuff that's above your head. I certainly don't mind the fact that 80% of the stuff on this list is above me, and I think that, when I do start dealing with some of the more advanced stuff, I'll have had a little introduction to it here ("Oh yeah, I remember so-and-so mentioned that..."). Overall, I think it's beneficial to see stuff that's above your head, no matter what level you're at, as long as it's made clear that total beginners can can ask simple questions and not be flamed for it. Before we try to rid ourselves of advanced topics, I think we should simply try to answer beginners' questions more clearly and nicely. (Less of the "just use this regex instead: m/^(?:[a-f\d])*?\.+?[^\d\w]?\d+\s\w+?\s/ig" or "it already TOLD you to do that and you apparently didn't pay any attention" type of stuff.) Well, that's my $0.02. > -- > Peter Scott > Pacific Systems Design Technologies > http://www.perldebugged.com -Michael Kelly Email: [EMAIL PROTECTED] The Web: http://jedimike.hypermart.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: variable variable-names
I didn't use this with perl, it was with php. however, I used Blah Blah Then in the php I had a loop that went through the values of answer At 03:14 PM 10/2/2001 -0700, The Black Man wrote: >Hi all, > >I'm trying to write a script that will pull out values >for form data radio buttons for muliple answers. This >is what a standard line looks like: > >Blah > >For each question I've tried to make up a separate set >of arrays containing the button values: > >open (QUES, "foreach $line () { > chomp $line; > if ($line =~ >m|[^"]*NAME="answer(\d)"\s*VALUE="([^"]*)"|) { > $num = $1; > $value_label = $2; > push @question_$num, $value_label; > } >} > > >but I keep getting the following error message: > >Scalar found where operator expected at >./grab_qustions.pl line 45, at end of line >(missing operator before ?) >syntax error at ./grab_questions.pl line 45, near >"@question_$num" > > >I've also tried using @question_${num}, but that >soesn't work either. From the error message, I'm >assuming that I am making multiple errors, but I'm >stumped. Can anyone help? > > >Thanks, > >Drunken Master > > > >= >"Still pond, frog jumps in. Splash!" > >"There he goes...one of God's own prototypes. >A high-powered mutant of some sort, never meant for mass production... >Too weird to live, and too rare to die..." > >AIM: TaoJonesin > >__ >Do You Yahoo!? >Listen to your Yahoo! Mail messages from any phone. >http://phone.yahoo.com > >-- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: variable variable-names
> From: The Black Man <[EMAIL PROTECTED]> > Date: Tue, 2 Oct 2001 15:14:50 -0700 (PDT) > To: [EMAIL PROTECTED] > Subject: variable variable-names > > Hi all, > > I'm trying to write a script that will pull out values > for form data radio buttons for muliple answers. This > is what a standard line looks like: > > Blah > > For each question I've tried to make up a separate set > of arrays containing the button values: > > open (QUES, " foreach $line () { > chomp $line; > if ($line =~ > m|[^"]*NAME="answer(\d)"\s*VALUE="([^"]*)"|) { > $num = $1; > $value_label = $2; > push @question_$num, $value_label; > } > } If you must use a variable to name another variable, use something like this: push @{"question_$num"}, $value_label; The braces allow you to treat the var name like any old string. The quotes make "question_$num" an interpolated string (just like print "question_$num";, etc). I, however, would use a multilayered array of sorts. (look in the Camel Book under "Data Structures" for more info on that.) Hope that helps. > > but I keep getting the following error message: > > Scalar found where operator expected at > ./grab_qustions.pl line 45, at end of line > (missing operator before ?) > syntax error at ./grab_questions.pl line 45, near > "@question_$num" > > > I've also tried using @question_${num}, but that > soesn't work either. From the error message, I'm > assuming that I am making multiple errors, but I'm > stumped. Can anyone help? > > > Thanks, > > Drunken Master > > > > = > "Still pond, frog jumps in. Splash!" > > "There he goes...one of God's own prototypes. > A high-powered mutant of some sort, never meant for mass production... > Too weird to live, and too rare to die..." > > AIM: TaoJonesin -Michael Kelly Email: [EMAIL PROTECTED] The Web: http://jedimike.hypermart.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Please Stop (was: Re: eval problem)
At 03:23 PM 10/02/2001 -0700, Michael Kelly wrote: >Well, being somewhat of a beginner myself, I think it is very helpful to >look at stuff that's above your head. I certainly don't mind the fact that >80% of the stuff on this list is above me, and I think that, when I do start >dealing with some of the more advanced stuff, I'll have had a little >introduction to it here ("Oh yeah, I remember so-and-so mentioned that..."). > >Overall, I think it's beneficial to see stuff that's above your head, no >matter what level you're at, as long as it's made clear that total beginners >can can ask simple questions and not be flamed for it. I definitely agree with you, Michael. It's kind of like any activity, such as basketball or tennis. If you force yourself to watch and play with people who are much more advanced than you, you'll naturally end up getting better by osmosis. Although a lot of the Perl discussion that goes on in c.l.p.m. goes "over my head", I'll end up digging that discussion out of my memory banks (and dejanews) the next time I have a Perl problem, simply by virtue of having seen such a discussion take place. Of course that being said, I suppose is it out of the charter of this mailing list to exercise ones advanced Perl muscle needlessly. I can understand that it does more harm than good to show a newbie some cool and efficient--yet obfuscated--method of getting a simple task done, when said newbie is still in the stages of learning the core language and methodologies first. I can imagine this is why many people are turned off by Perl because they see a lot of compact, "read only" code written by experienced Perl jockeys :) Just my $.02...Aloha, mel -- mel matsuoka Hawaiian Image Productions Chief Executive Alphageek(vox)1.808.531.5474 [EMAIL PROTECTED](fax)1.808.526.4040 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Merge documents
Hi all, I'm trying to write a program to join up subdocuments into one full document. (all are RTFs) Is this more of a VB script stuff or can it be done with PERL? Thanks. Lawrence -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Merge documents
On Wed, 3 Oct 2001, Lawrence Liew wrote: > I'm trying to write a program to join up subdocuments into one full > document. (all are RTFs) > Is this more of a VB script stuff or can it be done with PERL? All things are possible with Perl. There are a bunch of CPAN modules for manipulating RTF documents: DistributionP/PV/PVERD/RTF-Parser-1.05.tar.gz DistributionP/PV/PVERD/RTF-Parser-1.07.tar.gz DistributionR/RR/RRWO/RTF-Document-0.64.tar.gz DistributionR/RR/RRWO/RTF-Generator-1.00.tar.gz DistributionS/SB/SBURKE/RTF-Writer-1.06.tar.gz Module IPChains::PortFW (F/FR/FRAJULAC/Fwctl-0.28.tar.gz) Module Pod::RTF(K/KJ/KJALB/PodSimplify-0.04.tar.gz) Module Pod::Rtf(P/PV/PVHP/Pod2WinHlp-0.02.tar.gz) Module RTF::Base (Contact Author Nick Ing-Simmons <[EMAIL PROTECTED]>) Module RTF::Character (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::Charsets (P/PV/PVERD/RTF-Parser-1.07.tar.gz) Module RTF::ColorTable (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::Config (P/PV/PVERD/RTF-Parser-1.07.tar.gz) Module RTF::Control(P/PV/PVERD/RTF-Parser-1.07.tar.gz) Module RTF::Document (R/RR/RRWO/RTF-Document-0.64.tar.gz) Module RTF::FontTable (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::Generator (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::Group (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::HTML::Converter (P/PV/PVERD/RTF-Parser-1.07.tar.gz) Module RTF::HTML::Output (P/PV/PVERD/RTF-Parser-1.05.tar.gz) Module RTF::Paragraph (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::Parser (P/PV/PVERD/RTF-Parser-1.07.tar.gz) Module RTF::Section(R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::StyleSheet (R/RR/RRWO/RTF-Generator-1.00.tar.gz) Module RTF::TEXT::Converter (P/PV/PVERD/RTF-Parser-1.07.tar.gz) Module RTF::Writer (S/SB/SBURKE/RTF-Writer-1.06.tar.gz) Module RTF::Writer::TableRowDecl (S/SB/SBURKE/RTF-Writer-1.06.tar.gz) 27 items found -- Brett http://www.chapelperilous.net/ The person who marries for money usually earns every penny of it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
searching and capturing portions of text
I need to know how to capture text from a string and place it into another variable. I have a program whose output i am able to capture into a variable and looks like the following: stuff i dont care about Error: 4 more stuff that doesn't matter what i need to do is store the number 4 in a variable. Using index i am able to search through the string and find how many characters into the array the word error begins. The error however can be more than just one character and so i need to know how i would capture the next x characters into a variable. Any sample code or suggestions are appreciated. Thanks, Matthew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: searching and capturing portions of text
On Wed, 3 Oct 2001, Matthew Blacklow wrote: > stuff i dont care about > Error: 4 > more stuff that doesn't matter > > what i need to do is store the number 4 in a variable. Using index i am able > to search through the string and find how many characters into the array the > word error begins. The error however can be more than just one character and > so i need to know how i would capture the next x characters into a variable. Use a regular expression. Since you know the text to scan is in a specific pattern (the text 'Error: ', followed by a number of 1 or more digits), it's easy to create a regular expression for this. Assuming your program's output is captured into an array by whatever method you have chosen (piped output into a filehandle, backticks, etc): my $error_num; while(@output_arr) { if(/Error: (\d*)/) { $error_num = $1 } } -- Brett http://www.chapelperilous.net/ Fortune finishes the great quotations, #6 "But, soft! What light through yonder window breaks?" It's nothing, honey. Go back to sleep. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eval problem
Hi everybody, Thanks for sending the reply , but I think the problem is misunderstood ..thanks to the stupid way I which I put forward my problem!! this is our case we are trying to develop a Command line Interface for a simulator , the requirements are that the CLI as to be written in C it should be able to run Perl commands and scripts from the prompt ..this we have done by embedding a Perl interpreter into a C file and as soon as the user types something at the prompt it is evaluated using eval(), this keeps going on in an infinite loop inside the interpreter block until the user types exit or terminates the program by any other means. This way we are able to maintain the values of all the variables till program termination if the user says ==> $a = "abc" ; print $a; .. "==>" is the prompt provided for input this is how I evaluate it inside my C file perl_eval_pv("$temp = \"\$a = \"abc\"; print \$a \"",TRUE); perl_eval_pv("eval($temp);warn() if $@;",TRUE); here is where the problem starts ( In highlighted line ) The CLI program has to be a part of the main simulator process or else the commands executed in the CLI would not have access to name spaces of all other modules ..which is a basic necessity so what we thought of was that we would fork an Xterm just for I/O which would communicate with the parent process ( the process which has the Perl Interpreter ) through pipes . but since eval writes its output to STDOUT we are not able to send it through the pipe :-( so my earlier effort was basically to find out how we can capture the output of "eval($temp)" into a Perl variable, ...this variable could later be taken from the Perl stack ,converted into a C string and sent through the pipe to the Xterm...This $temp can contains any perl command. I think I have made my case clear TIA, -Mini. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: extraction
In article <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>, COLLINEAU wrote: > The finding lines are like that: "gqgfqsgdkg< a > href="rdn?oiddsfhlhfdsrub=lhfdlhg" class sljdfsgkjfd" > I only want to extract the underlined string. How can i do to stop the > extraction at "class" ? i don't see any underlined string, but if you want to extract links you can use HTML::SimpleLinkExtor. -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perl and DBI what is needed..
I have compiled and installed PostgreSQL 7.1.2 DBD-Pg-1.01.tar.gz DBI-1.20.tar.gz I am running perl, version 5.005_03 ... When I ran ./configure on PostgreSQL 7.1.2 I did so --with-perl but make reported It could not install because Perl libraries were not shared.. I assume it wanted me to have the Perl static installed and linked.. Right or wrong?? So I installed the above DBD and DBI after the PostgreSQL install.. Question ?? Do I have to do anything else to get Perl and PostgreSQL to work together.. Such as another Perl Library or a Link..?? Bob T -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
problem in knowing session variables .
Hello, i am fetching the asp page by filling in the form. After filling in the form and submitting a request it requests the page . a session is established with some session variables. How could i know what r the session variables involved in while fetching the page. Any suggestions... Thanks, rahul
RE: searching and capturing portions of text
Hi there, Thanks for the help. Unfortunatly i have been unable to get it working though. Could you please explain a few things to me. 1. What does "my" do? 2. I have been storing the output into the output_arr variable is this what i am supposed to do? 3. What is the "$error_num = $1" doing. I know that it is storing something into error_num and suppossedly what i searched for but i dont follow it. Thanks, Matthew Blacklow >my $error_num; > >while(@output_arr) { > > if(/Error: (\d*)/) { $error_num = $1 } >} -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]