[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-beginners
Subject:    Re: How to implement a static method in perl class?
From:       Andrew Solomon <andrew () geekuni ! com>
Date:       2022-10-14 9:56:51
Message-ID: CAN=twKvE8nT9ejXRC_GGgpBv-AErCGzhoytDtume1_MkDGHRbQ () mail ! gmail ! com
[Download RAW message or body]

That's correct.

On Fri, Oct 14, 2022 at 1:31 AM Henrik P <henrik@simplemail.co.in> wrote:

> so this is not a singleton, but a stateful variable sharing status among
> all the instances, is it?
>
> thanks for your code sharing.
>
>
> Andrew Solomon wrote:
> > Now, the fact that this has been called in a package with a 'new' method
> > makes me wonder whether you'd actually like "count" to be a method of an
> > object. As you can see, using the state variable within the package it
> > is still shared with all objects of that class.
> >
> > https://publ.ink/x/e69403568d37b18476872443f9f7afa9
> > <https://publ.ink/x/e69403568d37b18476872443f9f7afa9>
>
> --
> Simple Mail
> https://simplemail.co.in/
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> http://learn.perl.org/
>
>
>

[Attachment #3 (text/html)]

<div dir="ltr"><div>That&#39;s correct.</div><br><div class="gmail_quote"><div \
dir="ltr" class="gmail_attr">On Fri, Oct 14, 2022 at 1:31 AM Henrik P &lt;<a \
href="mailto:henrik@simplemail.co.in">henrik@simplemail.co.in</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">so this is not a \
singleton, but a stateful variable sharing status among <br> all the instances, is \
it?<br> <br>
thanks for your code sharing.<br>
<br>
<br>
Andrew Solomon wrote:<br>
&gt; Now, the fact that this has been called in a package with a &#39;new&#39; method \
<br> &gt; makes me wonder whether you&#39;d actually like &quot;count&quot; to be a \
method of an <br> &gt; object. As you can see, using the state variable within the \
package it <br> &gt; is still shared with all objects of that class.<br>
&gt; <br>
&gt; <a href="https://publ.ink/x/e69403568d37b18476872443f9f7afa9" rel="noreferrer" \
target="_blank">https://publ.ink/x/e69403568d37b18476872443f9f7afa9</a> <br> &gt; \
&lt;<a href="https://publ.ink/x/e69403568d37b18476872443f9f7afa9" rel="noreferrer" \
target="_blank">https://publ.ink/x/e69403568d37b18476872443f9f7afa9</a>&gt;<br> <br>
-- <br>
Simple Mail<br>
<a href="https://simplemail.co.in/" rel="noreferrer" \
target="_blank">https://simplemail.co.in/</a><br> <br>
-- <br>
To unsubscribe, e-mail: <a href="mailto:beginners-unsubscribe@perl.org" \
target="_blank">beginners-unsubscribe@perl.org</a><br> For additional commands, \
e-mail: <a href="mailto:beginners-help@perl.org" \
target="_blank">beginners-help@perl.org</a><br> <a href="http://learn.perl.org/" \
rel="noreferrer" target="_blank">http://learn.perl.org/</a><br> <br>
<br>
</blockquote></div><br clear="all"><div><br></div><div dir="ltr" \
class="gmail_signature"><div dir="ltr"><div></div></div></div></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic