how to calc ip range?

2009-03-19 Thread practicalperl
I don't know how to calculate an IP range.
for example,

202.102.128.0/17  -  202.102.192.0/19  = ?

I mean the first range excludes the second, and what will be gotten.

please help, thanks.

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




Re: how to calc ip range?

2009-03-19 Thread practicalperl
Thanks Chas. I have got it correctly.

On Thu, Mar 19, 2009 at 9:54 PM, Chas. Owens  wrote:

>
> Take a look at Net::CIDR::Set[1] and the other modules[2] that work
> with CIDR notation.
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use Net::CIDR::Set;
>
> my $network1 = Net::CIDR::Set->new("202.102.128.0/17");
> my $network2 = Net::CIDR::Set->new("202.102.192.0/19");
>
> $network1->remove($network2);
>
> print map "$_\n", $network1->as_cidr_array;
>

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




calc page's downloading time

2009-04-15 Thread practicalperl
Greetings,


What's the easy way to calculate a webpage's downloading time?
(not only the page, but all the elements in this page, like images,
JS, css etc).
For example, I want to get a function:

my $dl_time = fetch_a_page("www.yahoo.com");


Thanks in advance.

Regards.

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




Re: calc page's downloading time

2009-04-15 Thread practicalperl
Thanks Jay, Chas and all others.Will try WWW:Mechanzie.

2009/4/15 Jay Savage :

> MWWW::Mechanzie
> (http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm) was
> designed to do just this. There's no need to reinvent the wheel by
> trying to cobble something out of LWP::Simple and HTML::Parser
> yourself.
>
> The real difficulty, as I see it, is defining what you men by "download time."
>

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




get localhost's IPAddr

2009-05-04 Thread practicalperl
Hello,

Is there a perl way to get the IP addresses set on local host, other
than parse data from ifconfig's output?
I'm using Linux and Solaris.

Thanks.

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




calc function's executed time

2009-06-01 Thread practicalperl
Hello,

What's the standard way to calculate a subroute's executed time in Perl?
Thanks in advance.

Jenn

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




Re: calc function's executed time

2009-06-01 Thread practicalperl
But I want the result to be millisecond not only be second. thanks.

On Mon, Jun 1, 2009 at 5:01 PM, Raymond Wan  wrote:
>
> Hi Jenn,
>
>
> practicalp...@gmail.com wrote:
>>
>> What's the standard way to calculate a subroute's executed time in Perl?
>> Thanks in advance.
>
>
> I don't know what's the standard way, but I use the times function and get
> the user time before and after the subroutine and then subtract.
>
> http://perldoc.perl.org/functions/times.html
>
> Ray
>
>

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




HTML Template

2009-06-08 Thread practicalperl
Hello,

I will begin a new project, which is medium large, with about 200 CGI
scripts with Perl.
We have designers who make HTML/JS/CSS etc.
I want to choose a template system which will let perl code be
separated from front-page codes (like html,css etc).
I have tried HTML::Template, which is simple enough.
Except that, do you have any other good template to be suggested?
What're their advantages?

Thanks.
Jenn.

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




module for accessing MSSQL

2009-07-07 Thread practicalperl
Hello,

what's the standard module for accessing MSSQL?
I searched on CPAN but found a lot.
The program should be run on Linux, not Windows.
Thanks.

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




Re: module for accessing MSSQL

2009-07-07 Thread practicalperl
On Tue, Jul 7, 2009 at 4:36 PM, Owen wrote:
>
>
>> what's the standard module for accessing MSSQL?
>> I searched on CPAN but found a lot.
>> The program should be run on Linux, not Windows.
>> Thanks.
>
>
>
>
> You probably want to install DBI and then DBD-mysql
>

sorry, I said MSSQL not Mysql.

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




Re: module for accessing MSSQL

2009-07-07 Thread practicalperl
On Tue, Jul 7, 2009 at 4:46 PM, Cristi Ocolisan wrote:
> Hi,
>
>
>
> You'll need DBD::ODBC module.
>

thanks.
can DBD::ODBC be run under Linux?

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




Re: module for accessing MSSQL

2009-07-07 Thread practicalperl
Thanks all for the helps. Now I know there are at least two correct ways for it.

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




encrypt a text file

2008-08-26 Thread practicalperl
hello,

how to encrypt a text file and decrypt it with perl?

for example, I have a config file,

svr.conf

I want to encrypt it to svr.conf.encrypt.

But I should also have the ability  to decrypt the encryped one to the
original text.

Any suggestion is welcome. thanks.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




discard sessions when close browser

2008-09-17 Thread practicalperl
Hello,

I use CGI::Session in some of my CGI scripts.
How to delete user's session in web server automatically when he close
the client browser?
Thanks.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




Re: discard sessions when close browser

2008-09-20 Thread practicalperl
On Thu, Sep 18, 2008 at 4:49 PM, Raymond Wan <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Sorry, I might be missing something, but when the client closes the browser
> window, no message is sent to the web server.  So, I think the server has no
> way of knowing that a window has closed.  The best alternative might be to
> set a time limit on client information and purge it periodically based on
> the time of the last client visit...
>

Thanks.
But many web entries like AOL webmail, when user login from the
browser, the session was there. When user close the browser and login
again, he/she is required to provide the username/password. That may
means, when closing browser, the session get lost on the server. Is
it?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




what does this match for?

2009-02-11 Thread practicalperl
I saw a Regex:

(?i:(j?sessionid|(php)?sessid|(asp|jserv|jw)?session[-_]?(id)?|cf(id|token)|sid))


I especially didn't know what the leading "?i:" means.
Please help, thanks!

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




undefined subroutine

2009-03-15 Thread practicalperl
Hello,

How to find there're one or more undefined subroutines in a perl scritp?
for example,

use strict;
use warnings;


if (1) {
test1();
} else {
test2();
}

sub test1 {
print 1;
}

__END__


in above code, when tes2t() isn't executed, we may not have the chance
to know test2() is not defined.

I ask this because, some of the scripts are very long (more than 2000
lines maybe?), and there are many subroutines in them.
Some subroutines are used, but maybe not defined, or maybe just typos
(ie, we defined example_call() function but we call sample_call()
later).
How to find this case?

Thanks.

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




about the message queue server

2010-12-09 Thread practicalperl
Hi,

Would you please recommend me a high performance message queue server?
Currently I'm looking up at:
http://search.cpan.org/~dsnopek/POE-Component-MessageQueue-0.2.10/lib/POE/Component/MessageQueue.pm

But I know nothing about its performance stuff.

Thanks.

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




about glob

2010-12-16 Thread practicalperl
This has been confused me:

[an...@localhost tmp]$ ls
[an...@localhost tmp]$ perl -le'print glob("foo.3")'
foo.3


there is nothing in the tmp directory.
but why glob("foo.3") returns the string?

$ perl -v

This is perl, v5.8.8 built for i686-linux

Thanks.

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




Re: about glob

2010-12-16 Thread practicalperl
On Thu, Dec 16, 2010 at 9:47 PM, C.DeRykus  wrote:

> There weren't any  matches with files and no wildcards
> in the glob pattern so the pattern itself is returned *.  If
> there had been a wildcard in the pattern, then nothing
> would have been returned.
>

Thanks. But still being confused about the case below.

[an...@localhost tmp]$ ls foo*
foo.1  foo.2  foo.3


[an...@localhost tmp]$ cat t2.pl
#!/usr/bin/perl -l
use strict;

for (1..10) {
   if (my $x=glob "foo.$_") {
 print $x;
 print "yes";
   } else {
 print $x;
 print "no";
   }
   print "-";
}


[an...@localhost tmp]$ perl t2.pl
foo.1
yes
-

no
-
foo.3
yes
-

no
-
foo.5
yes
-

no
-
foo.7
yes
-

no
-
foo.9
yes
-

no
-

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




Net::Cassandra

2011-01-02 Thread practicalperl
Has anybody here been using Net::Cassandra?
I used but sometime found it run with problems.
Not sure it's me or this module or the cassandra server's problem.

Thanks.

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