|
|
Up |
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Jan 15, 2008 18:03
This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
8.16: How can I sleep() or alarm() for under a second?
If you want finer granularity than the 1 second that the sleep()
function provides, the easiest way is to use the select() function as
documented in "select" in perlfunc. Try the Time::HiRes and the
BSD::Itimer modules (available from CPAN, and starting from Perl 5.8
Time::HiRes is part of the standard distribution).
--------------------------------------------------------------------
|
| Show full article (1.37Kb) |
|
| |
no comments
|
|
  |
Author: deadpickledeadpickle
Date: Jan 15, 2008 16:32
This is a chat client wrote in perl Gtk2. THe problem that I am
running into is that when you type and click send I get a "print() on
closed filehandle GEN0 at chat-client.pl line 332" error. This error
is the print statement in the send_msg_all sub. I cant figure out how
the file handle is closed and am wondering if anyone can see why. I'll
leave the server running for testing purposes.
# the Client:
#!/usr/bin/perl
# Flow of the Program:
# *Send message to the server - send_msg_all
# *Connect to the server - sub connect_server
# -unblock the server - nonblock
# -Login to the server - send_login
# -Timer started to wait for messages - wait_for_msg
# >Handler - handle
# $Process the incoming meswsages - process_incoming
# @Recieve messages and display in textview - rcv_msg
|
| Show full article (21.19Kb) |
|
| |
8 Comments |
|
  |
Author: andrewladamsandrewladams
Date: Jan 15, 2008 13:29
A little while back, I was browsing these newsgroups, just like you
are now, and came across an article similar to this that said you
could make thousands of dollars within weeks with only an initial
investment of $5.00 ! So I thought, "Yeah, right, this must be a
scam", like most of us, but I was curious, like most of us, so I kept
reading. Anyway, it said that you send $1.00 to each of the 5 names
and address stated in the article. You then place your own name and
address in the bottom of the list of #5, and post the article in at
least 200 newsgroups.(There are thousands) No catch, that was it.
So after thinking it over, and talking to a few people first, I
thought about trying it. I figured what I have got to lose except 5
stamps and $5.00, right?
Like most of us I was a little skeptical and a little worried about
the legal aspects of it all. So I checked it out with U.S. Post
Office(1-800-725-2161) and they confirmed that it is indeed lega!
Then I invested the measly $5.00................
\\
\Well GUESS WHAT! !..... With in 7 days, I started getting money in
the mail! I was shocked! I still figured it end soon, and didn't give
|
| Show full article (9.40Kb) |
|
no comments
|
|
  |
Author: clearguy02clearguy02
Date: Jan 15, 2008 12:55
Hi folks,
I have two files, one with 1000 lines and another with 600 lines and
both files have the user login ID's and the first file has an extra of
400 user id's that I need to find.
Here is the script I have written:
------------------------------------
open (INPUT1,"fullFile.txt") or die "Cannot open the file: $!";
open (INPUT2,"comapreFile.txt") or die "Cannot open the file: $!";
@array1 = ;
@array2 = ;
foreach $word (@array2)
{
if(!grep /$word/i, @array1)
{
print "$_\n";
}
}
----------------------------------------
|
| Show full article (0.67Kb) |
|
4 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Jan 15, 2008 12:03
This is an excerpt from the latest version perlfaq8.pod, which
comes with the standard Perl distribution. These postings aim to
reduce the number of repeated questions as well as allow the community
to review and update the answers. The latest version of the complete
perlfaq is at http://faq.perl.org .
--------------------------------------------------------------------
8.14: How do I modify the shadow password file on a Unix system?
If perl was installed correctly and your shadow library was written
properly, the getpw*() functions described in perlfunc should in theory
provide (read-only) access to entries in the shadow password file. To
change the file, make a new shadow password file (the format varies from
system to system--see passwd for specifics) and use pwd_mkdb(8) to
install it (see pwd_mkdb for more details).
--------------------------------------------------------------------
|
| Show full article (1.45Kb) |
|
no comments
|
|
  |
Author: SteveSteve
Date: Jan 15, 2008 11:25
I'm playing around with Mason as a template-parser for standalone
scripts outside of a web environment. If it works well enough, I might
apply the approach toward writing a Mason wrapper so I can use Mason in
shared-hosting environments where I don't have access to Apache httpd.conf.
Anyway, I'm following the example provided in Mason's admin guide, and
have a small standalone script like this:
#!c:/Perl/bin/perl.exe
use HTML::Mason;
use strict;
my $outbuf;
my $interp = HTML::Mason::Interp->new(
comp_root => 'c:/workspace/MyMasonTemplates',
data_dir => 'c:/workspace/MyMasonData',
out_method => \$outbuf
);
$interp->exec( 'test.html' );
However, when I run this script I get the following error:
Component path given to Interp->load must be absolute (was given test.html)
|
| Show full article (1.25Kb) |
|
2 Comments |
|
  |
Author: Thomas ArmstrongThomas Armstrong
Date: Jan 15, 2008 08:59
Hi.
I'm creating a Perl script extracting text from a webpage using LWP,
and want to check if text is UTF-8 or Latin-1 encoded?
Is there any known function? I don't know if "use utf8;" is enough
Thank you very much in advance.
|
| |
|
5 Comments |
|
  |
Author: Andreas PürzerAndreas Pürzer
Date: Jan 15, 2008 08:29
Ben Morrow schrieb:
> Quoth David Smith hotmail.com>:
>>
>> I'm coming to Perl from a Java background... where you import classes
>>using a fully-qualified name, and then generally make use of it using
>>the base class name:
>>
>>import myapp.dataojects.User;
>>...
>>User myUser = new User();
>>
>> I've been emulating the same convention as far as organizing my Perl
>>modules in a directory structure based on functionality. However, I
>>find that when using them I have to always use the fully-qualified name:
>>
>>use MyApp::DataObjects::User;
>>...
>>my $myUser = MyApp::DataObjects::User->new();
>
> ...
|
| Show full article (1.58Kb) |
|
no comments
|
|
  |
Author: StuStu
Date: Jan 15, 2008 07:46
Can somebody provide me with a perl funcion that accepts
(full path of file, number of minutes, and operation) and checks the
last access time of a file.
For example, if I pass the following:
c:/temp/testfile 5 GT
The function will check the last access time of the file c:/temp/
testfile and see if it is greater than 5 minutes old.
If I pass c:/temp/testfile 6 LE
The function will check the last access time of the file c:/temp/
testfile and see if it is less than or equal to 6 minutes old.
If the anwer is yes I want to return 1 for TRUE else return 0 for
false.
Thanks in advance for all that answer this post
I
|
| |
|
5 Comments |
|
  |
|
|
  |
Author: bwooster47bwooster47
Date: Jan 15, 2008 07:30
I've narrowed down to a simple script a problem where it looks like
when running under mod_perl, it does not support changes to the
$ENV{PATH} variable - it does require the assignment to avoid the
tainting, but then any assignment itself does not take effect - I
added /usr/local/bin to PATH, but am unable to execute commands in
that folder when running under mod_perl.
Could not find anything about this in the mod_perl web pages, but a
Usenet search seems to suggest that mod_perl only honors PerlSetEnv
PATH in config, and does not honor PATH changes in the script? That
does not sound right, what about the cases where a PATH change is
needed for some scripts only, so a global PerlSetEnv would be too
much.
Example - for testing, I copied /bin/echo to /usr/local/bin/echo, and
then ran this script - it runs fine when run under the shell, but when
run under Apache + mod_perl, it fails.
Script:
#!/usr/bin/perl -Tw
print "Content-type: text/plain\n\n";
|
| Show full article (1.96Kb) |
|
1 Comment |
|
|
|
|
|
|