[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

PERL/named parameters, prefix hyphen



use_named_parameters, prefix hyphen er død? 

har det været lovligt tidligere, med/uden special kode, som er 
use CGI;
use_named_parameters();
   

Jeg er stødt ind i noget, som ser ud til at være forældet,
foranstillet bindestreg på key i named-parameters kaldesyntaks.

Man kan ikke kalde sådan: func(-Year=>2004) men man kan
godt: func(Year=>2004); Altså prefix hyphen er død. 

Har søgt på Google og mailarkiver for perl, BFR, beginners first
response, på learn.perl.org, men uden held.

sub func {
   my %dfl =  ( Date => 1,
                Month => 1,
                Year => 1970
               );
    my %args = (%dfl, @_);
    print "Year: $args{Year}\n";
}

func(Year=>2004);
func(-Year => 2004); # Overfører ikke Year men '-Year' som jo er en string.


Man kan stadig, fra kommandolinien, hente parametre med 

use CGI qw/:standard :netscape/
my $value = param(-password);
if (defined($value)) print $value."\n";

På kommandolinien -password="zeKret" bevirker at param returnerer zeKret.

Jeg kan godt leve uden at vide sandheden, men har man nogensinde
kunnet gøre func(-Year => 2004) uden speciel kode? (som jeg har liggende
men ikke sender med her.)



/Hilsen og mange tak hvis nogen kan hjælpe

Donald

-- 
donald_j_axel(at)get2net.dk -- http://d-axel.dk/
SPAM preferences="musik,tjen-en-million";-)



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *