RE: Need help with range operator
At 07:54 PM 3/17/2006 -0500, Dial, Joe wrote: >So, I looked for it. Found it in chapter 6 of the Perl Cookbook. Its >Recipe 6.8. >See this URL: http://www.unix.org.ua/orelly/perl/cookbook/ch06_09.htm > >I don't understand exactly why the original posted code doesn't work, >but is remarkably >similar to that recipe. Yep, ur right. while (<>) { print if m##i .. m##i; } This is one of those cases where one perl operator is really two operators in one, that have nothing to do with each other. ;) Seems that in scalar context .. is a flip-flop operator and not a range operator at all. Vice versa for list context which we all know and love. So strictly speaking, my statement was correct. 0:) -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Need help with range operator
Dial, Joe wrote: > Hi, > When I read the first post, I remembered seeing that somewhere before. > Then, I was amazed to see the "this is not what the range operator was > meant to do." > > So, I looked for it. Found it in chapter 6 of the Perl Cookbook. Its > Recipe 6.8. > See this URL: http://www.unix.org.ua/orelly/perl/cookbook/ch06_09.htm > > I don't understand exactly why the original posted code doesn't work, > but is remarkably > similar to that recipe. Maybe Craig will tell us how he resolved his problem (stayed with his general code or tried something else). I suggested just a small fix to the orig. code, but the logic was the same. > Just had to weigh in... ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hash return value
Yeah that's what I started to suspect after I posted. mkhash() should be saved to a variable name and that variable used in the while each loop. At 01:18 PM 3/18/2006 +1100, Sisyphus wrote: >That's not what I find. >The following script (suggested by Chris) simply prints "All done" for me. > my($key, $value); %temp = mkhash(); while (($key, $value)= each( %temp )) >my($key, $value); >while (($key, $value)= each( %{mkhash()} )) >{ >print("$key = $value\n"); >} > >print "All done\n"; > >sub mkhash >{ > my %hash=('one'=>1, 'two'=>2, 'three'=>3); > return %hash; >} > >__END__ three = 3 one = 1 two = 2 All done -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Implementing or Emulating TSRs in Win32 Console Apps
At 11:09 PM 3/17/2006 +0200, =?iso-8859-1?Q?Veli-Pekka_T=E4til=E4?= wrote: >It's no big deal really but I wonder why you use the marginally shorter >forms u and ur in stead of you and your. U renders quite well with a speech >synth here, but ur is pretty much indistinguishable from err, . :) I guess it's a combination the netspeak and the desire to make things shorter. I am atleast somewhat of a reductionist. ;) -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hash return value
- Original Message - From: "Eric Amick" . . > You can return a reference to a > hash instead and then dereference it in the caller: > > while (($key, $value)= each( %{ mkhash() })) > { > print("$key = $value\n"); > } > > sub mkhash > { > my %hash=('one'=>1, 'two'=>2, 'three'=>3); > return \%hash; > } That's not what I find. The following script (suggested by Chris) simply prints "All done" for me. use warnings; my($key, $value); while (($key, $value)= each( %{mkhash()} )) { print("$key = $value\n"); } print "All done\n"; sub mkhash { my %hash=('one'=>1, 'two'=>2, 'three'=>3); return %hash; } __END__ Run it under strictures and I get the fatal error: Can't use string ("3/8") as a HASH ref while "strict refs" in use. If I change mkhash() so that it returns a hashref (as you've suggested above), I just get (ad infinitum): three = 3 three = 3 three = 3 three = 3 three = 3 three = 3 three = 3 three = 3 three = 3 three = 3 . . Looks to me that all you've succeeded in doing is find a way around the safeguard that was put in place - and that neverending ouptut is pretty much what I would expect to see when that safeguard has been breached. At each iteration of the while loop, mkhash() gets re-run and each() gets a new anonymous hash to deal with. Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Need help with range operator
Hi, When I read the first post, I remembered seeing that somewhere before. Then, I was amazed to see the "this is not what the range operator was meant to do." So, I looked for it. Found it in chapter 6 of the Perl Cookbook. Its Recipe 6.8. See this URL: http://www.unix.org.ua/orelly/perl/cookbook/ch06_09.htm I don't understand exactly why the original posted code doesn't work, but is remarkably similar to that recipe. Just had to weigh in... Joe Dial -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Craig Cardimon Sent: Friday, March 17, 2006 10:35 AM To: activeperl@listserv.ActiveState.com Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: Need help with range operator Thanks for the replies, folks! I got all kinds of responses. I've seen a "here's one way to do it," a "we could use more information on what you're trying to do," and a "this is not what the range operator was meant to do." It's kind of fascinating, really. List members use perl for different tasks, and our ideas vary a lot, it seems, on how perl should be used. Keeps things from getting boring. -- Craig --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0611-2, 03/17/2006 Tested on: 3/17/2006 10:35:10 AM avast! - copyright (c) 1988-2004 ALWIL Software. http://www.avast.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hash return value
On Fri, 17 Mar 2006 12:05:07 -0800, you wrote: ># Using subroutine that returns a hash doesn't work >while (($key, $value)= each( mkhash() )) >{ >print("$key = $value\n"); >} > >sub mkhash >{ > my %hash=('one'=>1, 'two'=>2, 'three'=>3); > return %hash; >} The each() function expects its argument to start with %. As perlsub explains, your function actually returns a list, not a hash; arrays and hashes are "flattened" when returned from a function, just as they're flattened when passed to a function. You can return a reference to a hash instead and then dereference it in the caller: while (($key, $value)= each( %{ mkhash() })) { print("$key = $value\n"); } sub mkhash { my %hash=('one'=>1, 'two'=>2, 'three'=>3); return \%hash; } -- Eric Amick Columbia, MD ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Maill::Pop3Client - correction
Chris wrote: > Maybe the solution is to have a server in each country to distribute > restricted modules to occupants only. There are a lot of companies (like > Motorola for example) that limit access to software downloads based on the > user's country of origin. I'm sure there are ways of obtaining this list > from Arin. > > Maybe something like... > > us.ppm.activestate.com > ca.ppm.activestate.com Hi Chris, One server set up in a country that didn't have export regulations on cryptographic software would do it, actually. IIRC, that's how the PGP folks did it for a long time. Cheers, kjw ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Maill::Pop3Client - correction
Chris wrote: > Does anyone know if there's any legal issues with hosting encryption > modules in the US? I run a farm of uber fast servers that I could add > a PPM repository to for everyone. > > - Chris Hi Chris, I haven't looked at the US situation in a few years, but I believe it hasn't changed. Strong encryption is considered "munitions" by the relevant government agency, and requires a permit to export. The set of rules it is covered under is the broad-ranging Export Administration Regulations (EAR), though on a quick look I can't tell which of the many rules covers it. Cheers, kjw - Maybe the solution is to have a server in each country to distribute restricted modules to occupants only. There are a lot of companies (like Motorola for example) that limit access to software downloads based on the user's country of origin. I'm sure there are ways of obtaining this list from Arin. Maybe something like... us.ppm.activestate.com ca.ppm.activestate.com - Chris ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Maill::Pop3Client
- Original Message - From: "Splinter" <[EMAIL PROTECTED]> To: ; "'Sisyphus'" <[EMAIL PROTECTED]> Sent: Saturday, March 18, 2006 8:19 AM Subject: Re: Maill::Pop3Client > Great! > > > > I've installed all three modules - > > 1) Net::SSLeay > > 2) IO::Socket::SSL > > 3) Mail::POP3Client > > > > and everything connects ok. BUT, $pop->Count() everytime returns 0, even > when there are new mails in my mailbox. > > Where is the shit? > > Can you show us the code you're using ? Don't show us actual username and password (or even the mail server name, if you want). Did you construct $pop as per the documentation: $pop = new Mail::POP3Client( USER => "me", PASSWORD => "mypassword", HOST => "pop3.do.main", USESSL => true, ); Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Maill::Pop3Client - correction
Chris wrote: > Does anyone know if there's any legal issues with hosting encryption modules > in the US? I run a farm of uber fast servers that I could add a PPM > repository to for everyone. > > - Chris Hi Chris, I haven't looked at the US situation in a few years, but I believe it hasn't changed. Strong encryption is considered "munitions" by the relevant government agency, and requires a permit to export. The set of rules it is covered under is the broad-ranging Export Administration Regulations (EAR), though on a quick look I can't tell which of the many rules covers it. The alphabetical index (http://www.access.gpo.gov/bis/ear/txt/indexccl.txt) does list the following: > Cryptanalytic equipment or devices, digital. . . . 5A002.a.2 > Cryptoanalytic equipment and components, n.e.s.. . . . 5A992 > Cryptographic equipment and components, n.e.s. . . . . 5A992 > Cryptography equipment or devices, digital . . . . 5A002.a.1 > Cryptography equipment or devices, analog. . . . . 5A002.a.3 > Cryptologic equipment, software for the development, production or use of5D992 > Cryptologic equipment and components, n.e.s. . . . . . 5A992 > Cryptologic equipment, technology for the development, production or use > of5E992 This might give you enough to go on to find the answer quickly, though. Cheers, kjw ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Implementing or Emulating TSRs in Win32 Console Apps
Hi Chris, and sorry for the delay. Chris Wagner wrote: U can do this by implementing ur own deceptively simple perl shell. U can set ur own single key commands, pass other commands off to cmd.exe Hey that's a great idea. I think this is the most straight forward solution particularly as I'm not really familiar with sockets or the select functions. official perl shell out there that u could also modify. print "Enter command: "; while ($text = ) { chomp $text; last unless $text; eval $text; print "\n"; print "Enter command: "; } exit; Thanks for the code. I think I've seen something similar in the context of the eval function. Is this shell really official in the sense of being included with ActiveState's Perl? I wish it would, kind of like Ruby's interactive irb shell. It's no big deal really but I wonder why you use the marginally shorter forms u and ur in stead of you and your. U renders quite well with a speech synth here, but ur is pretty much indistinguishable from err, . -- With kind regards Veli-Pekka Tätilä ([EMAIL PROTECTED]) Accessibility, game music, synthesizers and programming: http://www.student.oulu.fi/~vtatila/ ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Maill::Pop3Client
Great! I’ve installed all three modules – 1) Net::SSLeay 2) IO::Socket::SSL 3) Mail::POP3Client and everything connects ok. BUT, $pop->Count() everytime returns 0, even when there are new mails in my mailbox. Where is the shit? ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Need help with range operator
Thanks for the replies, folks! I got all kinds of responses. I've seen a "here's one way to do it," a "we could use more information on what you're trying to do," and a "this is not what the range operator was meant to do." It's kind of fascinating, really. List members use perl for different tasks, and our ideas vary a lot, it seems, on how perl should be used. Keeps things from getting boring. -- Craig --- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0611-2, 03/17/2006 Tested on: 3/17/2006 10:35:10 AM avast! - copyright (c) 1988-2004 ALWIL Software. http://www.avast.com ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Maill::Pop3Client - correction
Does anyone know if there's any legal issues with hosting encryption modules in the US? I run a farm of uber fast servers that I could add a PPM repository to for everyone. - Chris -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sisyphus Sent: Thursday, March 16, 2006 6:38 PM To: perl-win32-users@listserv.ActiveState.com Subject: Re: Maill::Pop3Client - correction I wrote: > ppm install http://theoryx5.uwinnipeg.ca/ppms/Net-SSLeay.ppd it should be: ppm install http://theoryx5.uwinnipeg.ca/ppms/Net_SSLeay.ppd (You need to replace the hyphen with an underscore.) Cheers, Rob ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Hash return value
At 04:40 PM 3/16/2006 -0700, Edwards, Mark (CXO) wrote: >The each function requires a hash as an argument. I would think that a >subroutine that returns a hash could be used as the argument, but it >doesn't work. Why? Is my syntax wrong or is that just the way Larry >made it? U have to evaluate it in hash context. This should work. while (($key, $value)= each( %{&mkhash()} )) { print("$key = $value\n"); } -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Need help with range operator
At 03:36 PM 3/16/2006 -0500, Craig Cardimon wrote: >I need to read a large text file line by line until a certain tag is >found, say . This tag will exist on a line by itself. Then I need >read in all subsequent lines, appending them to each other, until the >ending tag is found, again on a line by itself. That's not how the range operator was meant to be used. Its left argument must be something that can be incremented until it reaches the value of the right argument. What u need is a search loop. $which = 0; foreach $line (@lines) { $state = 1 and next if substr $line, 0, length "" eq ""; $state = 0 and ++$which if substr $line, 0, length "" eq ""; $matches[$which] .= $line if $state == 1; } That will make each element of @matches a string that contains everything within one tag. -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 0100 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs