<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Thanks folks. <div>I use OO modules all the time, but haven't made one. So I forgot the difference. </div><div>and just missed that I'd not referenced the input hash.</div><div><br></div><div>thanks again,</div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Verdana; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Verdana; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="font-family: Helvetica; "><span class="Apple-style-span" style="font-family: Helvetica; ">Tom</span></div><div style="font-family: Helvetica; "><span class="Apple-style-span" style="font-family: Helvetica; "><a href="mailto:kellert@ohsu.edu">kellert@ohsu.edu</a></span></div><div style="font-family: Helvetica; "><span class="Apple-style-span" style="font-family: Helvetica; ">503-494-2442</span></div></span></span></div></span></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br><div><div>On Jan 12, 2012, at 5:06 PM, Joshua Keroes wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Try Workrequest::Utilities::sample_range_fix() instead. Using ->class_method() notation passes the class as the first argument.<div><br></div><div>Two more things:</div><div><ol><li>I suspect that $c++ line does nothing.</li>

<li>sprintf or printf will handle that 0-prefixing with less code.</li></ol><br><div class="gmail_quote">2012/1/12 Tom Keller <span dir="ltr"><<a href="mailto:kellert@ohsu.edu">kellert@ohsu.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div style="word-wrap:break-word">Greetings,<div>Writing a module Workrequest::Utilities with subroutine</div><div><div>##### code snippet ######</div><div>sub sample_range_fix {</div><div><span style="white-space:pre-wrap">   </span>my $params_ref = shift;</div>

<div><span style="white-space:pre-wrap">  </span>my $samples;</div><div><span style="white-space:pre-wrap">     </span>my $filename = $params_ref->{filename};</div><div><span style="white-space:pre-wrap">       </span>my $start = $params_ref->{start};</div>

<div><span style="white-space:pre-wrap">  </span>my $count = $params_ref->{count};</div><div><span style="white-space:pre-wrap">     </span>my $prefix = $params_ref->{prefix};</div><div><span style="white-space:pre-wrap">   </span>my $last = $start + $count -1;</div>

<div><br></div><div><span style="white-space:pre-wrap"> </span>for my $c ($start .. $last -1) { </div><div><span style="white-space:pre-wrap">           </span>if ( $c < 10 ) {</div><div><span style="white-space:pre-wrap">                      </span>my $number = "0$c";</div>

<div><span style="white-space:pre-wrap">                  </span>$samples .= "${prefix}_$number, ";</div><div><span style="white-space:pre-wrap">             </span>} else {</div><div><span style="white-space:pre-wrap">                 </span>my $number = "$c";</div>

<div><span style="white-space:pre-wrap">                  </span>$samples .= "${prefix}_$number, ";</div><div><span style="white-space:pre-wrap">             </span>}</div><div><span style="white-space:pre-wrap">                </span>$c++;</div><div>

<span style="white-space:pre-wrap">     </span>}</div><div><span style="white-space:pre-wrap">        </span># add last sample w/o a comma</div><div><span style="white-space:pre-wrap">    </span>if ( $count < 10 ) {</div><div><span style="white-space:pre-wrap">          </span>$samples .= "${prefix}_0$last";</div>

<div><span style="white-space:pre-wrap">  </span>} else {<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">         </span>$samples .= "${prefix}_$last";</div><div><span style="white-space:pre-wrap"> </span>}</div>

<div><span style="white-space:pre-wrap">  </span>return $samples<span style="white-space:pre-wrap"> </span></div><div>}</div><div>##### end code snippet ######</div><div><br></div><div>I get the strict ref error when I call this method with:</div>

<div>##### code snippet ######</div><div><div>my %params = (</div><div><span style="white-space:pre-wrap">  </span>filename<span style="white-space:pre-wrap">        </span>=> $filename,</div><div><span style="white-space:pre-wrap"> </span>start<span style="white-space:pre-wrap">                   </span>=> $start,</div>

<div><span style="white-space:pre-wrap">  </span>count<span style="white-space:pre-wrap">           </span>=> $count,</div><div><span style="white-space:pre-wrap">    </span>prefix<span style="white-space:pre-wrap">          </span>=> $prefix</div>

<div>);</div><div>my $samples = Workrequest::Utilities->sample_range_fix( %params );</div></div><div>##### end code snippet ######</div><div><br></div><div>I can't see what's wrong with it. Can you?</div><div>
<br>
</div><div>thanks for your help,</div></div><div>
<span style="text-indent:0px;letter-spacing:normal;font-variant:normal;text-align:-webkit-auto;font-style:normal;font-weight:normal;line-height:normal;border-collapse:separate;text-transform:none;font-size:medium;white-space:normal;font-family:Optima;word-spacing:0px">Tom<br>

<a href="http://www.ohsu.edu/xd/research/research-cores/dna-analysis/" target="_blank">MMI DNA Services Core Facility</a><br><a href="tel:503-494-2442" value="+15034942442" target="_blank">503-494-2442</a><br>kellert at <a href="http://ohsu.edu/" target="_blank">ohsu.edu</a><br>

Office: 6588 RJH (CROET/BasicScience)<br><br><a href="http://www.ohsu.edu/xd/research/research-cores/index.cfm" target="_blank">OHSU Shared Resources</a><br><br><br><br><br><br></span>
</div>
<br></div><br>_______________________________________________<br>
Pdx-pm-list mailing list<br>
<a href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/pdx-pm-list" target="_blank">http://mail.pm.org/mailman/listinfo/pdx-pm-list</a><br></blockquote></div><br></div>
_______________________________________________<br>Pdx-pm-list mailing list<br><a href="mailto:Pdx-pm-list@pm.org">Pdx-pm-list@pm.org</a><br>http://mail.pm.org/mailman/listinfo/pdx-pm-list</blockquote></div><br></div></body></html>