]> Dogcows Code - chaz/p5-CGI-Ex/blobdiff - samples/app/app1/lib/App1/DoBill.pm
CGI::Ex 2.24
[chaz/p5-CGI-Ex] / samples / app / app1 / lib / App1 / DoBill.pm
diff --git a/samples/app/app1/lib/App1/DoBill.pm b/samples/app/app1/lib/App1/DoBill.pm
new file mode 100644 (file)
index 0000000..e759e91
--- /dev/null
@@ -0,0 +1,47 @@
+package App1::DoBill;
+
+=head1 NAME
+
+App1::DoBill - This step would process the billing
+
+=cut
+
+use strict;
+use warnings;
+use base qw(App1);
+use CGI::Ex::Dump qw(debug);
+
+sub run_step {
+    my $self = shift;
+
+    my $r = $self->cgix->apache_request;
+    local $| = 1 if ! $r;
+
+    $self->cgix->print_content_type;
+
+    print "<div id=fake_progress>\n";
+    print "At this point I would do something useful with the form data<br>\n";
+    print "I would probably add the customer and lineitems and bill the order<br>\n";
+    debug $self->form;
+    print "But for now I will just pretend I'm doing something for 10 seconds<br>\n";
+
+    my $max = 10;
+    for my $i (1 .. $max) {
+        $r->rflush if $r;
+        sleep 1;
+        print "Sleep $i/$max<br>\n";
+    }
+
+    print "</div>\n";
+    # this little progress effect would be better off with something like yui
+    print "<script>
+        var el = document.getElementById('fake_progress');
+        if (el) el.style.display='none';
+        document.scrollTop = '0px';
+        </script>\n";
+
+    return 0;
+}
+
+1;
+
This page took 0.016938 seconds and 4 git commands to generate.