Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

file 188 lines (162 sloc) 4.497 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>File::is</title>
<!-- metadata -->
<meta name="version" content="S5 1.1" />
<meta name="presdate" content="20081108" />
<meta name="author" content="Jozef Kutej"/>
<meta name="company" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<!-- configuration parameters -->
<meta name="defaultView" content="slideshow" />
<!-- <meta name="defaultView" content="outline" /> -->
<meta name="controlVis" content="hidden" />
<!-- style sheet links -->
<link rel="stylesheet" href="ui/default/slides.css" type="text/css" media="projection" id="slideProj" />
<link rel="stylesheet" href="ui/default/outline.css" type="text/css" media="screen" id="outlineStyle" />
<link rel="stylesheet" href="ui/default/print.css" type="text/css" media="print" id="slidePrint" />
<link rel="stylesheet" href="ui/default/opera.css" type="text/css" media="projection" id="operaFix" />
<!-- S5 JS -->
<script src="ui/default/slides.js" type="text/javascript"></script>
<!-- syntax highlighting -->
<link rel="stylesheet" type="text/css" href="ui/sh/sh_style.css" />
<script type="text/javascript" src="ui/sh/sh_main.js"></script>
<script type="text/javascript" src="ui/sh/sh_perl.js"></script>
<script type="text/javascript" src="ui/sh/sh_sql.js"></script>
<!-- custom -->
<script src="ui/jquery-1.2.6.js" type="text/javascript"></script>
<script src="ui/custom.js" type="text/javascript"></script>
<link rel="stylesheet" href="ui/custom.css" type="text/css" />
</head>

<body><!-- onload='sh_highlightDocument();' -->

<div class="layout">
<div id="controls"><!-- DO NOT EDIT --></div>
<div id="currentSlide"><!-- DO NOT EDIT --></div>
<div id="header"></div>
<div id="footer">

<!-- added by Jozef :) -->
<div id="counter" style="float: right; margin-right: 10px;">10</div>
<span id="ignoreClicks" />

<h1>26. May 2009</h1>
<h2>File::is</h2>

</div>

</div>


<div class="presentation">

<div class="slide">
<h1>File::is</h1>
<h3>Jozef Kutej</h3>
</div>

<div class="slide">
<h1>older? oldest? is newer? newest? similar? the same?</h1>
</div>

<div class="slide">
<h1>if+stat</h1>
<p>it all started with:</p>
<pre>
if (
(stat('filename'))[9]
&lt;
(stat('tmp/other-filename'))[9]
) {
do_something();
};
</pre>
</div>

<div class="slide">
<h1>instead</h1>
<ul>
<li>~80 lines of code</li>
<li>~90 lines of tests</li>
</ul>
</div>


<div class="slide">
<h1>if+stat problem1</h1>
<pre>
if (
(stat('filename'))[<span class="red">9</span>]
&lt;
(stat('tmp/other-filename'))[<span class="red">9</span>]
) {
do_something();
};
</pre>
<ul>
<li>what is (stat())[<span class="red">9</span>] ?</li>
</ul>
</div>

<div class="slide">
<h1>(stat())[9]</h1>
<pre>
my $stat_dev = 0;
my $stat_ino = 1;
my $stat_mode = 2;
my $stat_nlink = 3;
my $stat_uid = 4;
my $stat_gid = 5;
my $stat_rdev = 6;
my $stat_size = 7;
my $stat_atime = 8;
my $stat_mtime = <span class="red">9</span>;
my $stat_ctime = 10;
my $stat_blksize = 11;
my $stat_blocks = 12;
</pre>
</div>


<div class="slide">
<h1>if+stat problem2</h1>
<pre>
if (
(stat(<span class="red">'filename'</span>))[9]
&lt;
(stat(<span class="red">'tmp/other-filename'</span>))[9]
) {
do_something();
};
</pre>
<ul>
<li>what happens if 'filename' doesn't exist?</li>
<li>"tmp/other-filename" not too portable</li>
</ul>
</div>


<div class="slide">
<h1>if+File::is</h1>
<pre>
if (
File::is->older(
'filename',
[ 'tmp', 'other-filename' ]
)
) {
do_something();
};</pre>
<ul>
    <li>readable code</li>
    <li>die() on error</li>
    <li>portable, uses File::Spec</li>
    <li>accepts more files for comparison</li>
</ul>

</div>

<div class="slide">
<h1>File::is methods</h1>
<ul>
<li>File::is->newer + File::is->newest</li>
<li>File::is->older + File::is->oldest</li>
<li>File::is->similar</li>
<li>File::is->thesame</li>
<li>File::is->bigger + File::is->biggest</li>
<li>File::is->smaller + File::is->smallest</li>
</ul>
<p>all reusing ONE universal internal function <code>_cmp_stat($class,
$return_value_if_match, $cmp_function, $primary_filename, $other_filename, $other_filename2, ...)
</code>
</p>
</div>

<div class="slide">
<h1>Questions?</h1>
<div class="singleThing"><img src="images/question-mark-blue-grey.jpg" alt=":-?" /></div>
</div>

</div>

</body>
</html>
Something went wrong with that request. Please try again.