logo       

Re: Devel::Cover: completing $x{foo} ||= 1 conditions: msg#00080

Subject: Re: Devel::Cover: completing $x{foo} ||= 1 conditions
Gabor Szabo wrote:
>
>>     $x{foo} ||= 1;
>
> I have not tested you recent patch. That might have solved this one
> too as this is very similar.
>
> $a = func() || croak("we have some problem");

Actually, that's quite different.
 
> According to Devel::Cover the above statetement has 3 states. One of 
> them, when croak returns 1 will never happen as croak never returns.

But Devel::Cover can't know that. It doesn't know what (or if) an 
arbitrary function will return. Besides, who says that this is 
Carp::croak() and not (e.g.) Frog::croak() that might do something 
entirely different?

In '$x ||= 1' it's apparent that the RHS is a constant.

In '$x ||= []' (something Paul's already heard about ;) the RHS isn't a 
constant, but it is always boolean true.

In '$x ||= func()', func() could do anything. I think that Devel::Cover 
has to treat this as a "3 state or". If you don't get full coverage, 
you'll have to analyze the code to determine whether that's correct or
you've missed something.

Full coverage isn't always possible, and the lack of it isn't 
necessarily a problem. If Devel::Cover can identify the first two as a 
"2 state or", I'm happy.

-mjc



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe