Re: Getting started in Perl for Windows

2003-09-25 Thread R. Joseph Newton
"Dillon, John" wrote: > When I am in a black command.com screen with CPAN> prompt, where am I? Why > can't I cd to c:\? > > John You are in a CPAN shell, which you asked for in the command perl use_module(CPAN) execute(SHELL) or *something like that* :-) that you typed into the command line. Jo

Re: Getting started in Perl for Windows

2003-09-25 Thread R. Joseph Newton
"Dillon, John" wrote: > Is there a gobble-di-gook looker-upper for perl. For instance, if I don't > know what '@_' is saying, as in: > > my($email, $orig_email) = @_; You should read a Perl reference if you are going to use Perl. perldoc perlvar Joseph -- To unsubscribe, e-mail: [EMAIL PROT

Re: Should loops return a value?

2003-09-25 Thread R. Joseph Newton
Ville Jungman wrote: > Shortly, I think it might be good if loops (etc.) could return values. > > Example 1: Retnext (like 'return next' borrowed from pl/sql) > You want to extract numbers from an array if they are > 4 and put an > 'a'-letter after them. use strict; use warnings; > > >@value

Re: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread R. Joseph Newton
Dan Anderson wrote: > Is there an easy way to read into a stack until some pattern is > matched and then break. I tried all sorts of (error producing) code, > but nothing seemed to work. I ended up with: > > #! /usr/bin/perl > > #can I make this more concise? use strict; use warnings; # and te

Re: Basic question...

2003-09-25 Thread R. Joseph Newton
"NIPP, SCOTT V (SBCSI)" wrote: > I posted the other day a question about writing a daemon to monitor > a directory and then process the files as they arrive in said directory. I > will begin working on this shortly, but I have a related question and this I > think is mainly a question of

Re: How to autouse Statistics::Descriptive?

2003-09-25 Thread R. Joseph Newton
Hoenie Luk wrote: > Has anyone try to delay loading the Statistics module by using autouse? I > can't get it to work. So what does this have to do with "env vars using perl"? Please just give the address of this mailing list in your address book and send a fresh message. Reply features should

RE: Should loops return a value?

2003-09-25 Thread Ville Jungman
From: "Hanson, Rob" <[EMAIL PROTECTED]> If you really want a loop to return something, you can roll your own, even in Perl 5... but the syntax won't be as you gave. Ye - i'm not searching a way to solve a single problem but trying to make programming easier. If loops returned values it would make

Re: How to get the file name from a path

2003-09-25 Thread David Storrs
On Thu, Sep 25, 2003 at 05:15:56PM +0300, Juris wrote: > On Thu, 25 Sep 2003 12:10:15 +0530, Chetak Sasalu M > <[EMAIL PROTECTED]> wrote: > > > > >Hi, > >How can I extract "filename" from /root/dir1/.../filename > $path_name='/root/dir1/.../filename'; > my $fname=substr($path, > rindex($path,"/

Re: Do BEGIN blocks and END blocks have priority?

2003-09-25 Thread David Storrs
On Thu, Sep 25, 2003 at 09:12:48PM -0400, Dan Anderson wrote: > If I create code with: > > BEGIN > { ># something >BEGIN >{ > # something else >} > } > > Will the inner BEGIN block take precedence over the outer one, and thus > load any subroutines or whatever is in the inner

Re: Should loops return a value?

2003-09-25 Thread Ville Jungman
Ville Jungman wrote: Shortly, I think it might be good if loops (etc.) could return values. Yes, You're right John! A very good example! Which one would be more readable? This: @bigger_than_4= foreach $value(@values) { retnext $value."a" if $value > 4; } ; ...or this: @

RE: Should loops return a value?

2003-09-25 Thread Hanson, Rob
> Rob, did You read my message at all :-) ? I'm not telling. :P If you really want a loop to return something, you can roll your own, even in Perl 5... but the syntax won't be as you gave. How is this? The only difference is that you need to put the array to loop over after the code. it's clos

RE: Do BEGIN blocks and END blocks have priority?

2003-09-25 Thread Dan Anderson
What is really driving me bonkers is if I try the following code: use strict; use warnings; END { print "Look ma, i'm using subroutines!"; foo::foo(); } BEGIN { print "\nouter\n"; BEGIN { print "\ninner\n"; } } print "end\n"; BEGIN { package foo; foo(); BEGIN

RE: Should loops return a value?

2003-09-25 Thread Ville Jungman
Thanks, sounds much more exciting now. Perhaps I should read what they mean for those constructs but sounds very promising. ville jungman, 2 laureston crescent, tower, blarney, cork, ireland tel. + 353 - 21 - 451 6847, http://www.kolumbus.fi/vilmak usko Herraan Jeesukseen, niin sinä pelastut. (ap

Re: Should loops return a value?

2003-09-25 Thread John W. Krahn
Ville Jungman wrote: > > Shortly, I think it might be good if loops (etc.) could return values. > > Example 1: Retnext (like 'return next' borrowed from pl/sql) > You want to extract numbers from an array if they are > 4 and put an > 'a'-letter after them. > >@values=(1,3,5,7); >@bigger_

RE: Should loops return a value?

2003-09-25 Thread Ville Jungman
Rob, did You read my message at all :-) ? i just was wandering if there _could_ be more readable way to do this. Andnot only for to be readable. If loops (and maybe some other builtin commands, too - we are not talking only about whiles and for's) returned values, programming might be a way dif

RE: Do BEGIN blocks and END blocks have priority?

2003-09-25 Thread Hanson, Rob
> Will the inner BEGIN block take precedence over the outer one I dunno, but I guess I could check... print "Done\n"; BEGIN { print "Top begin\n"; } BEGIN { print "Outer\n"; BEGIN { print "Inner\n"; } } BEGIN { print "Bottom begin\n"; } This prints: Top begin Inner Outer Bottom be

Re: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread John W. Krahn
Dan Anderson wrote: > > Is there an easy way to read into a stack until some pattern is > matched and then break. I tried all sorts of (error producing) code, > but nothing seemed to work. I ended up with: > > #! /usr/bin/perl > > #can I make this more concise? > $infinite_loop = 1; > while (

Do BEGIN blocks and END blocks have priority?

2003-09-25 Thread Dan Anderson
If I create code with: BEGIN { # something BEGIN { # something else } } Will the inner BEGIN block take precedence over the outer one, and thus load any subroutines or whatever is in the inner begin block? Or will the second begin block be ignored and the compiler see: BEGIN {

RE: Should loops return a value?

2003-09-25 Thread Hanson, Rob
> Shortly, I think it might be good if > loops (etc.) could return values. BTW - One of the goals for Perl 6 is that you will be able to build any Perl construct in Perl itself. So also although Perl5, and probably Perl6, won't let you return values from a loop, you should at least be able to bui

RE: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Daniel Staal
--On Thursday, September 25, 2003 20:40 -0400 Dan Anderson <[EMAIL PROTECTED]> wrote: First, thank you for your help. Second, please bear with me as I'm a perl noob. I assume that $_ is the last thing gotten by . Nope. ;-) $_, in the context listed in his example, is the value of the

Re: How do I query whether a toplevel window exists?

2003-09-25 Thread David Storrs
> On Tue, Sep 23, 2003 at 12:04:05PM -0500, Robert Greenway wrote: > > have opened 3 additional toplevel windows in my application for input of > > optional parameters. How can I query if they exist, so I don't recreate > them > > and so I can process them when completed? > > On Wed, Sep 24, 2003

RE: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Hanson, Rob
> I assume that $_ is the last thing gotten by Yes, but there is a little more to it than that. Normally while() does NOT set $_. So this would not work normally: while ($foo) { print $_ } # $_ is NOT set At some point it was decided that most people will use a while loop to loop over the lin

RE: :StdHash

2003-09-25 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Raghupathy wrote: > Dear Friends, > >I have perl 5.6.0 for windoze and ppm 2.1.2. I like > to install Tie::Hash and Tie::StdHash (or the whole > Tie Bundle) on my PC but cannot find the modules in > the perl repositories I have setup. (ppm 2.1.2 does > not have a option to list the repositorie

Re: Getting started in Perl for Windows

2003-09-25 Thread Owen
On Thu, 25 Sep 2003 13:05:28 +0100 "Dillon, John" <[EMAIL PROTECTED]> wrote: > 'Can't locate Email/Find.pm in @INC <@INC contains: C:/Perl/lib > C:/Perl/site/lib.> at F:\getemails.ph line 1' > > Indeed line 1 does say: > > 'use Email::Find;' > > Hm. It seems I haven't installed Email::Find,

RE: Should loops return a value?

2003-09-25 Thread Hanson, Rob
> You want to extract numbers from an array > if they are > 4 and put an 'a'-letter after them. Try this... # tested @values = (1,3,5,7); @bigger_than_4 = map {$_.'a'} grep {$_>4} @values; print "@bigger_than_4"; > You need to escape a loop with a value. Not sure I understand what you are tryin

RE: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Dan Anderson
First, thank you for your help. Second, please bear with me as I'm a perl noob. I assume that $_ is the last thing gotten by . will regexes always default to using $_? I think that's right, but when I try: while (!( =~ /QUIT/)) { push @stack, $_; } print @stack; it doesn't pri

Re: OT: Can anyone recommend a good list where CSS talk would be acceptable

2003-09-25 Thread David Wall
--Dan Anderson wrote: I have some CSS questions. Can anyone recommend a good mailing list? How about usenet? Try comp.infosystems.www.authoring.stylesheets -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Motherofperls
while () { if (/QUIT/) { last; } push @thestack, $temp; }

RE: How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Hanson, Rob
> How can I do this? You can do it like this... # tested my @stack; while () { last if /QUIT/; push @stack, $_; } print "@stack"; Rob -Original Message- From: Dan Anderson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 25, 2003 8:23 PM To: Perl Newbies Subject: How do I to a

Should loops return a value?

2003-09-25 Thread Ville Jungman
Shortly, I think it might be good if loops (etc.) could return values. Example 1: Retnext (like 'return next' borrowed from pl/sql) You want to extract numbers from an array if they are > 4 and put an 'a'-letter after them. @values=(1,3,5,7); @bigger_than_4= # get

How do I to a stack until a pattern is matched, How do I

2003-09-25 Thread Dan Anderson
Is there an easy way to read into a stack until some pattern is matched and then break. I tried all sorts of (error producing) code, but nothing seemed to work. I ended up with: #! /usr/bin/perl #can I make this more concise? $infinite_loop = 1; while ($infinite_loop) { $temp = ; if ($temp

Tie::StdHash

2003-09-25 Thread Raghupathy
Dear Friends, I have perl 5.6.0 for windoze and ppm 2.1.2. I like to install Tie::Hash and Tie::StdHash (or the whole Tie Bundle) on my PC but cannot find the modules in the perl repositories I have setup. (ppm 2.1.2 does not have a option to list the repositories I have setup). Can anyon

Re: env vars using perl

2003-09-25 Thread Asif Iqbal
Thanks a lot, thats exactly what I wanted On Thu, 25 Sep 2003, Pete Emerson wrote: > Asif Iqbal wrote: > > > I can use this to get all the env variables > ... > > Now how can I use this trick to get all the web env variables ? I am using > > apache on unix (solaris 8) ? > > It's the same way. Her

RE: unzipping a record at a time

2003-09-25 Thread Wiggins d'Anconia
On Thu, 25 Sep 2003 16:03:27 -0500, "JOHN FISHER" <[EMAIL PROTECTED]> wrote: > I have successfully used zgrep in a script and loved every minute of it (still wet > behind the ears). > sub pulldata > { > my $data = `zgrep $key $wh

Re: unzipping a record at a time

2003-09-25 Thread John W. Krahn
John Fisher wrote: > > I have successfully used zgrep in a script and loved every minute of > it (still wet behind the ears). > sub pulldata > { > my $data = `zgrep $key $whichfile`; > print $data; > } > > That command ran thru the whole zip file and dumped all the

How to autouse Statistics::Descriptive?

2003-09-25 Thread Hoenie Luk
Has anyone try to delay loading the Statistics module by using autouse? I can't get it to work. The usual usage without autouse is this: use Statistics::Descriptive; $stat = Statistics::Descriptive::Sparse->new(); But if I autouse with this syntax: use autouse 'Statistics::Descriptive'; $stat = S

unzipping a record at a time

2003-09-25 Thread JOHN FISHER
I have successfully used zgrep in a script and loved every minute of it (still wet behind the ears). sub pulldata { my $data = `zgrep $key $whichfile`; print $data; } That command ran thru the whole zip file and dumped all the data, which for that app was just one

Re: env vars using perl

2003-09-25 Thread Pete Emerson
Asif Iqbal wrote: I can use this to get all the env variables ... Now how can I use this trick to get all the web env variables ? I am using apache on unix (solaris 8) ? It's the same way. Here's code that works for me: #!/usr/bin/perl -w use strict; use CGI qw(:standard); print header; print st

PDF content extraction

2003-09-25 Thread Pete Emerson
I've browsed CPAN. I've Googled. I'm stumped. I've successfully used PDF::Parse to get at PDF metadata. But I can't get at the content. Is there a way in perl to extract the contents of a PDF file? Last resort will be to use pdftotext or a similar converter, but if I can go native, so much the

env vars using perl

2003-09-25 Thread Asif Iqbal
Hi all I am a newbie in perl. I can use this to get all the env variables #!/bin/perl foreach $key ( sort keys %ENV ) { print "$key $ENV{$key}\n"; } Now how can I use this trick to get all the web env variables ? I am using apache on unix (solaris 8) ? Please help Thanks -- Asif Iq

RE: Basic question...

2003-09-25 Thread Hanson, Rob
> I see two ways of writing this code. Hmmm, how about a third way. The following code dynamically loads a module based on the extension of the file. If it successfully loads the module it instantiates a new object and calls the handle_file() method of the object. This accomplishes a few things

Re: How to get the file name from a path

2003-09-25 Thread Juris
On Thu, 25 Sep 2003 12:10:15 +0530, Chetak Sasalu M <[EMAIL PROTECTED]> wrote: Hi, How can I extract "filename" from /root/dir1/.../filename $path_name='/root/dir1/.../filename'; my $fname=substr($path, rindex($path,"/")+1,length($path)-rindex($path,"/")- 1); Cheers, Chetak. -- wbr, Juris -- To

Basic question...

2003-09-25 Thread NIPP, SCOTT V (SBCSI)
I posted the other day a question about writing a daemon to monitor a directory and then process the files as they arrive in said directory. I will begin working on this shortly, but I have a related question and this I think is mainly a question of good coding practice. Eventually, there

RE: Getting started in Perl for Windows

2003-09-25 Thread Thomas Bätzler
Dillon, John [mailto:[EMAIL PROTECTED] asked: > Is there a gobble-di-gook looker-upper for perl. For > instance, if I don't > know what '@_' is saying, as in: > > my($email, $orig_email) = @_; Look at the perlvar manpage. @_ is the array that has the parameters passed to a function. The above

RE: Please Help: Perl-TK: how to get a double-click in one Listbox?

2003-09-25 Thread Wiggins d'Anconia
On Thu, 25 Sep 2003 19:34:52 +0530, "Chetak Sasalu M" <[EMAIL PROTECTED]> wrote: > > Hi, > Any place to ask perl-xml questions and questions about schema? All of the lists hosted by perl.org are available on a Lists List page at: http://lists

RE: Please Help: Perl-TK: how to get a double-click in one Listbox?

2003-09-25 Thread Chetak Sasalu M
Hi, Any place to ask perl-xml questions and questions about schema? Thanks Chetak Ignore dis below ;-) -Original Message- From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED] Sent: Thursday, September 25, 2003 7:30 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: R

RE: Adding attributes to xml root element.

2003-09-25 Thread Wiggins d'Anconia
On Thu, 25 Sep 2003 12:15:18 +0530, "Chetak Sasalu M" <[EMAIL PROTECTED]> wrote: > > Namaskara! > >Can anybody suggest a simple way to add or remove an attribute to the > root element in an xml file ? > Check out the XML::Simple module fr

RE: Please Help: Perl-TK: how to get a double-click in one Listbox?

2003-09-25 Thread Wiggins d'Anconia
On Thu, 25 Sep 2003 08:09:23 +0200, [EMAIL PROTECTED] wrote: > > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 24, 2003 3:29 PM > To: [EMAIL PROTECTED] > Subject: Perl-TK: how to get

RE: Getting started in Perl for Windows

2003-09-25 Thread Thomas Bätzler
Dillon, John [mailto:[EMAIL PROTECTED] asked: > When I am in a black command.com screen with CPAN> prompt, > where am I? Why can't I cd to c:\? That would be the CPAN prompt. Try "help" for a terse command listing, "quit" to exit back to the DOS prompt. CPAN is the Perl module installer. Check

RE: Getting started in Perl for Windows

2003-09-25 Thread Dillon, John
I'm getting the idea that CPAN is a gateway from the command screen to the world wide network of ftp sites. I tried 'perl -MCPAN -e shell' and 'install Email::Find' and got a lot of activity. But going back to c:\ and running my 'getemails.pl' file, I get: 'Can't locate Email/Find.pm in @INC <@I

RE: Getting started in Perl for Windows

2003-09-25 Thread Stephen Hardisty
> When I am in a black command.com screen with CPAN> prompt, where am I? Why can't I cd to c:\? Because you're in the CPAN shell. You can ues this to download and install CPAN Perl modules. If you type: install Email::Find You can go back to the command prompt by typing 'exit' and get help by t

RE: Getting started in Perl for Windows

2003-09-25 Thread Dillon, John
When I am in a black command.com screen with CPAN> prompt, where am I? Why can't I cd to c:\? John    http://www.cantor.com CONFIDENTIAL: This e-mail, including its contents and attachments, if any, are confiden

RE: Getting started in Perl for Windows

2003-09-25 Thread Dillon, John
Is there a gobble-di-gook looker-upper for perl. For instance, if I don't know what '@_' is saying, as in: my($email, $orig_email) = @_; getting there... -Original Message- From: Stephen Hardisty [mailto:[EMAIL PROTECTED] Sent: 25 September 2003 11:43 To: Stephen Hardisty; Dillon, John;

Re: One Time Only Code in Sub

2003-09-25 Thread Rob Dixon
James Edward Gray II wrote: > > I would like to add some code to a sub that only needs to be run > the first time the sub executes, or before is fine. If I add an > INIT { } block at the beginning of the sub, would that do it? > > Are there other ways? Nobody seems to be encouraging you to go f

RE: Getting started in Perl for Windows

2003-09-25 Thread Stephen Hardisty
> If ppm doesn't work, try 'perl -MCPAN -s shell'. Oops, it's 'perl -MCPAN -e shell'. This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security s

RE: Getting started in Perl for Windows

2003-09-25 Thread Stephen Hardisty
Hi, it's 'Email::Find'. You can get information on this from: http://search.cpan.org/author/MIYAGAWA/Email-Find-0.09/lib/Email/Find.pm If ppm doesn't work, try 'perl -MCPAN -s shell'. Cheers! -Original Message- From: Dillon, John [mailto:[EMAIL PROTECTED] Sent: 25 September 2003 11:24 To

RE: Getting started in Perl for Windows

2003-09-25 Thread Dillon, John
What I am eventually trying to do is get the email addresses from my Outlook into a list. I found the following example for Eudora which I want to adapt, unless you know an easier way: perl -Memail::find -ne 'email::find->new(sub { print shift->address, "\n" })->find(\$_)' file.mbx > output.txt

RE: Writing a daemon in Perl...

2003-09-25 Thread TN
Yes, a while loop that does not terminate how I would write a daemon (in any language). Suggest having it touch a "heartbeat" file every cycle and/or write state data to this file for monitoring and if you are running it on Unix/Linux put it under daemontools (http://cr.yp.to/daemontools.html) for

hostname for LWP

2003-09-25 Thread George Georgalis
Hi - I just installed perl-5.8.0 from source, in the shell (perl -MCPAN -e shell) I tried to "install LWP" but had some problems until I added an *incorrect* hostname to the 127.0.0.1 line in /etc/hosts my resolver provides correct reverse dns, how do I use that? and how do I manually set the hos