fast installing modules

2009-08-18 Thread Jenn G.
Hello,

We have a project which has 30+ perl/modperl modules.
Installing those modules by hand on each host is wasting time.
So can we just copy the directory "/usr/lib/perl5/" from the already
installed host to any other not installed hosts?

We use Linux OS, perl version is 5.8.8.

Thanks.

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




Re: function calling and object calling

2009-08-11 Thread Jenn G.
On Tue, Aug 11, 2009 at 2:33 PM, Uri Guttman wrote:
>>>>>> "JG" == Jenn G  writes:
>
>  JG> When I create a package, and call its methods by both object way and
>  JG> function (exported) way, how to avoid the conflict in arguments
>  JG> passing?
>
> why are you trying to do OO and procedural calls on the same subs? it
> makes no sense. how will a procedural find the 'object' the method style
> is going to use for its data? there is a technique for using procedural
> calls with a singleton object but that requires you assume only one
> object of that type ever. i don't think you seem to want that.
>

Really? Hmm, see these below:

# perl -e 'use CGI qw/header/; print header()'
Content-Type: text/html; charset=ISO-8859-1

# perl -e 'use CGI; my $q=CGI->new; print $q->header'
Content-Type: text/html; charset=ISO-8859-1

#

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




function calling and object calling

2009-08-10 Thread Jenn G.
Hello,

When I create a package, and call its methods by both object way and
function (exported) way, how to avoid the conflict in arguments
passing?

for exmaple,


package myclass;

require Exporter;
our @ISA = qw/Exporter/;

our @EXPORT = qw/my_method/;


sub new {
...
}

sub my_method {

my $self = shift;
my @arg = @_;
...
}

__END__

But for function calling, "my $self = shift;" shouldn't be used.
So how to make both function calling and object calling work together?

Thanks.

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




Re: evaluate for max and min value in array

2009-07-22 Thread Jenn G.
thanks all the suggestions.

On Wed, Jul 22, 2009 at 4:32 PM, Shawn H. Corey wrote:
> Jenn G. wrote:
>>
>> Hello,
>>
>> How to lookup the max and min value in an array?
>> Just like SQL's max() and min() functions.
>>
>> Thanks.
>>
>
> use List::Util qw/min max/;
>
> See `perldoc List::Util` for details.
>

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




evaluate for max and min value in array

2009-07-22 Thread Jenn G.
Hello,

How to lookup the max and min value in an array?
Just like SQL's max() and min() functions.

Thanks.

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




Re: Install DBD::Sybase

2009-07-21 Thread Jenn G.
On Tue, Jul 21, 2009 at 9:11 PM, Gurunandan R. Bhat wrote:
> Ooops - Sorry!! I sent an HTML reply and my links went away.
>
> Here is my reply with the links preserved:
>
> I assume you have installed the freetds library.
> Please follow the solutions given here:

> http://lists.ibiblio.org/pipermail/freetds/2006q3/020587.html


Thanks Bhat.
The message in above url has resolved my problem, now DBD::Sybase has
been installed on my slackware linux.

re-paste it:

I added the folowing before syb_init() function in dbdimp.c file and
everything is fine.

#undef CS_VERSION_150
#undef CS_VERSION_125
#undef CS_VERSION_120
#undef CS_DATE_TYPE
#undef CS_BIGINT_TYPE

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




Re: Install DBD::Sybase

2009-07-21 Thread Jenn G.
And I tried to install unixODBC but also make failed:

g++ -g -O2 -o .libs/ODBCConfig main.o  -L/usr/X11R6/lib/qt-3.3.8b/lib
/usr/lib/qt-3.3.8b/lib/libqt-mt.so -L/usr/X11R6/lib /usr/lib/libmng.so
-ljpeg -lpng -lz -lGL -lXmu -lXrender -lXrandr -lXcursor -lXinerama
-lXft /usr/lib/libfreetype.so -lfontconfig -lXext -lX11 -lm -lSM -lICE
../odbcinst/.libs/libodbcinst.so ../extras/.libs/libodbcextraslc.a
../DriverManager/.libs/libodbc.so -ldl -lpthread -Wl,--rpath
-Wl,/usr/lib/qt-3.3.8b/lib
/usr/lib/gcc/i486-slackware-linux/4.2.3/../../../../i486-slackware-linux/bin/ld:
cannot find -lGL
collect2: ld returned 1 exit status
make[1]: *** [ODBCConfig] Error 1
make[1]: Leaving directory `/root/software/unixODBC-2.2.14/ODBCConfig'
make: *** [all-recursive] Error 1


No luck with MS SQL Server on Linux.:(


On Tue, Jul 21, 2009 at 2:38 PM, Jenn G. wrote:
> Hello,
>
> I follow the steps on this link to install and use DBD::Sybase for MSSQL:
> http://www.perlmonks.org/?node_id=392385
>
> But when configure I got:
>
> BLK api NOT available.
>
> Then make got:
>
> dbdimp.c:777: error: 'BLK_VERSION_150' undeclared (first use in this function)
> dbdimp.c:777: error: (Each undeclared identifier is reported only once
> dbdimp.c:777: error: for each function it appears in.)
> dbdimp.c:781: error: 'BLK_VERSION_125' undeclared (first use in this function)
> dbdimp.c:785: error: 'BLK_VERSION_120' undeclared (first use in this function)
>
>
> I searched but cound't find what's BLK api.
> Does it mean to use DBD::Sybase I have to install Sybase server firstly?
>
> Thanks.
>

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




Install DBD::Sybase

2009-07-20 Thread Jenn G.
Hello,

I follow the steps on this link to install and use DBD::Sybase for MSSQL:
http://www.perlmonks.org/?node_id=392385

But when configure I got:

BLK api NOT available.

Then make got:

dbdimp.c:777: error: 'BLK_VERSION_150' undeclared (first use in this function)
dbdimp.c:777: error: (Each undeclared identifier is reported only once
dbdimp.c:777: error: for each function it appears in.)
dbdimp.c:781: error: 'BLK_VERSION_125' undeclared (first use in this function)
dbdimp.c:785: error: 'BLK_VERSION_120' undeclared (first use in this function)


I searched but cound't find what's BLK api.
Does it mean to use DBD::Sybase I have to install Sybase server firstly?

Thanks.

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




help with a regex

2009-07-17 Thread Jenn G.
Hello,

I'm not sure if the syntax below is correct:

next if /\/0$|^127\./;

( the regex means when meet something like 192.168.1.0/0 or 127.0.0.1
it will be next.)

Or do I need to use () to enclose the char at both sides of the "|" ?

next if  /(\/0$)|(^127\.)/;

Please help, thanks!

Regards.

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




Re: how to choose multiplexing methods in perl

2009-07-14 Thread Jenn G.
On Wed, Jul 15, 2009 at 10:38 AM, XUFENG wrote:
> Hi all,
> I use IO::Socket::INET to program server-client communication.When trying to 
> serve some concurrency,I have some options:
>        1, multi-threading
>        2, one daemon process with IO::Epoll
> which is better?

Nothing is absolute better or worse, depends on your application.
But many people said Perl's threads is not stable enough.

Jenn.

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




one or two alarm(0)

2009-07-13 Thread Jenn G.
Hello,

>From the code below:

  eval {
local $SIG{ALRM} = sub { die "TIMEOUT\n" };
alarm($seconds);
... code to execute with timeout here ...
alarm(0);  # cancel alarm (if code ran fast)
  };
  alarm(0);# cancel alarm (if eval failed)


Is the second alarm(0) needed or not?
In my before experience, I used only one alarm(0) in eval {  }.

Please suggest, thanks.

Jenn.

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




Re: Hi

2009-07-10 Thread Jenn G.
Hi,

You may want Expect:
http://search.cpan.org/~rgiersig/Expect-1.21/Expect.pod


On Fri, Jul 10, 2009 at 3:00 PM, John Somoza wrote:
> I have a general perl question.
>
> I'm on OSX running a program from the command line. That program asks a
> series of questions, which I interactively answer.
>
> I would like to use perl to run the program (this part is not the problem)
> and answer the questions (this is the part I need help with). I have seen
> this type of thing done with a shell script (I think you can use the ECHO
> command in the bourne shell) but how would I do this in perl?
>
> Thanks,
>
> John
>

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




Re: Edit a config file using perl cgi script

2009-07-09 Thread Jenn G.
On Thu, Jul 9, 2009 at 5:34 PM, Alpesh Naik wrote:
>
> For eg: below is what I have in the config file "configfile.cfg".
>
> Key1=OldValue1
> Key2=OldValue2
>
> I want to search for "Key1" and change "OldValue1" to "NewValue1"

Read the content into memory, search the key (i.e, use a regex) and
replace the value, then write back to the original file.


>
> *(Note that, permission of config file is 600, i want to edit the file
> without changing permissions)*

You couldn't unless using a wrapper like sudo.


Jenn.

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




Re: Is there a well-written threading TCP server module for perl?

2009-07-08 Thread Jenn G.
On Thu, Jul 9, 2009 at 11:38 AM, XUFENG wrote:
> hi all,
>
>        Is there a well-written threading TCP server module for perl? I want a 
> module that manages threading itself and utilize Posix Threading for 
> performance.
>

See this class "Socket::Class":
http://search.cpan.org/~chrmue/Socket-Class-2.21/Class.pm


And this example (Internet Server using threads):
http://search.cpan.org/~chrmue/Socket-Class-2.21/Class.pm#Internet_Server_using_threads


Good luck!

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




Perl on VxWorks

2009-07-08 Thread Jenn G.
Hello,

Sorry I'm just asking this question for others.
Does anyone have the experience of porting Perl on VxWorks OS?

Thanks.

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