Code Monkey home page Code Monkey logo

Comments (6)

kpreid avatar kpreid commented on September 2, 2024

Comment #1 originally posted by [email protected] on 2008-02-01T11:49:16.000Z:

dashboard.pl

In general, you shouldn't use "my" variables in subs: use "our" instead.

die messages should say what the problem is, as well as the name of the
file/directory that is a problem.

Instead of repeating strings like "$dashboard_root/time-series/" assign them to
variables.

Otherwise LGTM.

from caja.

kpreid avatar kpreid commented on September 2, 2024

Comment #2 originally posted by felix8a on 2008-02-01T12:22:25.000Z:

are you sure "our" is what you want? "our" imports a global var into the current
lexical scope. that's not usually what I want in a sub.

from caja.

kpreid avatar kpreid commented on September 2, 2024

Comment #3 originally posted by mikesamuel on 2008-02-03T10:20:59.000Z:

I fixed all the die messages.
$ grep die dashboard/dashboard.pl
die "output directory redeclared. Was $OUTPUT_DIR" if defined($OUTPUT_DIR);
die "build client redeclared. Was $BUILD_CLIENT" if defined($BUILD_CLIENT);
die 'Please specify output directory via -o' unless $OUTPUT_DIR;
die "$OUTPUT not a directory"DIR unless !(-e $OUTPUT_DIR) || -d $OUTPUT_DIR;
die "$0 requires a directory at $path" unless -d $path;
die "$0 requires an executable at $path" unless -x $path;
die "Output directory $out_dir already exists" if -e $out_dir;
die "$out_dir/$index does not exist" unless -e "$out_dir/$index";
open(IN, "$find | $grep|") or die "Failed to grep for TODOs: $!";
die "Bad grep output: $
" unless defined($file);
die "Malformed task: $task" unless defined($detail);
open(IN, "<$xml_file") or die "$xml_file: $!";
die "Malformed $xml_file: $" unless $testsummary =~ s/>.*//;
die "Malformed $xml_file: $
" unless $testsummary =~ m/\btests="(\d+)"/;
die "Malformed $xml_file: $" unless $testsummary =~ m/\berrors="(\d+)"/;
die "Malformed $xml_file: $
" unless $testsummary =~ m/\bfailures="(\d+)"/;
open(IN, "<$html_file") or die "$html_file: $!";
die "Malformed $html_file: $html"
die "Malformed $html_file: $summaryTable" unless defined($pct);
die "exec_log called in wrong context" unless wantarray;
rmtree $OUTPUT_DIR or die "clean $OUTPUT_DIR: $!";
open(OUT, ">$out_file") or die "$out_file: $!";
open(OUT, ">$OUTPUT_DIR/time-series.xml") or die "timeseries.xml: $!";
open(IN, "<$historical_report") or die "$historical_report: $!";
die "Malformed historical report $historical_report"
die "Bad stylesheet filename: $xsl_file"
die "xsltproc failed on $xsl_file" if $?;
die "Bad stylesheet filename: $xsl_file"
die "xsltproc failed on $xsl_file" if $?;

I can't figure out the semantics of our from http://perldoc.perl.org/functions/our.html

But the below program:

sub f() { our $x = 4; print "f: $x\n"; }
sub g() { our $x; print "g: $x\n"; }
f();
g();
print "main: $x\n";

prints:
f: 4
g: 4
main: 4

So I agree with felix8a that it's not what I want.

from caja.

kpreid avatar kpreid commented on September 2, 2024

Comment #4 originally posted by [email protected] on 2008-02-12T20:33:25.000Z:

I forgot to clarify my point about "our". What I meant is that a "my" variable in the
global scope shouldn't be used in subroutines.

Anyway, now that Mike has made the change, LGTM.

from caja.

kpreid avatar kpreid commented on September 2, 2024

Comment #5 originally posted by mikesamuel on 2008-03-09T02:51:44.000Z:

<empty>

from caja.

kpreid avatar kpreid commented on September 2, 2024

Comment #6 originally posted by [email protected] on 2013-11-11T18:46:13.000Z:

<empty>

from caja.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.