[32402] in Perl-Users-Digest
Perl-Users Digest, Issue: 3669 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 20 03:09:23 2012
Date: Fri, 20 Apr 2012 00:09:05 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 20 Apr 2012 Volume: 11 Number: 3669
Today's topics:
A Design Pattern Question for Functional Programers <xahlee@gmail.com>
CPAN Stopped being Recognized (MAC) <support@westbase.com>
Re: CPAN Stopped being Recognized (MAC) <rweikusat@mssgmbh.com>
Re: Tracing Perl <ben@morrow.me.uk>
What is this module using? (Tim McDaniel)
Re: What is this module using? <ben@morrow.me.uk>
Re: What is this module using? <*@eli.users.panix.com>
Re: What is this module using? <ben@morrow.me.uk>
Re: Why does this code works without cat ? (Seymour J.)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 18 Apr 2012 16:45:30 -0700 (PDT)
From: Xah Lee <xahlee@gmail.com>
Subject: A Design Pattern Question for Functional Programers
Message-Id: <01085103-fffb-4641-bbd5-fa1efa1d5426@t2g2000pbl.googlegroups.com>
Functional programing is getting the presses in mainstream. I ran
across this dialogue where a imperative coder was trying to get into
functional programing:
A: What are the design patterns that help structure functional
systems?
B: Design patterns? Hey everyone, look at the muggle try to get the
wand to work!
from:
=E3=80=88Code Watch: Functional programming's smugness problem=E3=80=89 (20=
12-04-16)
By By=C2=A0Larry O'brien. @ http://www.sdtimes.com/content/article.aspx?Art=
icleID=3D36534
hi, my dearly beloved C++ java perl python hackers, design pattern
your mom!
further readings:
=E3=80=88Why Software Suck=E3=80=89
http://xahlee.org/UnixResource_dir/writ/why_software_suck.html
=E3=80=88What is a Tech Geeker?=E3=80=89
http://xahlee.org/UnixResource_dir/writ/tech_geeker.html
=E3=80=88Book Review: Patterns of Software=E3=80=89
http://xahlee.org/PageTwo_dir/Personal_dir/bookReviewRichardGabriel.html
=E3=80=88Are You Intelligent Enough to Understand HTML5?=E3=80=89
http://xahlee.org/UnixResource_dir/writ/html5_vs_intelligence.html
Xah
------------------------------
Date: Wed, 18 Apr 2012 21:09:29 -0700
From: David Warner <support@westbase.com>
Subject: CPAN Stopped being Recognized (MAC)
Message-Id: <support-8F11D7.21092818042012@c-61-68-245-199.per.connect.net.au>
Hello Group,
Not sure if this is the place to post this question/issue, so here we go.
I ran the cpan utility (/usr/bin/cpan) on my Mac OSX 10.6.8 to install
the WWW::Mechanize perl package. After installing the necessary
supporting perl package libraries to support WWW::Mechanize, I cannot
run cpan again.
This is what I have tried:
cpan Package
sudo cpan Package
/usr/bin/cpan Package
sudo cpan Package
/usr/bin/sudo /usr/bin/cpan Package
All attempts returns the errors.
$ sudo cpan Scrape::USPS
Password:
sudo: cpan: command not found
$ cpan Scrape::USPS
-bash: /usr/bin/cpan: Permission denied
$ type sudo
sudo is hashed (/usr/bin/sudo)
$ type cpan
cpan is hashed (/usr/bin/cpan)
$ /usr/bin/sudo /usr/bin/cpan Scrape::USPS
sudo: /usr/bin/cpan: command not found
To install WWW::Mechanize, all that I typed originally was:
sudo cpan WWW::Mechanize
Suggestions?
Thanks,
David
------------------------------
Date: Thu, 19 Apr 2012 14:13:40 +0100
From: Rainer Weikusat <rweikusat@mssgmbh.com>
Subject: Re: CPAN Stopped being Recognized (MAC)
Message-Id: <87ehrjn9tn.fsf@sapphire.mobileactivedefense.com>
David Warner <support@westbase.com> writes:
> Not sure if this is the place to post this question/issue, so here we go.
>
> I ran the cpan utility (/usr/bin/cpan) on my Mac OSX 10.6.8 to install
> the WWW::Mechanize perl package. After installing the necessary
> supporting perl package libraries to support WWW::Mechanize, I cannot
> run cpan again.
>
> This is what I have tried:
>
> cpan Package
> sudo cpan Package
> /usr/bin/cpan Package
> sudo cpan Package
> /usr/bin/sudo /usr/bin/cpan Package
>
> All attempts returns the errors.
>
> $ sudo cpan Scrape::USPS
> Password:
> sudo: cpan: command not found
> $ cpan Scrape::USPS
> -bash: /usr/bin/cpan: Permission denied
Both of these messages together indicate that /usr/bin/cpan is missing
execute-permissions.
[...]
> Suggestions?
ls -l /usr/bin/cpan
if this results in a file without x-permissions set, try
sudo chmod +x /usr/bin/cpan
alternatively, do it the old-fashioned way
perl -MCPAN -e shell
------------------------------
Date: Wed, 18 Apr 2012 11:03:10 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Tracing Perl
Message-Id: <u3g269-3nv2.ln1@anubis.morrow.me.uk>
Quoth tmcd@panix.com:
> I'm uncertain on how exactly to do this, maybe just because I'm very
> tired, and I'm away from the work systems in question so I can't
> easily experiment. I'm hoping these questions are easy to answer.
>
> I'm working on a large program. In a sub, I had it output a stack
> trace and then die. I have a warn in the next enclosing eval several
> levels up, right after the call where it started down to the point of
> the die ... but $@ has been wiped by the time it reaches that warn.
> I really want to find out where.
A simple answer is something like this:
{ package My::Warn::Errsv;
use Carp;
sub DESTROY { Carp::cluck "\$\@ cleared" }
}
and then (temporarily) replace your die with
die bless [], "My::Warn::Errsv";
This will then give you a stack trace at the point where $@ is cleared.
(Provided, of course, that something else doesn't keep a copy of the old
value around.)
You could also try using the debugger, and setting a watchpoint.
> Do I have to worry about Devel::Trace being modern but the program is
> being run under Perl 5.8.8?
The correct way to answer that question is
http://matrix.cpantesters.org/?dist=Devel-Trace+0.12 (linked from the
Devel-Trace distribution's search.cpan.org page as 'CPAN Testers /
Perl/Platform Version Matrix', which tells you that yes, it works just
fine under 5.8.8.
> I did stumble over http://www.effectiveperlprogramming.com/blog/1429 ,
> which shows code for a simple implementation that is easier to
> control.
I would stay away from package DB and *{"::_<..."} and the other bits of
the debugger's guts if I were you. It's very easy to make a nasty mess.
Ben
------------------------------
Date: Wed, 18 Apr 2012 21:44:31 +0000 (UTC)
From: tmcd@panix.com (Tim McDaniel)
Subject: What is this module using?
Message-Id: <jmncjv$ove$1@reader1.panix.com>
Looking at the docs, it appears that Devel::Modlist reports on *all*
the modules used in an entire script. Is there some way I can
determine the modules used, directly or transitively, merely by the
current module?
--
Tim McDaniel, tmcd@panix.com
------------------------------
Date: Wed, 18 Apr 2012 23:28:20 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: What is this module using?
Message-Id: <4pr369-99i.ln1@anubis.morrow.me.uk>
Quoth tmcd@panix.com:
> Looking at the docs, it appears that Devel::Modlist reports on *all*
> the modules used in an entire script. Is there some way I can
> determine the modules used, directly or transitively, merely by the
> current module?
perl -d:Modlist -mMy::Module -e1 ?
You should, in general, write your modules so it's possible to load them
on their own like this, and so that doing so doesn't do anything
unpleasant or have any external effect.
Otherwise:
Locally override CORE::GLOBAL::require?
You would need to do this at compile time, before you compile any code
in your module that will call require, and before you compile code in
any *required* module which will call require. Otherwise Perl won't
notice the override. It might be best to set up a global override with a
local()able global to switch it on and off: the effects of local persist
over a require.
You would also need to be very sure nothing else was trying the same
trick. In general CORE::GLOBAL should be avoided like the plague in
production code, for much the same reasons as you shouldn't add methods
or superclasses to UNIVERSAL.
Trying to do anything less clever will run into the problem that the
whole point of require is to avoid loading code twice. If your module
requires a module that something else has already loaded, then e.g. an
@INC coderef hook won't fire.
Ben
------------------------------
Date: Wed, 18 Apr 2012 22:59:21 +0000 (UTC)
From: Eli the Bearded <*@eli.users.panix.com>
Subject: Re: What is this module using?
Message-Id: <eli$1204181853@qz.little-neck.ny.us>
In comp.lang.perl.misc, Ben Morrow <ben@morrow.me.uk> wrote:
> Quoth tmcd@panix.com:
> > Looking at the docs, it appears that Devel::Modlist reports on *all*
> > the modules used in an entire script. Is there some way I can
> > determine the modules used, directly or transitively, merely by the
> > current module?
>
> perl -d:Modlist -mMy::Module -e1 ?
That's not necessarily going to work. Consider:
perl -d:Modlist -mCPAN -e1
When I run that it doesn't mention Storable, LWP::*, or Time::*
but all three were used by CPAN just seconds before when I ran
"install Devel::Modlist":
cpan[1]> install Devel::Modlist
CPAN: Storable loaded ok (v2.18)
Going to read /root/.cpan/Metadata
Database was generated on Mon, 02 Jan 2012 23:14:10 GMT
CPAN: LWP::UserAgent loaded ok (v5.829)
CPAN: Time::HiRes loaded ok (v1.9711)
Fetching with LWP:
Elijah
------
pretty sure CPAN also uses Term::ReadLine but doesn't report the version
------------------------------
Date: Thu, 19 Apr 2012 00:32:05 +0100
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: What is this module using?
Message-Id: <lgv369-5pi.ln1@anubis.morrow.me.uk>
Quoth Eli the Bearded <*@eli.users.panix.com>:
> In comp.lang.perl.misc, Ben Morrow <ben@morrow.me.uk> wrote:
> > Quoth tmcd@panix.com:
> > > Looking at the docs, it appears that Devel::Modlist reports on *all*
> > > the modules used in an entire script. Is there some way I can
> > > determine the modules used, directly or transitively, merely by the
> > > current module?
> >
> > perl -d:Modlist -mMy::Module -e1 ?
>
> That's not necessarily going to work. Consider:
>
> perl -d:Modlist -mCPAN -e1
>
> When I run that it doesn't mention Storable, LWP::*, or Time::*
> but all three were used by CPAN just seconds before when I ran
> "install Devel::Modlist":
True. Modules loaded at runtime are inherently harder, since you have to
run the program (with all possible inputs) to see them.
A CORE::GLOBAL::require hook which checks caller() looks like the best
answer, to me. You probably want to check (caller)[1] as well as
(caller)[0], or just check [1] while being careful to step back over
string evals until you find a real file.
Ben
------------------------------
Date: Tue, 17 Apr 2012 20:22:12 -0400
From: Shmuel (Seymour J.) Metz <spamtrap@library.lspace.org.invalid>
Subject: Re: Why does this code works without cat ?
Message-Id: <4f8e0934$1$fuzhry+tra$mr2ice@news.patriot.net>
In <87fwc3jvax.fsf@sapphire.mobileactivedefense.com>, on 04/16/2012
at 09:06 PM, Rainer Weikusat <rweikusat@mssgmbh.com> said:
>Indeed. As I already explcitly wrote two times and implicitly pointed
>out three times, my statement was supposed to refer to the wrong
>'zig-zagging' claim and I was just using the two commands above as a
>convenient example to illustrate that,
FSVO "that". The OP was contrasting the use of cat and a pipe to a
*different* command with the use of redirection to that command; what
you posted was a straw dummy, either deliberate or because you lost
track of quoting levels.
--
Shmuel (Seymour J.) Metz, SysProg and JOAT <http://patriot.net/~shmuel>
Unsolicited bulk E-mail subject to legal action. I reserve the
right to publicly post or ridicule any abusive E-mail. Reply to
domain Patriot dot net user shmuel+news to contact me. Do not
reply to spamtrap@library.lspace.org
------------------------------
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:
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
Back issues are available via anonymous ftp from
ftp://cil-www.oce.orst.edu/pub/perl/old-digests.
#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 V11 Issue 3669
***************************************