Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

(tye)Re: ref, no, maybe?

by tye (Sage)
on Jan 11, 2001 at 05:00 UTC ( [id://51042] : note . print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
            if ( ref( $value ) ) {                   # <- that's a ref!
                # We have multiple values for this key
    ...
                $value = uri_escape( $value, $cgi_chars );
                $query_string .= "$key=$value&";
            }
    
  2. or download this
            if ( ! ref( $value ) ) {
                $value = uri_escape( $value, $cgi_chars );
    ...
                    $query_string .= "$key=$array_value&";
                }
            }
    
  3. or download this
        if(  UNIVERSAL::isa( $r, "ARRAY" )  ) {
            # access @$r here
        } elsif(  UNIVERSAL::isa( $r, "HASH" )  ) {
            # access %$r here
    
  4. or download this
        if(  ref($r)  &&  "$r" =~ /(^|=)HASH/  ) {
    
  5. or download this
    sub method {
        my $self= shift;
        die "Invalid object" unless ref($self) eq "My::Package";
    
  6. or download this
        die "Invalid object" unless UNIVERSAL::isa( $self, __PACKAGE__ );
    # or
        die "Invalid object" unless eval { $self->isa(__PACKAGE__) };
    
  7. or download this
    if(  ref($r)  &&  "$r" =~ /=/  )