On Tue, 11 Jan 2022 at 11:35, Jan Kasprzak wrote:
> demerphq wrote:
> : On Tue, 11 Jan 2022 at 10:18, Yamadaえりな wrote:
> :
> : > So, I would like to ask another question:
> : > Is it safe to pass function reference to the caller (mostly it's the
> : > method instantized from a class) in
demerphq wrote:
: On Tue, 11 Jan 2022 at 10:18, Yamadaえりな wrote:
:
: > So, I would like to ask another question:
: > Is it safe to pass function reference to the caller (mostly it's the
: > method instantized from a class) in mod_perl development env?
: > Or should I avoid using this style?
: >
On Tue, 11 Jan 2022 at 10:18, Yamadaえりな wrote:
> So, I would like to ask another question:
> Is it safe to pass function reference to the caller (mostly it's the
> method instantized from a class) in mod_perl development env?
> Or should I avoid using this style?
>
Nothing wrong with passing
So, I would like to ask another question:
Is it safe to pass function reference to the caller (mostly it's the method
instantized from a class) in mod_perl development env?
Or should I avoid using this style?
Thanks.
Thanks for all your help.
Yes I have made the mistake to think {} is a code reference in perl.
私はすでに理解していますありがとう
On Tue, Jan 11, 2022 at 5:10 PM Jacques Deguest wrote:
> Yamada-san,
>
> The value you pass to 'run' is not a code reference, but an hash
> reference, i.e. '{}'
>
> A code reference
Yamada-san,
The value you pass to 'run' is not a code reference, but an hash
reference, i.e. '{}'
A code reference would be: 'sub{}', so do '$obj->run( sub{ "hello
world"} );' instead.
Jacques
On 2022/01/11 17:51, Yamadaえりな wrote:
Good afternoon,
Can you help check my problem with this?
On Tue, 11 Jan 2022, 16:53 Yamadaえりな, wrote:
> Good afternoon,
>
> Can you help check my problem with this?
>
> $ cat t1.pl
> use strict;
>
> package Myclass;
>
> sub new {
> my $self = shift;
> bless {},$self;
> }
>
> sub run {
>my $self = shift;
>my $block = shift;
>&{$block};
Good afternoon,
Can you help check my problem with this?
$ cat t1.pl
use strict;
package Myclass;
sub new {
my $self = shift;
bless {},$self;
}
sub run {
my $self = shift;
my $block = shift;
&{$block};
}
1;
package main;
my $obj = Myclass->new;
$obj->run( { "hello world"} );