sub form_create : Local { my ($self, $c) = @_; $c->stash->{authors} = [$c->model('DB::Authors')->all]; $c->stash->{template} = 'books/form_create.tt2'; } =head2 list Fetch all book objects and pass to books/list.tt2 in stash to be displayed =cut sub list : Local { # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst # 'Context' that's used to 'glue together' the various components # that make up the application my ($self, $c) = @_; # Retrieve all of the book records as book model objects and store in the # stash where they can be accessed by the TT template $c->stash->{books} = [$c->model('DB::Books')->all]; # Set the TT template to use. You will almost always want to do this # in your action methods (action methods respond to user input in # your controllers). $c->stash->{template} = 'books/list.tt2'; } #### [%- # optional, but both the beginning and the ending TT tags support chomping. -%] [% # Provide a title to root/lib/site/header -%] [% META title = 'Book List' -%] [% # Display each book in a table row %] [% FOREACH book IN books -%] [% END -%]
TitleRatingAuthor(s)
[% book.title %] [% book.rating %] [% tt_authors = []; tt_authors.push(author.last_name) FOREACH author IN book.authors -%] [% tt_authors.join(", ") | html %] ([% tt_authors.size | html %])
~ ##
## [% META title = 'Manual Form Book Create' -%] [% Dumper.dump(authors) %]
Title:
Rating:
Author ID:
[% # Try out the TT Dumper (for development only!) -%]
    Dump of the 'authors' variable:
    
##
## use strict; use warnings; my @data = qw/123456 abcde 10-MAY-2006/; print type($_), "\n" for @data; sub type { local $_ = shift; return 'date' if /\d\d-\D\D\D-\d\d\d\d/; return 'number' if /^\d+$/; return 'string'; } #### create or replace type body string_agg_type is static function ODCIAggregateInitialize(sctx IN OUT string_agg_type) return number is begin sctx := string_agg_type( null, 0 ); return ODCIConst.Success; end; member function ODCIAggregateIterate(self IN OUT string_agg_type, value IN varchar ) return number is begin self.total := self.total || ','; if (self.item_count > 5) THEN self.total := self.total || chr(13); self.item_count := 0; end if; self.item_count := self.item_count + 1; self.total := self.total || value; return ODCIConst.Success; end; member function ODCIAggregateTerminate(self IN string_agg_type, returnValue OUT clob, flags IN number) return number is begin returnValue := ltrim(self.total,','); return ODCIConst.Success; end; member function ODCIAggregateMerge(self IN OUT string_agg_type, ctx2 IN string_agg_type) return number is begin self.total := self.total || ctx2.total; return ODCIConst.Success; end; end; create or replace FUNCTION stragg(input varchar2 ) RETURN clob PARALLEL_ENABLE AGGREGATE USING string_agg_type; #### my $p = $cgi->param("pl_copyright") || 'no'; my $p_values = { 'yes' => '--yes', 'no' => '--no' }; my $p_cmd = exists $p_values->{$p} ? $p_values->{$p} : '--no'; #### \documentclass[letterpaper,10pt,oneside]{book} \pagestyle{headings} \setlength{\oddsidemargin}{0in} \setlength{\evensidemargin}{0in} \begin{document} \section{Base Page} \subsection*{Page Info} \textbf{Title:} Base Page \\ \textbf{Page\_ID:} 0 \\ \textbf{Last Updated:} 2007-09-20 \\ \textbf{Last By:} EJH\_ADMIN \\ \textbf{Comments:} This base page holds all common navigations items. Search, home, logout and jump box. \subsection*{Branches} \begin{tabular}{|c|c|c|c|} \hline Sequence & Branch Point & Branch Type & When \\ \hline 10 & AFTER\_PROCESSING & Branch to Page or URL & LOGOUT \\ \hline 10 & AFTER\_PROCESSING & Branch to Page or URL & MOVE \\ \hline \end{tabular} \subsection*{Regions} \subsubsection{Region: Breadcrumb } \begin{tabular}{|l|l|} \hline Sequence & 1 \\ \hline Template & Breadcrumb Region \\ \hline Column & 1 \\ \hline Position & Page Template Region Position 1 \\ \hline Source Type & Breadcrumb \\ \hline \end{tabular} \paragraph{Items} \begin{tabular}{|l|l|l|} \hline Sequence & Name & Type \\ \hline \hline 30 & P4\_PARENT\_NAME & Hidden \\ \hline Source Type & \multicolumn{2}{|l|}{SQL Query} \\ \hline \hline 40 & P4\_PARENT\_ID & Hidden \\ \hline Source Type & \multicolumn{2}{|l|}{SQL Query} \\ \hline \end{tabular} \paragraph{Buttons} \begin{tabular}{|l|l|l|l|} \hline Sequence & Name & Label & Position \\ \hline \hline 30 & BACK & Back to \&P4\_PARENT\_NAME. & BOTTOM \\ \hline \textbf{Redirect URL} & \multicolumn{3}{|l|}{f?p=\&APP\_ID.:4:\&SESSION.::\&DEBUG.:4:P4\_CATEGORY\_ID:\&P4\_PARENT\_ID.} \\ \hline \end{tabular} \end{document} #### select topic.id, ( SELECT id reply_id FROM ( SELECT rownum r , replies.* FROM nf_posts replies start with parent_id = topic.id connect by parent_id = PRIOR id ORDER BY UPDATED_DATE DESC ) WHERE r = 1 ) from nf_posts topic where parent_id is null #### #!/usr/bin/perl use strict; use warnings; use IO::Socket::INET; my $port = 9870; print "Broadcasting on UDP port: $port To: ", inet_ntoa(INADDR_BROADCAST), "\n"; my $sock = IO::Socket::INET->new(PeerPort => $port, PeerAddr => inet_ntoa(INADDR_BROADCAST), #PeerAddr => '192.168.12.255', Proto => 'udp', LocalAddr => 'localhost', Broadcast => 1 ) or die "Can't bind : $@\n"; # 10 udp's on the wire for (my $i=0;$i < 100;$i++) { my $data = 'UDP packet ' . $i; # send udp packet print "Sending '$data'\n"; $sock->send($data); sleep (rand 5); } #### use strict; use warnings; use IO::Socket::INET; $|++; my $port = 9870; print "Listening on UDP port: $port\n"; my $sock = IO::Socket::INET->new( Proto => 'udp', LocalPort => $port, Broadcast => 1 ) or die "Can't bind : $@\n"; my $mess; while ($sock -> recv ($mess, 2048)) { print "Saw: \n$mess\n"; }