1 2 3 4 5 6 7 8 9 10 11 12 13 14
package Foo; use Moose; has 'cgi' => ( isa => 'CGI', handles => ['header'], ); package main; my $f = Foo->new(); print $f->header;
QuoteCannot delegate header to header because the value of cgi is not defined at C:/Perl/lib/Moose/Meta/Method/Delegation.pm line 99.
Foo::header('Foo=HASH(0x96b7c4)') called at C:\Dokumente und Einstellungen\rolf\Desktop\pack.pl line 20
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package Foo; use Moose; use CGI; has 'cgi' => ( isa => 'CGI', handles => ['header'], default => sub { CGI->new }, ); package main; my $f = Foo->new(); print $f->header;
1 2 3 4 5 6 7 8 9
use CGI; # zur Laufzeit also: print $foo->header(CGI->new); sub header{ my $self = shift; my $cgiobject = shift; return $cgiobject->header(); }
1 2 3 4 5 6 7 8
use CGI; print $foo->header; sub header{ my $self = shift; my $cgiobject = CGI->new; return $cgiobject->header(); }
2014-04-16T18:09:34 RaubtierSuchst du folgendes?
lazy => 1
1 2 3 4 5 6 7 8 9
use strict; use warnings; use base q(Factory); my $m = main->new; my $r = $m->selectall_arrayref(qq( select character_name, hex(codepoint) from unicodedata where codepoint between ? and ? ), 0x20, 0x7E); $m->dd($r); # Dump
2023-07-14T14:41:29 GwenDragonuse base q(Factory); soll wohl heißen use base q(Factory ':machichallesslbst'); Nur ein Scherz. ;-)
Quoteklingt wie Jassid ;)Ichmachalles