Need Help with Perl Mobile Environment

2011-01-24 Thread Khabza Mkhize
Can you please help with where to find information about Perl mobile
version
I need to develop  Accommodation Booking Website that will run on Smart
phone, Iphone And Blackberry.

Please send me a links with relevant information

regards
Khabazela
Green IT Web
http://www.greenitweb.co.za

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: [linux] unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread ed
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Jan 24, 2011 at 05:27:11PM +0530, Agnello George wrote:
> i got a file like this and i need add it into my svn
> 
> admin/upload_data/FINAL  leg  list  19_01_2010 to  agar  (Merged data in
> one).xls
> 
> i as able to add other files with space using the following command :
> 
>  svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
> 
> however there are some special characters like ( ) +#@  that svn cannot
> understand as the full path of  the file .
> 
> can some one help me in this in perl or in shell .

If in perl, then you may want to pass the arguments to the system
command as an array, so:

  @arg = [ "svn", "add", "File with spaces" ];
  system( @arg );

Hope this helps

- -- 
Best regards,
Ed http://www.s5h.net/

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAk09300ACgkQ4dyr7s6PRYil6wCfc9p+peQ3pUyiAMCHDrS/XeGI
QN4AoJdHUjWPLWngvO7yefCqzVXcMAHn
=g9Zc
-END PGP SIGNATURE-

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: [CentOS] unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread Nico Kadel-Garcia
On Mon, Jan 24, 2011 at 6:57 AM, Agnello George
 wrote:
> i got a file like this and i need add it into my svn
>
> admin/upload_data/FINAL  leg  list  19_01_2010 to  agar  (Merged data in
> one).xls

First: don't do this, seriously. You're begging for pain in your
scripting to handle such files from now on.


> i as able to add other files with space using the following command :
>
>  svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add

Second, stop playing with xargs in command line handling. It is not your friend.

You should be able to do "svn add "admin/upload_data/FINAL leg list

svn add "admin/upload_data/FINAL  leg  list  19_01_2010 to  agar
(Merged data in one).xls"

> however there are some special characters like ( ) +#@  that svn cannot
> understand as the full path of  the file .

Well, *YES*. You're going to have difficulty getting characters that
mean things to the subversion somponent numbering scheme or the
Subversion URL scheme, such as '@', '/', and '#' into the actual
filenames. Even if you can leverage your way past this by stuffing in
enough backslashes, you're effectively destabilizing your Subversion
repository and scripting to handle it, especially post-commit scripts.

> can some one help me in this in perl or in shell .
>
> --
> Regards
> Agnello D'souza

Can you first explain why you want, or need,  to do this?

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Dereference Links

2011-01-24 Thread Mike Flannigan


On 1/23/2011 5:21 PM, beginners-digest-h...@perl.org wrote:

>That module hasn't been updated since 2001. You'll have a >much easier


time using WWW::Mechanize and many more people will be in>a position to
help you.


>Peter Scott

>


Thank you for the reply.
I appreciate it.


Mike Flannigan



Re: Lighttpd + FCGI = Socket not closing?

2011-01-24 Thread C.DeRykus
On Jan 21, 9:03 am, perl-l...@christophfriedrich.de wrote:
> Hi there,
>
> I'm using the FCGI module (version 0.67) and a lighttpd
> to create an imageserver.
>
> But currently I have the problem that if I
> shutdown the lighttpd server, the perl processes are still there with an
> open file descriptor to the socket.
>
> There are not a child process
> anymore and are only killable.
>
> Here some code:
>
> #!/usr/bin/perl
>
> use
> strict;
> use warnings;
>
> use FCGI;
>
> my $handling_request = 0;
> my
> $exit_requested = 0;
>
> my $request = FCGI::Request();
>
> sub sig_handler {
>
> $exit_requested = 1;
>  if ( !$handling_request ) {
>  $request->Flush();
>
> $request->Finish();
>  exit( 0 );
>  }
>
> }
>
> $SIG{USR1} =
> &sig_handler;
> $SIG{TERM} = &sig_handler;
> $SIG{PIPE} = 'IGNORE';
>
> # Main
> function
> sub do_request {
>  $request->Flush();
>
> $request->Finish();
>
> }
>
> while ( $handling_request = ( $request->Accept()>= 0 ) ) {
>
>  &do_request;
>
>  $handling_request = 0;
>  last if
> $exit_requested;
>
> }
>
> $request->Flush();
> $request->Finish();
>
> exit( 0
> );
>
> Here is the lighttpd config (only fastcgi section):
>
> fastcgi.server = ( "" =>
>  ((
>  "max-procs" => 1,
>  "socket" =>
> "/tmp/img.promobil.de.fcgi.socket",
>  "bin-path" =>
> "/home/friedrich/public_html/promobil/trunk/imageserver/imageserver.pl",
>
> "check-local" => "disable",
>  "allow-x-send-file" => "enable",
>  ))
>  )
>
> I
> don't know why the perl processes hung there and do not exit...
>
> Here
> also some output of lsof (from such a process):
 [ snip ]

Just a shot in the dark but what is the reason for ignoring
SIGPIPE...?

--
Charles DeRykus


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Extracting properties from objects.

2011-01-24 Thread Ben Lavery
Hi Sean,

In your given example, $l becomes a link object, so you go:
$l->url(); to get the URL, for example.

After using your code below, look at this page: 
http://search.cpan.org/~petdance/WWW-Mechanize-1.66/lib/WWW/Mechanize/Link.pm
That will show you how to use $l.

Hope that helps,
Ben

On 24 Jan 2011, at 10:17, Sean Murphy wrote:

> Hi All.
> 
> I am wondering how do you extract properties from objects. If we use 
> WWW:Mechanize as an example. How would you get the properties of the first 
> link. Lets say:
> 
> my $l = $mec->find_link (text => 'link');
> 
> So I would like to find out the text of the link, URL, attribs, etc. This is 
> just an example. When I review the CPAN doc, they don't show this type of 
> information.
> 
> Sean 
> 



Re: unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread Shlomi Fish
On Monday 24 Jan 2011 13:57:11 Agnello George wrote:
> i got a file like this and i need add it into my svn
> 
> admin/upload_data/FINAL  leg  list  19_01_2010 to  agar  (Merged data in
> one).xls
> 
> i as able to add other files with space using the following command :
> 
>  svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add
> 
> however there are some special characters like ( ) +#@  that svn cannot
> understand as the full path of  the file .
> 
> can some one help me in this in perl or in shell .

1. I suggest you try using Subversion's SVN::Wc API:

http://search.cpan.org/perldoc?SVN::Wc

It is written in C and has bindings for Perl and other languages, and it more 
reliabale than parsing the command line.

2. If that fails you can try this:

[code]

#!/usr/bin/perl

use strict;
use warnings;

open my $svn_st, "svn st|";

my @files_to_add;

while (my $line = <$svn_st>)
{
chomp($line);

if ($line =~ m{\A\?})
{
push @files_to_add, substr($line,8);
}
}
close($svn_st);

system("svn", "add", @files_to_add);

[/code]

Note that I've used the list form of perldoc -f system.

Regards,

Shlomi Fish
-- 
-
Shlomi Fish   http://www.shlomifish.org/
Apple Inc. is Evil - http://www.shlomifish.org/open-source/anti/apple/

Chuck Norris can make the statement "This statement is false" a true one.

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: Dereference Links

2011-01-24 Thread Rob Dixon

On 21/01/2011 14:01, Mike Flannigan wrote:


I'm trying to dereference the @{$links} produced
by WWW::SimpleRobot and am having a heck of
a time getting it done.  Can anybody help?
You can see some of the things I have tried
below.

I know I can do this link extraction myself with
LinkExtor, or at least think I can do it, but
I'd like to know how to dereference this script.


Mike Flannigan



#
#
#
#!/usr/local/bin/perl
#
use strict;
use warnings;
use WWW::SimpleRobot;
my $robot = WWW::SimpleRobot->new(
 URLS=> [ 'http://www.portofhouston.com/' ],
 FOLLOW_REGEX=> "^http://www.portofhouston.com//";,
 DEPTH   => 1,
 TRAVERSAL   => 'depth',
 VISIT_CALLBACK  =>
 sub {
 my ( $url, $depth, $html, $links ) = @_;
 my @linkder = @{$links};
 print STDERR "Visiting $url\n\n";
#print STDERR "Depth = $depth\n";
#print STDERR "HTML = $html\n";
#  print STDERR "Links = @{$links}\n";
# print STDERR "Links = @linkder\n";
# foreach (@linkder){
#print STDERR "$_\n";
#}
 for (my $num = 0; $num <= $#linkder; $num++) {
 print STDERR "$linkder[$num]\n";
 }
#for (my $num = 0; $num <= $#linkder; $num++) {
#print STDERR "${$linkder}[$num]\n";
#}
 }

 ,
 BROKEN_LINK_CALLBACK  =>
 sub {
 my ( $url, $linked_from, $depth ) = @_;
 print STDERR "$url looks like a broken link on
$linked_from\n";
 print STDERR "Depth = $depth\n";
 }
);
$robot->traverse;
my @urls = @{$robot->urls};
my @pages = @{$robot->pages};
for my $page ( @pages )
{
 my $url = $page->{url};
 my $depth = $page->{depth};
 my $modification_time = $page->{modification_time};
}

print "\nAll done.\n";


Hey Mike

What you have written can be fixed by changing it to

  for (my $num = 0; $num <= $#linkder; $num++) {
print STDERR "@{$linkder[$num]}\n";
  }

or even

  for (my $num = 0; $num <= $#{$links}; $num++) {
print STDERR "@{$links->[$num]}\n";
  }

but it is much clear and more Perlish to write

  foreach my $link (@$links) {
print STDERR "@{$link}\n";
  }

Remember: everywhere you could put a simple variable identifier you can
put a reference. Surrounding it in braces is always valid and helps
resolve ambiguity, so @linkder is the same as @{linkder} is the same as
@{$links}. Likewise, $linkder[$num] (or $links->[$num]) is an array
reference, and can be dereferenced with @{$linkder[$num]}.

HTH,

Rob


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




unable to check in code to svn when files contain spaces or characters

2011-01-24 Thread Agnello George
i got a file like this and i need add it into my svn

admin/upload_data/FINAL  leg  list  19_01_2010 to  agar  (Merged data in
one).xls

i as able to add other files with space using the following command :

 svn st |grep ? |cut -c8- |sed 's/ /\\ /g' |xargs svn add

however there are some special characters like ( ) +#@  that svn cannot
understand as the full path of  the file .

can some one help me in this in perl or in shell .

-- 
Regards
Agnello D'souza


Re: How to monitor Windows CPU usage in Linux Server

2011-01-24 Thread shawn wilson
On Jan 24, 2011 12:41 AM, "sync"  wrote:
>
> Hello, guys:
>
> is there any information in the MIB about the CPU-usage. I am
> monitoring Windows-machines using whatsup and the goal is to raise an
> alarm if the usage passes a certain threshold.
>
> By the way ,  I want to monitor them in Linux Server (CentOS),
> and the Windows is  Windows XP .

I think one of the kde or gnome process monitors would show a pretty picture
of windows performance. However, I'd look into snmp, nmap (maybe), perl,
metasploit (if you want to hack apart ruby).

Ps - msf would definitely be the funniest solution to bring to your boss
(depending on your threshold for humor). Though using an nmap plugin or
installing an snmp server on every box might be the easiest.


Re: Reading a value from a hash using a variable for the key

2011-01-24 Thread Eyal B.
On Jan 21, 11:42 pm, ewinst...@gmail.com ("Eyal B.") wrote:
> On Jan 21, 4:30 pm, rob.di...@gmx.com (Rob Dixon) wrote:
>
>
>
> > On 21/01/2011 05:50, Erez Schatz wrote:
>
> > > On 20 January 2011 15:38, Eyal B.  wrote:
>
> > >> I'm getting an error on the line where I should use the TTL variable -
> > >> and take the right value from the hash (%list) :Use of uninitialized
> > >> value in print at D:\system\perl\os-rec\os-rec5_.pl line 24
> > >> ,  line 3.
>
> > >> Any idea ?
> > >>                         if("$line" =~ "TTL=")
> > >>                                         {
> > >>                                 $line =~ s/.*TTL=//;
> > >>                                 print "TTL = $line\n";
> > >>                                 print $list{"$line"} ;
> > >>                                 # print "Machine $machine_IP is 
> > >> $list{$line}" ;
> > >>                                 last;                                   }
> I found the issue, and resolve it
> This regex clean unnecessary, extra digits: $line =~/.*TTL=\s*(\S+)\s*$/;


> > > Assuming a specific line is made of nothing but TTL=, then $line =~
> > > s/.*TTL=//; will erase the line, leaving you with an empty
> > > (uninitialized) $line variable.
>
> > No it won't, it will leave $line containing a null (zero-length) string.
> > There is no way to change a string value to uninitialized (undef) by
> > deleting characters from it.
>
> > - Rob
>
> ok. So why on print "TTL = $line\n"; I do get TTL = 125, if it's
> undefined ?
> Thanks, Rob, for your answer.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Reading a value from a hash using a variable for the key

2011-01-24 Thread אייל ב .
Guys
You claim : s/.*TTL=//; will erase the line, leaving with an empty
(uninitialized) $line variable.
I want to ask :
If so, how print "TTL = $line\n" does give me the right value !
If it will leave $line containing a null (zero-length or undef) string
- how can I print it ?
(I get  TTL = 125 if ping to Windows machine)


2011/1/21 Abuse Desk :
>
> On Jan 21, 2011, at 2:53, אייל ב. wrote:
>
> Google Groups might not be sending us the mail -- try posting directly to the 
> list by emailing beginners@perl.org.
>
>  - ask
>
>> Hi
>> I'm sending a reply using the : 
>> http://groups.google.com/group/perl.beginners/browse_thread/thread/45594cc9ea0ae4b5/0e6e248cab1d1e62#0e6e248cab1d1e62
>>
>> Reply with my questions to the answers I got.
>> But nothing is published.
>>
>>
>> Thanks
>
>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Reading a value from a hash using a variable for the key

2011-01-24 Thread Eyal B.
If so, how print "TTL = $line\n" does give me the right value ! (I
get  TTL = 125 if ping to Windows machine.

Thanks, for your answers.

On Jan 21, 4:30 pm, rob.di...@gmx.com (Rob Dixon) wrote:
> On 21/01/2011 05:50, Erez Schatz wrote:
>
>
>
> > On 20 January 2011 15:38, Eyal B.  wrote:
>
> >> I'm getting an error on the line where I should use the TTL variable -
> >> and take the right value from the hash (%list) :Use of uninitialized
> >> value in print at D:\system\perl\os-rec\os-rec5_.pl line 24
> >> ,  line 3.
>
> >> Any idea ?
> >>                         if("$line" =~ "TTL=")
> >>                                         {
> >>                                 $line =~ s/.*TTL=//;
> >>                                 print "TTL = $line\n";
> >>                                 print $list{"$line"} ;
> >>                                 # print "Machine $machine_IP is 
> >> $list{$line}" ;
> >>                                 last;                                   }
>
> > Assuming a specific line is made of nothing but TTL=, then $line =~
> > s/.*TTL=//; will erase the line, leaving you with an empty
> > (uninitialized) $line variable.
>
> No it won't, it will leave $line containing a null (zero-length) string.
> There is no way to change a string value to uninitialized (undef) by
> deleting characters from it.
>
> - Rob


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Extracting properties from objects.

2011-01-24 Thread Sean Murphy
Hi All.

I am wondering how do you extract properties from objects. If we use 
WWW:Mechanize as an example. How would you get the properties of the first 
link. Lets say:

my $l = $mec->find_link (text => 'link');

So I would like to find out the text of the link, URL, attribs, etc. This is 
just an example. When I review the CPAN doc, they don't show this type of 
information.

Sean 



Re: Reading a value from a hash using a variable for the key

2011-01-24 Thread Shlomi Fish
Hi Eyal,

On Friday 21 Jan 2011 15:55:58 אייל ב. wrote:
> Hi Shlomi, Again.
> I'm sorry for keep sending you mails (It's because my answers to the
> to the group still doesn't work and I sent a complaint to
> postmas...@perl.org)
> 
> I hope now when I use a plain text message, it will be more understandable.
> (BTW, now it will use the ">" ?  I really not have much experience in
> netiquette rules)

See:

* http://en.wikipedia.org/wiki/Posting_style

* http://www.caliburn.nl/topposting.html

[snipped personal stuff]

> Back to Perl, and to my script.
> Because there are many things to understand, I want to focus on my
> major problem why, following the variable I took from the Regular Ex.:
> $list.
> I don't know why this is working : print $list{125} ;
> But this ain't working : print $list{$line} ; while there is 125 on the
> %line. What can be the difference. (I tried chomp) ?
> I tried to debug, I still can't understand why it's doesn't work !

What does x $line and x \%list say inside the debugger.

> 
> (BTW, I understood the bareword issue, and implement it , according to
> your recommendations. Got a new errors :
> Global symbol "$machine_IP" requires explicit package name at
> C:\system\Perl\OS- recognize\os-rec5.01_.pl line 14.
> Global symbol "$machine_IP" requires explicit package name at
> C:\system\Perl\OS- recognize\os-rec5.01_.pl line 15.
> Global symbol "$handle" requires explicit package name at
> C:\system\Perl\OS-reco gnize\os-rec5.01_.pl line 32.

That means you have not declared your variables. Read the thread here:

http://www.nntp.perl.org/group/perl.beginners/2007/07/msg93172.html

> Execution of C:\system\Perl\OS-recognize\os-rec5.01_.pl aborted due .
> 
> Here is the new code:
> 
> [code]
> 
> #! C:\Perl\bin\perl
> use strict;
> use warnings;
> 
> my %list =
> (60=>"linux",61=>"linux",62=>"linux",63=>"linux",64=>"linux",65=>"linux",
> 125=>"Windows",126=>"Windows",127=>"Windows",128=>"Windows",
> 250=>"Unix",251=>"Unix",252=>"Unix",253=>"Unix",254=>"Unix",255=>"Unix",
> 256=>"Unix",257=>"Unix",258=>"Unix",259=>"Unix",260=>"Unix");
> 
> my $path = "c:/system/Perl/hosts.txt" ;
> # read an IP List from the txt file c:/system/Perl/BSO2.txt and take
> the TTL data to the variable: $line
>   open my $machines_fh, '<', $path
>   or die "Could not open '$path' - $!";
>   while (my $machine_ip = <$machines_fh>) {

Well, the indentation here is wrong, so it's hard to read. This seems like an 
artefact of an indentation preserving mode while pasting without a special 
reservation for preserving indentation.

Regards,

Shlomi Fish

-- 
-
Shlomi Fish   http://www.shlomifish.org/
Optimising Code for Speed - http://shlom.in/optimise

Chuck Norris can make the statement "This statement is false" a true one.

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/