[23730] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5936 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Dec 13 14:05:43 2003

Date: Sat, 13 Dec 2003 11:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sat, 13 Dec 2003     Volume: 10 Number: 5936

Today's topics:
        [newbie] simple substitution/matching <sean_don4@yahoo.com>
    Re: [newbie] simple substitution/matching <tassilo.parseval@rwth-aachen.de>
    Re: [newbie] simple substitution/matching <REMOVEsdnCAPS@comcast.net>
    Re: [newbie] simple substitution/matching <sean_don4@yahoo.com>
    Re: Concatenation Question <ccarpenter@erols.com>
    Re: Concatenation Question <ccarpenter@erols.com>
    Re: Concatenation Question <ccarpenter@erols.com>
    Re: Concatenation Question (Tad McClellan)
    Re: Concatenation Question <matthew.garrish@sympatico.ca>
    Re: How to map URL to %xx? <perl@my-header.org>
    Re: how to read data from EXCEL <noreply@gunnar.cc>
    Re: How to write MIME header for application/x-javascri <noreply@gunnar.cc>
    Re: How to write MIME header for application/x-javascri (William Herrera)
    Re: LWP install MacOS X <henryn@zzzspacebbs.com>
        MakeMaker bug in 5.8.0 (Robert Nicholson)
    Re: Newsgroup Searching Program <seawolf@attglobal.net>
    Re: Newsgroup Searching Program <asu1@c-o-r-n-e-l-l.edu>
    Re: Newsgroup Searching Program <seawolf@attglobal.net>
    Re: package install trouble <tassilo.parseval@rwth-aachen.de>
    Re: Passing a hash by reference <REMOVEsdnCAPS@comcast.net>
    Re: Passing a hash by reference <raisin@delete-this-trash.mts.net>
    Re: recursive closures? <bik.mido@tiscalinet.it>
    Re: recursive closures? <tassilo.parseval@rwth-aachen.de>
    Re: REQUEST: Problem with Perl (Win32) on Windows98SE a (Tad McClellan)
        Tutorials/examples for SAX2 with Perl <shiva.blacklist@sewingwitch.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Sat, 13 Dec 2003 09:47:43 GMT
From: Sean Don <sean_don4@yahoo.com>
Subject: [newbie] simple substitution/matching
Message-Id: <3fBCb.1429$0s2.1068@newsread2.news.pas.earthlink.net>

Hi,

I'm learning perl and trying to write a simple VCARD to Mutt alias
converter.  I feel a little dumb having to ask, but I can't figure it
out and it's getting frustrating. I looked up some perl examples
including a perl script that is supposed to do this, but it didn't work
quite right. 


I have this:

$_ = "N:Lastname;Firstname;M.";

s/^N://go;
s/.*;//go;

print $_;


It outputs this:

M.


However, I want it to output this:

Firstname


Thank You In Advance,
~ Sean ~



------------------------------

Date: 13 Dec 2003 10:14:41 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: [newbie] simple substitution/matching
Message-Id: <breoqh$9if$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Sean Don:

> I'm learning perl and trying to write a simple VCARD to Mutt alias
> converter.  I feel a little dumb having to ask, but I can't figure it
> out and it's getting frustrating. I looked up some perl examples
> including a perl script that is supposed to do this, but it didn't work
> quite right. 
> 
> 
> I have this:
> 
> $_ = "N:Lastname;Firstname;M.";
> 
> s/^N://go;
> s/.*;//go;
> 
> print $_;
> 
> 
> It outputs this:
> 
> M.
> 
> 
> However, I want it to output this:
> 
> Firstname

Greediness is the keyword here. When you have

    /.*;/

this will match everything up to the _last_ occurance of ';'. You
however only want to match to the first occurance:

    /.*?;/

The '?', when modifying a quantifier such as '*', '+' and even '?'
itself, will make the match as short as possible.

But maybe all you want is an ordinary match in list context:

    my ($last, $first, $initial) = /^N:(.*?);(.*?);(.*)/;

which is short for

    my ($last, $first, $initial) = $_ =~ /^N:(.*?);(.*?);(.*)/;
    
and roughly translates into

    my ($last, $first, $initial);
    if ($_ =~ /^N:(.*?);(.*?);(.*)/) {  # only if match is sucessful
        $last    = $1;
        $first   = $2;
        $initial = $2;
    }
    
Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Sat, 13 Dec 2003 09:07:42 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: [newbie] simple substitution/matching
Message-Id: <Xns945066FDE499Asdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

Sean Don <sean_don4@yahoo.com> wrote in
news:3fBCb.1429$0s2.1068@newsread2.news.pas.earthlink.net:

> I have this:
> 
> $_ = "N:Lastname;Firstname;M.";
> 
> s/^N://go;
> s/.*;//go;

The g and o options do nothing in the above cases.

> s/^N://go;

This means:
  s/
    ^    Start at the beginning of the string
    N:   Match a "N" and a ":"
  //     And replace it with nothing (ie, remove it).

Okay, fine.

> s/.*;//go;

This means:
  s/
    .*   Match 0 or more characters (as many as possible)
    ;    Followed by a semicolon
  //     And replace them with nothing


> However, I want it to output this:
> 
> Firstname

I would suggest this:   /^N:([^;]*);([^;]*);/

It's a bit more complex, but it means:

    ^    Start at the beginning of the string
    N:   Match "N:" literally
    (    Start a capture group
    [^;]*   Match 0 or more non-semicolon characters
    )    End the first capture group
    ;    Match a literal semicolon
    (    Start the second capture group
    [^;]*   Match 0 or more non-semicolon characters
    )    End the first capture group
    ;    Match a literal semicolon

After you match against this pattern, if the match is successful, the
lastname will be in $1 and the firstname will be in $2:

    if (/^N:([^;]*);([^;]*);/)   # Always test that the match
worked!
    {
        #  do stuff with $1, $2
    }

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD4DBQE/2ystY96i4h5M0egRAtIgAKDKVEePYxU0+rHvzEdO8e6AuHN6dACYtLD8
qsZ+Bg6KNUHk0a+h9iNigA==
=+dBm
-----END PGP SIGNATURE-----


------------------------------

Date: Sat, 13 Dec 2003 18:42:17 GMT
From: Sean Don <sean_don4@yahoo.com>
Subject: Re: [newbie] simple substitution/matching
Message-Id: <d4JCb.2293$0s2.1820@newsread2.news.pas.earthlink.net>

Hi,

Thanks for the replies.

I guess I was hoping that the "g" option would prevent multiple matching
in this case, but I've been corrected.

Thanks Again,
~ Sean ~



------------------------------

Date: Sat, 13 Dec 2003 12:45:49 GMT
From: "Chip" <ccarpenter@erols.com>
Subject: Re: Concatenation Question
Message-Id: <1SDCb.567$xH2.445024@news1.news.adelphia.net>

Thanks Nick,

It was the "\n".
I was getting:

 ../images/12345
 .jpguser@server#

giving me the .jpg before the prompt.
Sorry I missed that.
I did not cut and paste the code,
just typed it in for illistrative
purposes.
Here is the code:
(cut and paste)
#!/usr/bin/perl -w
print "Please enter the number to be removed: ";
my $number=<STDIN>;
chomp($number);
my $path='../images/';
my $ext='.jpg';
my $picture = $path . $number . '.jpg';
system "rm $picture";
print "$picture has been removed\n";

It works fine now.
Thanks again for your help
Chip


"Nick Santos" <DSX@comcast.net> wrote in message
news:j_vCb.379074$ao4.1265853@attbi_s51...
>
> "Chip" <ccarpenter@erols.com> wrote in message
> news:jLvCb.456$xH2.307902@news1.news.adelphia.net...
> > How can I add a ".jpg" extension to a string?
> >
> > I'm trying the following with 12345 as the input.
> >
> > #!/usr/bin/perl -w
> > print "Please enter the item picture number to remove: ";
> > my $number=<STDIN>;
> > my $path=http://someplace.com/images/;
> > my $ext=".jpg";
> > my $picture="$path . $number . $ext";
> > system rm $picture;
> > print  "$picture has been removed";
> > __END__
> >
> > The output I'm hoping for is:
> > http://someplace.com/images/12345.jpg has been removed
> >
> > What I get is:
> > http://someplace.com/images/12345 has been removed
> >
> > How do I add the ".jpg"
> >
> > Thanks
> > Chip
> >
> Ok, I put this code into my interpreter, and it founf a problem with your
> $path declaration. Other than that, what you need is to put this in before
> you declare $picture
>
> chomp ($number);
>
> so your code will look like this
>
>  print "Please enter the item picture number to remove: ";
>  my $number=<STDIN>;
>  my $path='http://someplace.com/images/';
>  my $ext='.jpg';
>  chomp ($number);
>  my $picture="$path$number$ext";
>  print  "$picture has been removed";
>
> That should give you output of
>
> http://someplace.com/images/12345 has been removed
>
>




------------------------------

Date: Sat, 13 Dec 2003 12:50:37 GMT
From: "Chip" <ccarpenter@erols.com>
Subject: Re: Concatenation Question
Message-Id: <xWDCb.569$xH2.446200@news1.news.adelphia.net>

Thanks Matt for your reply,

I should have cut and pasted the code
instead of just typing in what I did.

You are right in that the code was giving me
the carrage return displaying the .jpg before
the prompt on the new line.

Adding the chomp fixed it.
Thanks Again
Chip

"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:U%vCb.16250$aF2.1846115@news20.bellglobal.com...
>
> "Chip" <ccarpenter@erols.com> wrote in message
> news:jLvCb.456$xH2.307902@news1.news.adelphia.net...
> > How can I add a ".jpg" extension to a string?
> >
> > I'm trying the following with 12345 as the input.
> >
> > #!/usr/bin/perl -w
> > print "Please enter the item picture number to remove: ";
> > my $number=<STDIN>;
> > my $path=http://someplace.com/images/;
> > my $ext=".jpg";
> > my $picture="$path . $number . $ext";
> > system rm $picture;
> > print  "$picture has been removed";
> > __END__
> >
> > The output I'm hoping for is:
> > http://someplace.com/images/12345.jpg has been removed
> >
> > What I get is:
> > http://someplace.com/images/12345 has been removed
> >
>
> You couldn't possibly be getting that output based on the code above. For
> one, it would never run because your $path variable is not quoted. Second,
> when you read  from STDIN, you also get the carriage return (\n). Third,
> your extension is statically defined, so it must appear somewhere in your
> output. And finally, you're not concatenating your string when you put it
in
> double quotes. Fixing your above code to run produces the following
result:
>
> http://someplace.com/images/ . 12345
>  . .jpg has been removed
>
> If you post your real code, someone might be able to help you.
>
> Matt
>
>




------------------------------

Date: Sat, 13 Dec 2003 13:12:14 GMT
From: "Chip" <ccarpenter@erols.com>
Subject: Re: Concatenation Question
Message-Id: <OeECb.576$xH2.451332@news1.news.adelphia.net>

Thanks Jürgen,

Sorry for not cut and pasting!
Here is the code now:
#!/usr/bin/perl -w
print "Please enter the number to be removed: ";
my $number=<STDIN>;
chomp($number);    #was the problem
my $path='../images/';
my $ext='.jpg';
my $picture = $path.$number.$ext;
system "rm $picture";
print "$picture has been removed\n";

As far as the system call,
I'll change
system "rm $picture";
to
unlink "$picture";

Thanks
Chip

"Jürgen Exner" <jurgenex@hotmail.com> wrote in message
news:JOwCb.1039$gk1.711@nwrddc01.gnilink.net...
> You do? Most interesting! I am getting:
>
> Unquoted string "http" may clash with future reserved word at C:\tmp\t.pl
> line 4.
> Bareword found where operator expected at C:\tmp\t.pl line 4, near
> "//someplace"
>         (Missing operator before eplace?)
> Unquoted string "eplace" may clash with future reserved word at
C:\tmp\t.pl
> line 4.
> Unquoted string "com" may clash with future reserved word at C:\tmp\t.pl
> line 4.
> Unquoted string "images" may clash with future reserved word at
C:\tmp\t.pl
> line 4.
> syntax error at C:\tmp\t.pl line 4, near "http:"
> Execution of C:\tmp\t.pl aborted due to compilation errors.
>
> If you fix the syntax error (hint hint: do not retype your code, copy and
> paste it!) and comment out the bogus "system" call, then I get (in two
> lines!):
>     http://someplace.com/images/ . 123
>      . .jpg has been removed
> from the one single print statement.
>
> > How do I add the ".jpg"
>
> First of all you don't want to add something but you want to get rid of
that
> superflous line break from your input line: perldoc -f chomp
>
> And then you want to get rid of those additional spaces when defining
> $mypicture. Why did you put them in there?
>
> And then you can use either a string
>     my $picture="$path$number$ext";
> or a concatenation
>     my $picture=$path . $number . $ext;
> but dots inside of a string are just that: dots.
>
> Inserting slashes in the proper places is left as an excercise.
>
> As far as the bogus system call is concerned: Did you mean something like
>     system "rm $mypicture";
> If yes then I wonder why you are forking off an external process instead
of
> using Perl's unlink() command.
>
> jue
>
>




------------------------------

Date: Sat, 13 Dec 2003 08:05:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Concatenation Question
Message-Id: <slrnbtm75f.4ml.tadmc@magna.augustmail.com>

Chip <ccarpenter@erols.com> wrote:

> Sorry for not cut and pasting!


Have you seen the Posting Guidelines that are posted here frequently?


> Here is the code now:
> #!/usr/bin/perl -w

   use strict;  # ask for all the help you can get


> I'll change
> system "rm $picture";
> to
> unlink "$picture";


Don't do that, as your proposed replacement has two errors in it too.

You have a useless use of double quotes, and you may want to check
to see if you actually got what you asked for by checking the
return value:

   unlink $picture or die "could not remove '$picture'  $!";




[snip 50 lines of TOFU. 
 Please learn the accepted way of composing a followup.]

-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 13 Dec 2003 11:37:45 -0500
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Concatenation Question
Message-Id: <lfHCb.18127$aF2.2144043@news20.bellglobal.com>


"Chip" <ccarpenter@erols.com> wrote in message
news:xWDCb.569$xH2.446200@news1.news.adelphia.net...
> Thanks Matt for your reply,
>
> I should have cut and pasted the code
> instead of just typing in what I did.
>
> You are right in that the code was giving me
> the carrage return displaying the .jpg before
> the prompt on the new line.
>
> Adding the chomp fixed it.

But there was no way to know that for sure from the code you posted, which
is why you should always post your exact code. From the question you were
asking, it sounded like your $ext variable did not contain a value, not that
you were having a problem with the carriage return. It was especially bad
that you paraphrased the output, as that only seemed to confirm that the
code you were using was significantly different from the code you posted.
So, as you've been told many times now, make sure to be precise about your
code and what it does in any future posts.

Matt




------------------------------

Date: Sat, 13 Dec 2003 10:36:17 +0100
From: Matija Papec <perl@my-header.org>
Subject: Re: How to map URL to %xx?
Message-Id: <pbnltvobacgcihlbhnsvgg0psnbbubu80o@4ax.com>

X-Ftn-To: Chris Mattern 

Chris Mattern <syscjm@gwu.edu> wrote:
>> So, you just wanted to share your thoughts with the world? :)
>> 
>Well, posting the answer to your own question if you find it elsewhere
>is good netiquette; you have to give him credit for that, even if his
>attitude towards understanding the code he uses is horrible.

Indeed, there is a good reading which covers more aspects of such attitude
http://www.sampioni.com/en/zasto_sampioni.htm


-- 
Matija


------------------------------

Date: Sat, 13 Dec 2003 13:10:56 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: how to read data from EXCEL
Message-Id: <brevpu$2nao7$1@ID-184292.news.uni-berlin.de>

[ Please do not top post! You should study the posting guidelines for
this group:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html ]

Carlo Cazzaniga wrote:
> Gunnar Hjalmarsson wrote:
>> Carlo Cazzaniga wrote:
>>> I need to read data from EXCEL worksheets...
>> 
>> Use the CPAN module Spreadsheet::ParseExcel::Simple.
> 
> Thanks ,
> but I'm not an expert , my environment is NT, thweversion of perl
> is 5
> How can  I call the the mentioned Cpan module,
> I don't use visual perl or other recently version.
> I have coded a simple script..

I'm not sure what you want to say with that. "Expert" or not, if you
want to read data from an Excel file, you'd better use a non-standard
module, and if it wasn't installed before, you need to install that
module as well as a couple of other modules that it is dependent on.

Actually, before answering your question, I did just that. These were
the modules I installed:

     Spreadsheet::ParseExcel
     OLE::Storage_Lite
     IO::Stringy
     Spreadsheet::ParseExcel::Simple

I used the CPAN module, which worked fine in this case even if I'm on
a Windows platform (W98), since none of those modules requires
compilation.

http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq8/How_do_I_install_a_module_from_CPAN.html

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sat, 13 Dec 2003 15:18:20 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to write MIME header for application/x-javascript?
Message-Id: <brf79j$2m27i$1@ID-184292.news.uni-berlin.de>

Fengshui wrote:
> I remember every CGI output must start as this:
> 
> print "text/html\n\n";

Then you remember wrong. The most common line in CGI scripts for
printing a HTTP header looks like this:

     print "Content-type: text/html\n\n";

> I need to write a perl to let the client know it is a 
> application/x-javascript file.

"Write a perl"? Do you possibly mean that you want to use the Perl
programming language for writing a CGI script?

And what is "it"?? Do you possibly want your CGI script output a HTML
page which shall call some JavaScript within <script></script> tags?
If that is the case, you shall not print anything but the usual
text/html content-type header. Another thing is that you need to let
the markup include something like this:

     <script type="text/javascript" src="xxxx.js"></script>

> What I try to do is that within the HTML page, there will be
> request for extenal .js files, but I want the SRC="xxxx.cgi" and
> let the Perl script to out put the .js file.
> 
> Anyone done this before?

Well, I have not. I may be wrong, but I have a feeling that it can't
be done.

Maybe you should explain the reason why you want do do that. But if
you want to continue the discussion, you'd better do it in a more
appropriate newsgroup, such as comp.infosystems.www.authoring.cgi.
This group is for discussing Perl.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



------------------------------

Date: Sat, 13 Dec 2003 16:17:42 GMT
From: posting.account@lynxview.com (William Herrera)
Subject: Re: How to write MIME header for application/x-javascript?
Message-Id: <3fdb3a31.211294663@news2.news.adelphia.net>

On Sat, 13 Dec 2003 06:34:58 GMT, "Fengshui" <test@test.com> wrote:

>I remember every CGI output must start as this:
>
>print "text/html\n\n";
>
>I guess what it does is it tells the client the type of the document as text
>or html
>
>I need to write a perl to let the client know it is a
>application/x-javascript file.
>

If you want to use perl to output a javascript file, you need to do something
like this with the perl CGI:

 ...
use CGI;
my $query = new CGI;
print $query->header(
  -type=>'application/x-javascript',
  -attachment=>'java.js'
);

print ... you print the .js file here ....
 ...etc.



>What I try to do is that within the HTML page, there will be request for
>extenal .js files, but I want the SRC="   x.cgi" and let the Perl script to
>out put the .js file.
>
>Anyone done this before?

Yes, with zip files. Question, though: why not let the web server handle it?
The only reason I ever did this was to send a file I'd made on the fly. If your
 .js files are already made up, let the web server do what it was made for, and
just put links to the .js stuff in your other pages.

HTH,

--------
perl -MCrypt::Rot13 -e "$m=new Crypt::Rot13;$m->charge('WhfgNabgureCreyUnpxre');print $m->rot13;"


------------------------------

Date: Sat, 13 Dec 2003 16:55:55 GMT
From: Henry <henryn@zzzspacebbs.com>
Subject: Re: LWP install MacOS X
Message-Id: <BC008499.19426%henryn@zzzspacebbs.com>

Sherm:

Thanks for your response on this thread:

in article giuCb.431$xH2.283611@news1.news.adelphia.net, Sherm Pendley at
spamfilter@dot-app.org wrote on 12/12/03 5:53 PM:

> Henry wrote:
> 
>> I had your your post open on the desktop as I worked.  I _thought_ I was
>> doing what you said.
> 
> Sorry, my bad. I gave you outdated advice. :-(

No problem.
 
> Once upon a time, installing Bundle::CPAN would tickle the bug, whereas
> installing just CPAN would not. So, the workaround was to install just
> the module by itself, and once the module had been upgraded to a version
> that didn't have the bug, then install the bundle.

Right, thanks for letting me know.
> 
> As it happens, I've done some housecleaning recently, so I had a clean
> Jaguar installation on another partition. So I booted into that and
> tried upgrading CPAN.pm just to be certain, and sure enough, that
> work-around no longer does the trick.

Glad to hear we're working on the same OS --a very decent environment, I
think-- and ...impressive that you have taken this level of precautions.   I
have a hard drive just for backup, but I've never tried keeping a clean OS X
on it.

Thanks for going to the trouble of checking this for me!
> 
> There are still some options - reconfiguring the CPAN shell to ask
> before resolving dependencies, or not to resolve them at all, or
> installing CPAN.pm by hand.

"By hand..." Sure, no problem.  I can do that, assuming there are few or no
dependencies to resolve.   Actually, it's a lot less intimidating to me than
using the CPAN shell.
> 
> But you've indicated that you're not really interested in developing in
> Perl, you just want to write a quick little script to get a job done.

Did I say that?   

Please give me some middle ground.  I picked a big project, did some
research, and discovered Perl offers the best tools to do help me do the
job, overall.     Since then, I've been learning Perl by using it
intensively.

The only thing I new about Perl at the outset was that it had existed, and I
had two books about it ("Perl by Example" by Quigley and "Learning Perl" by
Schwartz), which I bought several years ago against the possibility that I
would eventually need Perl.

Do I want to make Perl a life's work?  No.   But I'm going to end up with a
significant chunk of what I hope to be reasonably good Perl code.  That
means I need to learn the details, the idiom, the philosophy, and --yes-- a
bit about maintaining the environment.   To be sure, I'd rather spend _less_
time on maintenance ...

If I've understood the Perl "philosophy"  correctly, it would not be an
affront to throw together a quick little script to get a job done, not in
the least, but --no, this is a serious effort.

> With that in mind, upgrading CPAN.pm might be more trouble than it's
> worth to you. If all you want is to install LWP, the CPAN.pm version
> that you already have is perfectly capable of doing that.

Right.  I suspected that.  But I'm not sure, and I'd like to be a bit more
certain, at least.   Maybe CPAN.pm (better terminology, thanks!) will make
navigating the dependencies easier.

OK, so I'll ask explicitly:  Given version 'n' of a particular module is
installed on your system, and you've found new module 'm',  how can one
figure out the importance--necessity-- advisability-- safety--chances of
success of installing the newer one?

This goes beyond finding a list saying "version m fixes _these_ bugs, and
adds _those_ features"  but it is at the heart of the job of maintaining a
particular installation.

Same question for the next dot revision of Perl itself.
> 
>>> The latest LWP version takes case-insensitive filesystems
>>> into account, and will ask you before installing /usr/bin/HEAD. When it
>>> asks about that, simply tell it not to.
>> 
>> Yes, I can try.
> 
> FWIW, While I was experimenting with Jaguar, I installed Bundle::LWP
> too. The current version doesn't try to install /usr/bin/HEAD unless you
> specifically ask it to. When it asks if you want to install it, the
> default is "n".

OK, thanks for the info.  I'm still a little bit worried about this
exception case.  I've been bitten by case-dependency before.

Hmmm, I found a description of Bundle::LWP in the perl docs: "This bundle
defines all reqreq modules for libwww-perl."  OK...   I guess there are
individual modules and bundles of related modules -- I probably want the
bundle.   I guess (hope) "reqreq" is a typo.
> 
> So basically, what you're left with is, don't bother upgrading the CPAN
> shell if all you want is to install LWP. The bug in LWP has been fixed,
> so simply entering "install Bundle::LWP" and accepting all the defaults
> will safely install it.

Hmmmm,  I don't think that I have anything to add beyond LWP, but --gosh--
there are a lot of _very_ interesting modules in CPAN, and I don't want to
be afraid of/limited from using anything further because I haven't done
reasonable work at this point.

I think I'll follow your earlier suggestion, if that's ok:  Install the
newest CPAN module by hand.  I _hope_ that goes uneventfully!

Thanks,

Henry

henryn@zzzspacebbs.com  remove 'zzz'



> 
> sherm--



------------------------------

Date: 13 Dec 2003 09:29:13 -0800
From: robert@elastica.com (Robert Nicholson)
Subject: MakeMaker bug in 5.8.0
Message-Id: <24a182bd.0312130929.1118cd79@posting.google.com>

So, whenever it creates a doc_site_install rule it uses

doc_site_install ::
        -@$(MKPATH) $(INSTALLARCHLIB)
        -@$(DOC_INSTALL) \
                "Module" "$(NAME)" \
                "installed into" "$(INSTALLSITELIB)" \
                LINKTYPE "$(LINKTYPE)" \
                VERSION "$(VERSION)" \
                EXE_FILES "$(EXE_FILES)" \
                >> $(INSTALLSITEARCH)/perllocal.pod


That MKPATH should be using INSTALLSITEARCH

Can somebody tell me the reasons for the following in ExtUtils/MakeMaker/CHANGES?

6.10_07 Sat Jul  5 16:12:52 PDT 2003
    * Fixing location of perllocal.pod so its always in INSTALLARCHLIB
      instead of one for each perl, site and vendor.


------------------------------

Date: Sat, 13 Dec 2003 09:51:48 GMT
From: Les Hazelton <seawolf@attglobal.net>
Subject: Re: Newsgroup Searching Program
Message-Id: <pan.2003.12.13.09.51.42.572123@attglobal.net>

On Sat, 13 Dec 2003 07:01:32 +0000, Gerard Lanois wrote:

> Les Hazelton <seawolf@attglobal.net> writes:
> 
>> $port     = '563';
>>  $nntp = Net::NNTP->new($SERVER, Debug=>0, Port=>$port) or die "Can't
>>  connect to server $SERVER: $!\n";
>>
>> Did I misunderstand how to supply the port number or ??
> 
> Looks good the way you have it.
> 
> Let's take Perl out of the equation.
> 
> What happens if you telnet into port 563 on the server?
> 
> You should be able to speak raw NNTP commands to it.  And you might get
> some useful error messages.
> 
> -Gerard

I gave it a try.  It made the connection and then hung until I escaped and
closed the connection.  Without the port number the connection never
completed.

---------
Farpoint:/home/lrh # telnet  inetnews.worldnet.att.net 563
Trying 204.127.161.11...
Connected to inetnews.worldnet.att.net.
Escape character is '^]'.
^]
telnet> q
Connection closed.
Farpoint:/home/lrh #
-------------

Also, if I run the perl script on a system where stunnel is active, it
works. Then, the $SERVER is set to "localhost" and a default port number.
Stunnel intercepts the call to localhost:119 and converts it to an ssl
connection on inetnews.worldnet.att.net:563. Applications like Pan or
Kmail which allow you to specify both hostname and port number connect
correctly.


-- 
Les Hazelton
--- Registered Linux user # 272996 ---




------------------------------

Date: 13 Dec 2003 16:11:23 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Newsgroup Searching Program
Message-Id: <Xns945071D42BD80asu1cornelledu@132.236.56.8>

Les Hazelton <seawolf@attglobal.net> wrote in
news:pan.2003.12.12.20.42.30.812878@attglobal.net: 

> I appreciate the reply. I tried your suggestion, but it did not work
> for me.  Just in case I had written my script incorrectly I copied the
> one from the group thread and tired it.  Same result.  The error I get
> is: 
> 
> lrh@Farpoint:~> ./read-news-new-cl.pl
> Can't connect to server inetnews.worldnet.att.net: Bad file descriptor
> lrh@Farpoint:~>

hmmmm ...

>  $nntp = Net::NNTP->new($SERVER, Debug=>0, Port=>$port)
>  or die "Can't connect to server $SERVER: $!\n";

I am going to suggest changing the line above to:

or die "Can't connect to server $SERVER: " $!, $@;

just in case there is a better error message in $@ coming from the 
IO::Socket module.

Sinan.

-- 
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov


------------------------------

Date: Sat, 13 Dec 2003 17:23:54 GMT
From: Les Hazelton <seawolf@attglobal.net>
Subject: Re: Newsgroup Searching Program
Message-Id: <pan.2003.12.13.17.23.49.63381@attglobal.net>

On Sat, 13 Dec 2003 16:11:23 +0000, A. Sinan Unur wrote:

> Les Hazelton <seawolf@attglobal.net> wrote in
> news:pan.2003.12.12.20.42.30.812878@attglobal.net: 
> 
>> I appreciate the reply. I tried your suggestion, but it did not work
>> for me.  Just in case I had written my script incorrectly I copied the
>> one from the group thread and tired it.  Same result.  The error I get
>> is: 
>> 
>> lrh@Farpoint:~> ./read-news-new-cl.pl
>> Can't connect to server inetnews.worldnet.att.net: Bad file descriptor
>> lrh@Farpoint:~>
> 
> hmmmm ...
> 
>>  $nntp = Net::NNTP->new($SERVER, Debug=>0, Port=>$port)
>>  or die "Can't connect to server $SERVER: $!\n";
> 
> I am going to suggest changing the line above to:
> 
> or die "Can't connect to server $SERVER: " $!, $@;
> 
> just in case there is a better error message in $@ coming from the 
> IO::Socket module.
> 
> Sinan.

Sinan,

Did as you suggested, with the following results:
------------- new code -----------------
 # declare new Net::NNTP object - or die with a connection failure
 # message
 $nntp = Net::NNTP->new($SERVER, Debug=>0, Port=>$port)
 or die "Can't connect to server $SERVER: [$!]-[$@]\n";
------------- end code -----------------

lrh@Farpoint:~> ./read-news-new.pl
Can't connect to server inetnews.worldnet.att.net: [Bad file descriptor]-[]
lrh@Farpoint:~>


-- 
Les Hazelton
--- Registered Linux user # 272996 ---



------------------------------

Date: 13 Dec 2003 08:27:26 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: package install trouble
Message-Id: <breihe$56l$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Tony Curtis:
>>> On Fri, 12 Dec 2003 22:40:19 +0100,
>>> ngoc <linh@chello.no> said:
> 
>> Hi I install Compress::Zlib in Solaris.
>>> perl Makefile.PL make
>> error message: /usr/ucb/CC language optional software
>> package not installed.  I have already installed gcc.  What
>> is wrong ?
> 
> You mean "/usr/ucb/cc" don't you?
> 
> What this means is (probably) that you're trying to add a
> module to the perl supplied with Solaris.  This perl was built
> using Sun's Forte compilers (naturally) and is expecting to
> use the same compilers to add things to itself.

Not necessarily. As I recall, you can compile XS modules with gcc when
the underlying perl was compiled with suncc (but might have also been
the other way round, not sure).

So it's mostly a matter of setting the CC environment variable so that
it points to the gcc. It'll probably be necessary to weed out switches
unrecognized by gcc from the Makefile as well. The rotten ones will show
up on doing 'make'.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Sat, 13 Dec 2003 04:49:10 -0600
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Passing a hash by reference
Message-Id: <Xns94503B2A66AC1sdn.comcast@216.196.97.136>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

niall.macpherson@moneyline.com (Niall Macpherson) wrote in
news:a3376e0d.0312120902.6458145e@posting.google.com:

> foreach my $key (keys $$rh_hashref)

In C/C++, * is used for all dereferencing.  In Perl, you can
dereference with $, @, or %, depending on what sort of thing you're
dereferencing.

The 'keys' operator expects to work on a real hash, not a reference
or anything, so you need to dereference it with %.  The next
nonwhitespace character after the word keys *must* be a %. 
(Similarly, the character following 'each' must be a %; the character
following 'push' must be @).

What you want is:  keys %$rh_hashref.

- -- 
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32) - WinPT 0.5.13

iD8DBQE/2u6XY96i4h5M0egRAkBXAKCbY1Jbxhdr7FKe5nm0JlNFHy7IcACfVemR
+bSgHZI/sdM89CV/XEAL6/E=
=qSNr
-----END PGP SIGNATURE-----


------------------------------

Date: Sat, 13 Dec 2003 09:52:27 -0600
From: Web Surfer <raisin@delete-this-trash.mts.net>
Subject: Re: Passing a hash by reference
Message-Id: <MPG.1a44f1b91d090ddc989700@news.mts.net>

[This followup was posted to comp.lang.perl.misc]

In article <a3376e0d.0312120902.6458145e@posting.google.com>, 
niall.macpherson@moneyline.com says...
> Apologies if this has been covered before - I have seen a number of
> posts on this subject but I still cannot work out my code doesn't
> work.
> 
> I have been working with C / C++ for over 10 years and am fully
> conversant with pointers and passing by reference in C. However ,
> passing by reference in perl is causing me some problems.
> 
> Here is a little bit of test code - 
> 
> ##----------------------------------------------------------------------
> sub AddHashEntries
> {
> 	my($rh_hashref) = @_;
> 	for($cnt = 0; $cnt < 10; $cnt ++)
> 	{
> 		$value = "value " . $cnt;
> 		$key = "key" . $cnt;
> 		$$rh_hashref{$key} = $value;
> 	}
> 	return;
> }
> ##----------------------------------------------------------------------
> sub PrintHashEntries
> {
> 	my($rh_hashref) = @_;
> 	
> 	foreach my $key (keys $$rh_hashref)

This should be

      foreach my $key ( keys %$rh_hashref )


> 	{
> 		print("\nKey = [$key], value = $$rh_hashref{$key}");
> 	} 
> 	return;
> }
> ##----------------------------------------------------------------------
> my %testhash = {};
> AddHashEntries(\%testhash);
> print("\nAdded all entries OK"); 	
> foreach my $lkey (keys %testhash)      ##   *** 1  ****
> {
> 	print("\nKey = [$lkey], value = $testhash{$lkey}");
> } 	
> PrintHashEntries(\%testhash);
> ##----------------------------------------------------------------------
> 
> 
> The values appear to get added to hash OK - the call at *** 1  ****
> produces output as I would expect , eg
> 
> Added all entries OK
> Key = [key7], value = value 7


------------------------------

Date: Sun, 14 Dec 2003 10:55:06 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: recursive closures?
Message-Id: <nrcotv44hamcc7i8p8kbh9njnlco7n7i6e@4ax.com>

On Fri, 12 Dec 2003 08:59:14 GMT, Uri Guttman <uri@stemsystems.com>
wrote:

>>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:
>
>  > I was wondering if it could be possible for a sub to return a
>  > recursive closure.  Of course this turns out to be possible, although,
>  > to the best of my efforts, not in "one step", see e.g. the following
[snip]
>so something like:
>
>	my $sub ;
>
>	$sub = sub{ blah; $sub->() }
>
>should work. i have seen damian do it for sure and i think that is the

To be fair, I tried both solutions. For some reason I included in my
post the most clumsy one... however I think that it would be
*conceptually* cool to be allowed to do something like (pseudo-code):

  print sub { 
      my $n=shift; 
      return $n if $n<=1;
      __THIS__->($n-1) + __THIS__->($n-2);
  }->(10);


Michele
-- 
# This prints: Just another Perl hacker,
seek DATA,15,0 and  print   q... <DATA>;
__END__


------------------------------

Date: 13 Dec 2003 10:21:37 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: recursive closures?
Message-Id: <brep7h$9vc$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Michele Dondi:

> On Fri, 12 Dec 2003 08:59:14 GMT, Uri Guttman <uri@stemsystems.com>
> wrote:
> 
>>>>>>> "MD" == Michele Dondi <bik.mido@tiscalinet.it> writes:
>>
>>  > I was wondering if it could be possible for a sub to return a
>>  > recursive closure.  Of course this turns out to be possible, although,
>>  > to the best of my efforts, not in "one step", see e.g. the following
> [snip]
>>so something like:
>>
>>	my $sub ;
>>
>>	$sub = sub{ blah; $sub->() }
>>
>>should work. i have seen damian do it for sure and i think that is the
> 
> To be fair, I tried both solutions. For some reason I included in my
> post the most clumsy one... however I think that it would be
> *conceptually* cool to be allowed to do something like (pseudo-code):
> 
>   print sub { 
>       my $n=shift; 
>       return $n if $n<=1;
>       __THIS__->($n-1) + __THIS__->($n-2);
>   }->(10);

This can be done by sprinkling in an always global variable to hold the
reference, such as $_:

    print +(local $_ = sub {
        my $n = shift;
        return $n if $n<=1;
        $_->($n-1) + $_->($n-2);
    })->(12);
    __END__
    144

You need the braces, though.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


------------------------------

Date: Sat, 13 Dec 2003 08:07:35 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: REQUEST: Problem with Perl (Win32) on Windows98SE and reading files
Message-Id: <slrnbtm797.4ml.tadmc@magna.augustmail.com>

Jeff <jeffcrowtpg.com.au> wrote:

> @files = readdir(OUTDOOR);

> TEST READABLE

> Thanks in advance for any and all for assistance provided.


You should read the documentation for the functions that you use.


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Sat, 13 Dec 2003 11:23:41 -0600
From: Kenneth Porter <shiva.blacklist@sewingwitch.com>
Subject: Tutorials/examples for SAX2 with Perl
Message-Id: <Xns94505F917A932shivawellcom@216.196.97.136>

Can anyone direct me to some examples that show XML::SAX in action?

I have a game server that generates event logs in XML and I'd like to both 
import these to MySQL and generate some statistics from them. This seems a 
good excuse to get familiar with both SAX2 and more advanced Perl but I 
can't seem to find either tutorials or examples online that show how to get 
started. The examples I've found all use XML::Parser which appears to be 
SAX1 and the XML websites all advise that new code should use SAX2.


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5936
***************************************


home help back first fref pref prev next nref lref last post