Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

jZed's scratchpad

by jZed (Prior)
on Jun 02, 2004 at 00:21 UTC ( [id://358896]=scratchpad: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
      PerlModule HTML::Mason::ApacheHandler
      <Location /~jeff/mason>
    ...
        SetHandler   perl-script
        PerlHandler  HTML::Mason::ApacheHandler
      </Location>
    
  2. or download this
    my %uri = (
        dl      => 'http://www.plkr.org/download',
    ...
        ); 
        exit;
    }
    
  3. or download this
    #!/usr/bin/perl
    use warnings;
    ...
    ");
    $dbh->disconnect;
    __END__
    
  4. or download this
    # PREPARE ONLY ONCE, NOT EVERYTIME THROUGH THE LOOP
    my $word = $dbh->prepare(qq{SELECT term from dream_terms where term=?}
    +);
    ...
        return $linked_word;
    }
    
  5. or download this
    #!/usr/bin/perl
    use warnings;
    ...
        </body>
    </html>
    }
    
  6. or download this
    <script>
    var foo = { a:1
    ...
              };
    alert( foo['b'] );
    </script>
    
  7. or download this
    <style>
    #foo #bar { color:red;   }
    ...
    <div id="foo">
        <div id="bar">bar</div>
    </div>
    
  8. or download this
    #!/usr/bin/perl
    use warnings;
    ...
          ? 1
          : 0;
    }
    
  9. or download this
    #!/usr/bin/perl
    use strict;
    ...
    
    print $cgi->header();
    $interpreter->exec($component,%args);
    
  10. or download this
    my $in_file = "bill";
    my $out_file = "far2";
    ...
    print "Done\n";
    close(IF);
    close(OF);
    
  11. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        , $q->end_form
    ;
    print "You entered :" . $q->param('foo') if $q->param;
    
  12. or download this
    <script src="/js/prototype.js"></script>
    <script src="/js/extend.js"></script>
    ...
    myInheritedInstance = new myInheritedClass(6);
    myInheritedInstance.show(); // result = 11
    </script>
    
  13. or download this
    $dbh->do("CREATE FUNCTION MyAdd");
    sub MyAdd {
    ...
    my $sth = $dbh->prepare("
        SELECT myAdd(id,9) AS foo FROM test
    ");
    
  14. or download this
    #!perl -w
    use strict;
    ...
    my $sql = "CREATE TABLE foo (id INT PRIMARY KEY,bar VARCHAR(30)";
    my $translator = SQL::Translator->new;
    SQL::Translator::Parser::PostgreSQL::parse($translator,$sql);
    
  15. or download this
    #!perl -w
    use strict;
    ...
        last unless @$cols;
        printf "%s\n", join ':',@$cols;
    }
    
  16. or download this
    #!perl -w
    use strict;
    ...
    ok($old =~ /\Q$new/,'$old =~ /\Q$new/');
    ok($new =~ /$old/,'$new =~ /$old/');
    ok($new =~ /\Q$old/,'$new =~ /\Q$old/');
    
  17. or download this
    SELECT foo, bar
      FROM baz JOIN qux
     WHERE quimble = ?
       AND bop = ?
    
  18. or download this
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    ...
    <a href="http://www.perlmonks.org/?displaytype=raw;xmlstyle=clean;node
    +=XP XML Ticker">XP</a><br />
    </body>
    </html>
    
  19. or download this
    
    % cat > dbish.txt
    ...
        INSERT INTO x VALUES (2,'b');
        SELECT * FROM x;
    % perl -MDBI::Shell -e 'DBI::Shell->new("--batch","dbi:DBM:")->run' < 
    +dbish.txt;
    
  20. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    open STDIN, '<', \$str;
    DBI::Shell->new('--batch','dbi:DBM:')->run;
    
  21. or download this
     use Text::CSV_XS;
     $c = Text::CSV_XS->new;              # use default separator,delimite
    +r,escape
    ...
     }
    
    There are two interfaces to this module, the new interface (shown abov
    +e) has convenient shortcuts, the older interface is for backwards com
    +patibility for previous users.  B<Please note>: in the new interface 
    +binary mode defaults to true, whereas in the older interface it defau
    +lts to false.  This means that the new interface methods will, by def
    +ault, handle embedded newlines and binary characters, whereas if you 
    +want that behaviour with the old methods, you must manually set binar
    +y=>1 in the call to new().
    
  22. or download this
    The char used for escaping certain characters inside quoted fields,
    by default the same character as the quote_char. (C<">).
    ...
     $csv = Text::CSV_XS->new({ escape_char => q[\\]  });
     $csv->parse(q["Joe \"the giant\" Jackson"]) or die $csv->error_input;
    
  23. or download this
    #!perl -w
    use strict;
    ...
        print "Done!";
    }
    __END__
    
  24. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
        # print "$lookingfor required at line $line of [$modfile] $filenam
    +e\n";
    };
    1;
    
  25. or download this
    #!perl -w
    use strict;
    ...
    print join ' ', @{ $dbh->selectcol_arrayref("
        SELECT phrase FROM t WHERE phrase <> 'junk' ORDER BY id DESC
    ")};
    
  26. or download this
    use DBM::Deep;
    my $file ='foo.db';
    ...
    untie %h;
    tie %h, 'DBM::Deep', {file=>$file,autoflush=>1};
    print $h{key};
    
  27. or download this
    #!perl -w
    use strict;
    ...
    __END__
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-16 05:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found