Something mojolicious
Hi, Today I tried to write my first hello script, $ mojo generate lite_app hello vim hello to the following: get '/' => sub { my $self = shift; $self->render_text('Hello!'); }; $ morbo hello [Thu Jul 5 17:49:39 2012] [info] Listening at "http://*:3000";. Server available at http://127.0.0.1:3000. But on my two webbrowers when I tried localhost:3000 it failed to open. netstat shows me tcp0 0 0.0.0.0:30000.0.0.0:* LISTEN I don't know how to examine, Thanks ahead for your suggestions, Best regards, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Something mojolicious
Furthermore, Host is up. Other addresses for localhost (not scanned): 127.0.0.1 PORT STATESERVICE 3000/tcp filtered ppp Thanks, -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Something mojolicious
On Thu, 5 Jul 2012 18:03:07 +0800 lina wrote: > But on my two webbrowers when I tried localhost:3000 it failed to > open. As in connection failed, or gave some other error? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Something mojolicious
Have you tried localhost:3000 or the correct URL http://localhost:3000 ? --Octavian - Original Message - From: "lina" To: Sent: Thursday, July 05, 2012 1:03 PM Subject: Something mojolicious > Hi, > > Today I tried to write my first hello script, > > $ mojo generate lite_app hello > > vim hello to the following: > > get '/' => sub { > my $self = shift; > $self->render_text('Hello!'); > }; > > > $ morbo hello > [Thu Jul 5 17:49:39 2012] [info] Listening at "http://*:3000";. > Server available at http://127.0.0.1:3000. > > But on my two webbrowers when I tried localhost:3000 it failed to open. > > netstat shows me > tcp0 0 0.0.0.0:30000.0.0.0:* LISTEN > > I don't know how to examine, > > Thanks ahead for your suggestions, > > Best regards, > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Something mojolicious
On Thu, Jul 5, 2012 at 6:18 PM, David Precious wrote: > On Thu, 5 Jul 2012 18:03:07 +0800 > lina wrote: > >> But on my two webbrowers when I tried localhost:3000 it failed to >> open. > > As in connection failed, or gave some other error? Hi, It shows The connection has timed out The server at 127.0.0.1 is taking too long to respond. The site could be temporarily unavailable or too busy. Try again in a few moments. If you are unable to load any pages, check your computer's network connection. If your computer or network is protected by a firewall or proxy, make sure that Iceweasel is permitted to access the Web. > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Something mojolicious
On Thu, Jul 5, 2012 at 7:14 PM, Octavian Rasnita wrote: > Have you tried localhost:3000 or the correct URL http://localhost:3000 ? Yes. I tried again. > > --Octavian > > - Original Message - > From: "lina" > To: > Sent: Thursday, July 05, 2012 1:03 PM > Subject: Something mojolicious > > >> Hi, >> >> Today I tried to write my first hello script, >> >> $ mojo generate lite_app hello >> >> vim hello to the following: >> >> get '/' => sub { >> my $self = shift; >> $self->render_text('Hello!'); >> }; >> >> >> $ morbo hello >> [Thu Jul 5 17:49:39 2012] [info] Listening at "http://*:3000";. >> Server available at http://127.0.0.1:3000. >> >> But on my two webbrowers when I tried localhost:3000 it failed to open. >> >> netstat shows me >> tcp0 0 0.0.0.0:30000.0.0.0:* LISTEN >> >> I don't know how to examine, >> >> Thanks ahead for your suggestions, >> >> Best regards, >> >> -- >> To unsubscribe, e-mail: beginners-unsubscr...@perl.org >> For additional commands, e-mail: beginners-h...@perl.org >> http://learn.perl.org/ >> >> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?
On Jul 4, 2012, at 6:02 PM, David Precious wrote: > On Wed, 4 Jul 2012 17:01:35 -0400 > Phil Pinkerton wrote: > >> Very nice to know about CPAN. > > IMO, CPAN is one of Perl's strongest features :) > > >> got a syntax error though with your script >> >> syntax error at ./getACLinfo.pl line 51, near "say join" >> Execution of ./getACLinfo.pl aborted due to compilation errors. > > Whoops - as Chris pointed out, 'say' requires perl 5.10 or newer; I > should have included 'use 5.010' in the script to indicate that, but > forgot to (I have $PERL5OPT set to '-M5.010' on most boxes). > > Chris's mail contains full instructions to work round that problem. > ok using the example input file I got errors Use of uninitialized value $current_resource in string eq at /Library/Perl/5.12/SVN/Access.pm line 70, line 3. Use of uninitialized value $current_resource in string eq at /Library/Perl/5.12/SVN/Access.pm line 73, line 3. Use of uninitialized value $resource_name in string eq at /Library/Perl/5.12/SVN/Access.pm line 259, line 3. Use of uninitialized value $resource_name in pattern match (m//) at /Library/Perl/5.12/SVN/Access.pm line 265, line 3. Use of uninitialized value $resource_name in concatenation (.) or string at /Library/Perl/5.12/SVN/Access.pm line 266, line 3. Invalid resource format in ! (format 'repo:/path')! but substituting a copy of our actual svn access file I get Can't add new group cvs_cscda_owners: group already exists! So I may have a format issue with the example inout file phil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?
On Jul 4, 2012, at 5:46 PM, Chris Charley wrote: > > > "Phil Pinkerton" wrote in message > news:7a962da1-a5fb-4046-bbf5-f888dd715...@gmail.com... >> Very nice to know about CPAN. >> >> got a syntax error though with your script >> >> syntax error at ./getACLinfo.pl line 51, near "say join" >> Execution of ./getACLinfo.pl aborted due to compilation errors. >> >> [code] >> #!/usr/bin/perl >> >> use strict; >> use SVN::Access; >> my $acl = SVN::Access->new( acl_file => 'data' ); >> >> # Walk through the resources in the ACL file: >> for my $repopath ($acl->resources) { >> # For this resource, find out what authorisations exist: >> for my $auth ($repopath->authorized) { >> >> # $repopath->authorized gives us hashrefs of group => perms >> # TODO: I don't know if it might also give individual users, if >> # had per-user grants. >> my ($group, $perms) = each %$auth; >> >> if ($group =~ s/^@//) { >> # For each group, list out the members, along with the repo >> # permissions >> >> for my $user ($acl->group($group)->members) { >> say join '~', $user, $repopath->name, $group, $perms; >> } >> } else { >> die "Can't handle individual user permissions!"; >> } >> } >> } >> [/code] > > Hello Phil, > > Your script needs to use 5.010 or better to use the 'say' function. > > Right after the 'use strict;' line, enter 'use 5.010;' or > a newer version if that is what you have. > > Or, replace say with 'print': > > print join('~', $user, $repopath->name, $group, $perms), "\n"; > > Chris After switching input files It partially works but only for the first repository in the access file? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
use sort error
hi: i want sort my array .but the result is not right. i did not know why ? ---begin code-- perl -e ' @AoH = ( { rsh => "0.4", }, { telnet=> "0.022", }, { ssh => "0.3", }, ); print values($_) for sort my_sort @AoH; sub my_sort { values($a)<=>values($b)} ' --end code- the result is 0.40.0220.3 apparently it did not right! after i modify my_sort to this sub my_sort { (values($a))[0]<=>(values($b))[0]} it can work well .. anyone can tell me the reason! tanks! -- 继续上路。。
Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?
On Thu, 5 Jul 2012 09:30:01 -0400 Phil Pinkerton wrote: > ok using the example input file I got errors > > Use of uninitialized value $current_resource in string eq > at /Library/Perl/5.12/SVN/Access.pm line 70, line 3. [...] > Invalid resource format in ! (format 'repo:/path')! Ah, I recall now I had to uncomment the "#[groups]" line in the example input you originally supplied before the script would work. > but substituting a copy of our actual svn access file I get > > Can't add new group cvs_cscda_owners: group already exists! > > So I may have a format issue with the example inout file Yeah, sounds like there's something potentially wrong with the input file - have you perhaps defined the cvs_cscda_owners group twice? -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: use sort error
Hi xiyoulaoyuanjia, On Thu, 5 Jul 2012 22:53:03 +0800 xiyoulaoyuanjia wrote: > hi: > > i want sort my array .but the result is not right. i did not know why ? > > ---begin > code-- > perl -e ' > > @AoH = ( > { >rsh => "0.4", > }, > { >telnet=> "0.022", > }, > > { >ssh => "0.3", > }, > ); > print values($_) for sort my_sort @AoH; sub my_sort { > values($a)<=>values($b)} First of all, one should note that values will only work on scalars (containing hash references) starting from perl-5.14. If you want compatibility with older Perl use values(%$a). Now what your comparison do is numerically compare two lists, which are also of equal length, so you get meaningless results. Another note is that generally an array of hashes should be of homogeneous items, so they can be processed identically. Don't put different keys in different hash - use the same keys. Regards, Shlomi Fish > ' > --end > code- > > the result is 0.40.0220.3 apparently it did not right! > > after i modify my_sort to this > sub my_sort { (values($a))[0]<=>(values($b))[0]} > it can work well .. > > anyone can tell me the reason! > > tanks! > -- - Shlomi Fish http://www.shlomifish.org/ My Aphorisms - http://www.shlomifish.org/humour.html “We’re not doing it for money… we’re doing it for a shitload of money!” — Spaceballs, http://www.imdb.com/title/tt0094012/ Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?
On Jul 5, 2012, at 10:46 AM, David Precious wrote: > On Thu, 5 Jul 2012 09:30:01 -0400 > Phil Pinkerton wrote: >> ok using the example input file I got errors >> >> Use of uninitialized value $current_resource in string eq >> at /Library/Perl/5.12/SVN/Access.pm line 70, line 3. > [...] >> Invalid resource format in ! (format 'repo:/path')! > > Ah, I recall now I had to uncomment the "#[groups]" line in the example > input you originally supplied before the script would work. > > >> but substituting a copy of our actual svn access file I get >> >> Can't add new group cvs_cscda_owners: group already exists! >> >> So I may have a format issue with the example inout file > > Yeah, sounds like there's something potentially wrong with the input > file - have you perhaps defined the cvs_cscda_owners group twice? > Yes actually there were several duplicates. Once they were all removed the script seemed to work but just for the first Repository entry ? Not sure what is missing since it found all those duplicates but only seemed to actually complete just the first repo The final message after listing the last entry of the first repository: "Can't handle individual user permissions! at line 60" of the script ( which is just that message ) die " Can't handle individual user permissions!"; -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Something mojolicious
On Thu, Jul 5, 2012 at 6:19 AM, lina wrote: > PORT STATESERVICE > 3000/tcp filtered ppp This should show state 'open'. Do you have a firewall configured that would be blocking this? 'iptables -L -vn' output will show this. Mike -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?
On Jul 5, 2012, at 10:46 AM, David Precious wrote: > On Thu, 5 Jul 2012 09:30:01 -0400 > Phil Pinkerton wrote: >> ok using the example input file I got errors >> >> Use of uninitialized value $current_resource in string eq >> at /Library/Perl/5.12/SVN/Access.pm line 70, line 3. > [...] >> Invalid resource format in ! (format 'repo:/path')! > > Ah, I recall now I had to uncomment the "#[groups]" line in the example > input you originally supplied before the script would work. > > >> but substituting a copy of our actual svn access file I get >> >> Can't add new group cvs_cscda_owners: group already exists! >> >> So I may have a format issue with the example inout file > > Yeah, sounds like there's something potentially wrong with the input > file - have you perhaps defined the cvs_cscda_owners group twice? > I think I found the problem at first I though it was the double spaces ( lines) between the repositories, but after I commented out what listed properly I re-ran and got further down the list. What I saw was a pattern that was if a repository had subdirectories listed but no group assigned the script stopped When I commented those lines out or added groups it continued. example: [code] [foo::/] @group = rw @group2 = r [foo:/branches] [foo;/tags] [foo:/trunk 'script stops here' < example 2: [/code] [code] [foo::/] @group = rw @group2 = r [foo:/branches] @group3 = rw @group1 = r [foo;/tags] @grou4 = rw @group2 = rrw [foo:/trunk @group5 = rw @group6 = r 'script continues ok' < --- [/code] phil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: Newbie Where to start perhaps a hash-table is what I need to learn about ?
On Jul 5, 2012, at 10:46 AM, David Precious wrote: > On Thu, 5 Jul 2012 09:30:01 -0400 > Phil Pinkerton wrote: >> ok using the example input file I got errors >> >> Use of uninitialized value $current_resource in string eq >> at /Library/Perl/5.12/SVN/Access.pm line 70, line 3. > [...] >> Invalid resource format in ! (format 'repo:/path')! > > Ah, I recall now I had to uncomment the "#[groups]" line in the example > input you originally supplied before the script would work. > > >> but substituting a copy of our actual svn access file I get >> >> Can't add new group cvs_cscda_owners: group already exists! >> >> So I may have a format issue with the example inout file > > Yeah, sounds like there's something potentially wrong with the input > file - have you perhaps defined the cvs_cscda_owners group twice? > The script also stops when a single user is entered instead of a group This should not happen example: [code] [foo:/] @group1 = rw @group2 = rw [foo:/trunk] userID = r I believe for Subversion this is a valid entry > but script stops when not a group [/code] phil -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/
Re: use sort error
- 1.first do you meaning values(%{$a}) as same as values($a) which $a is references starting from perl-5.14 . 2. i did not know why I compare two lists ? values($a) return the value of hash which has only one element. so i just think values($a) return a list just when $a has more than one element. and i modify this to below code begin--- perl -e ' @AoH = ( ( rsh => "0.4", ), ( telnet=> "0.022", ), ( ssh => "0.3", ), ); print values($_) for sort my_sort @AoH; sub my_sort { values($a)<=>values($b)} ' code end--- the error is ” Type of argument to values on reference must be unblessed hashref or arrayref at -e line 15.“ i did not know why . IMO $a is a hash not a hash reference。it Iteration values ( rsh => "0.4",) which values will return 0.4, and another. can you tell me the reason ! thank your very mush! 2012/7/5 Shlomi Fish > Hi xiyoulaoyuanjia, > > On Thu, 5 Jul 2012 22:53:03 +0800 > xiyoulaoyuanjia wrote: > > > hi: > > > > i want sort my array .but the result is not right. i did not know why ? > > > > ---begin > > code-- > > perl -e ' > > > > @AoH = ( > > { > >rsh => "0.4", > > }, > > { > >telnet=> "0.022", > > }, > > > > { > >ssh => "0.3", > > }, > > ); > > print values($_) for sort my_sort @AoH; sub my_sort { > > values($a)<=>values($b)} > > First of all, one should note that values will only work on scalars > (containing hash references) starting from perl-5.14. If you want > compatibility > with older Perl use values(%$a). > > Now what your comparison do is numerically compare two lists, which are > also of > equal length, so you get meaningless results. > > Another note is that generally an array of hashes should be of > homogeneous items, so they can be processed identically. Don't put > different > keys in different hash - use the same keys. > > Regards, > > Shlomi Fish > > > ' > > --end > > code- > > > > the result is 0.40.0220.3 apparently it did not right! > > > > after i modify my_sort to this > > sub my_sort { (values($a))[0]<=>(values($b))[0]} > > it can work well .. > > > > anyone can tell me the reason! > > > > tanks! > > > > > > -- > - > Shlomi Fish http://www.shlomifish.org/ > My Aphorisms - http://www.shlomifish.org/humour.html > > “We’re not doing it for money… we’re doing it for a shitload of money!” > ― Spaceballs, http://www.imdb.com/title/tt0094012/ > > Please reply to list if it's a mailing list post - http://shlom.in/reply . > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > > -- 继续上路。。
Re: use sort error
On Jul 5, 2012, at 7:57 PM, xiyoulaoyuanjia wrote: > - 1.first do you meaning values(%{$a}) as same as values($a) which $a > is references starting from perl-5.14 . If $a is a reference to a hash, then %{$a} and %$a represent that hash. For Perls earlier than 5.12, the argument to values() must be a hash. Starting with 5.12, the argument may also be an array. Starting with 5.14, the argument may be a reference to an unblessed hash or array. In all of the cases, values() returns a list of appropriate values. > > 2. i did not know why I compare two lists ? values($a) return the value of > hash which has only one element. so i just think values($a) return a list > just when $a has more than one element. > and i modify this to below > code > begin--- > perl -e ' > @AoH = ( >( > rsh => "0.4", >), >( > telnet=> "0.022", >), > >( > ssh => "0.3", >), > ); That is not a hash, nor an array of hashes, but an array of 6 elements. Your original program had {} around the inner elements, not (), which made it an array of hash references. > print values($_) for sort my_sort @AoH; sub my_sort { > values($a)<=>values($b)} > ' > code > end--- > the error is ” Type of argument to values on reference must be unblessed > hashref or arrayref at -e line 15.“ > i did not know why . The argument to the sort() function is an array of scalars. Therefore, the $a and $b variables will hold scalars. Therefore, attempting to call values() with those scalars as arguments is a runtime error. > IMO $a is a hash not a hash reference。it Iteration values ( rsh => > "0.4",) which values will return 0.4, and another. > can you tell me the reason ! $a cannot be a hash, because is has a '$' in its name. Therefore, it can only hold a scalar value. In your original program, the elements of @AoH were hash references, so you could fetch the values of the hash with values(%$a) or (in 5.14 or later) values($a). Since there was only one pair of values in each hash, values will return a list of one element. However, it is still a list, and in a scalar context the value of the list is the number of elements (1 in this case). So your original program was comparing the lengths of the hashes, not the hash values. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/