comp.lang.perl.misc
  Home FAQ Contact Sign in
Your Ad Here
comp.lang.perl.misc only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...


 Up
  Posting Guidelines for comp.lang.perl.misc ($Revision: 1.8 $)         


Author: tadmc
Date: May 12, 2008 23:11

Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information ...
Show full article (16.63Kb)
no comments
  FAQ 4.38 Why don't my <<HERE documents work?         


Author: PerlFAQ Server
Date: May 12, 2008 18:03

This is an excerpt from the latest version perlfaq4.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 .

--------------------------------------------------------------------

4.38: Why don't my <
Check for these three things:

There must be no space after the << part.
There (probably) should be a semicolon at the end.
You can't (easily) have any space in front of the tag.

If you want to indent the text in the here document, you can do this:

# all in one
($VAR = < your text
goes here
HERE_TARGET

But the HERE_TARGET must still be flush against the margin. If you want
that indented also, you'll have to quote in the indentation.
Show full article (3.68Kb)
no comments
  Windows XP escape \D error         


Author: grocery_stocker
Date: May 12, 2008 15:52

When I run the following...

#!/usr/bin/perl -w

open (PRODUCT,"C:\Documents and Settings\root\Desktop\wd\hp.mhtml") ||
die "Cant open: $!;

I get the following

Unrecognized escape \D passed through at ./parse.pl line 3.
Unrecognized escape \D passed through at ./parse.pl line 3.
Unrecognized escape \w passed through at ./parse.pl line 3.
Unrecognized escape \h passed through at ./parse.pl line 3.
Can't find string terminator '"' anywhere before EOF at ./parse.pl
line 3.

What escape characters is Windows complaining about and how do I fix
them?

Chad
4 Comments
  Detecting C compiler in Makefile.PL         


Author: Jens Thoms Toerring
Date: May 12, 2008 14:27

Hello,

a CPAN module of mine that needs a C compiler for installation
fails in some of the tests since the C compiler isn't found. The
offending lines are

if ( system $Config{cc}, qw( -o cc_test cc_test.c ) ) {
unlink 'cc_test.c';
die "Can't run C compiler '$Config{cc}'\n";
}

where 'cc_test.c' is a simple program that gets created
automatically just for this test.

The problem is that on one of the testers machines $Config{cc}
is set to 'ccache cc' and system() obviously does not like the
space in the name of the program it's supposed to execute.

Now I probably can get around that by using a line like

if ( system split /\s+/, $Config{cc}, qw( -o cc_test cc_test.c ) ) {
Show full article (1.00Kb)
2 Comments
  FAQ 4.47 How do I handle circular lists?         


Author: PerlFAQ Server
Date: May 12, 2008 12:03

This is an excerpt from the latest version perlfaq4.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 .

--------------------------------------------------------------------

4.47: How do I handle circular lists?

Circular lists could be handled in the traditional fashion with linked
lists, or you could just do something like this with an array:

unshift(@array, pop(@array)); # the last shall be first
push(@array, shift(@array)); # and vice versa

You can also use "Tie::Cycle":

use Tie::Cycle;

tie my $cycle, 'Tie::Cycle', [ qw( FFFFFF 000000 FFFF00 ) ];

print $cycle; # FFFFFF
print $cycle; # 000000
print $cycle; # FFFF00

--------------------------------------------------------------------
Show full article (1.53Kb)
5 Comments
  Device::ParallelPort input and output         


Author: Stu
Date: May 12, 2008 06:10

Hi, I've currently got a laptop running Ubuntu Server and Perl 5.8.8.
I've installed the Device::ParallelPort module and I have it working
fairly reliably with ouput. I can make it turn on an LED on some
breadboard, etc.

I am having problems with receiving input through the parallel port
though. I really need to react to something happening. I currently
have pin 12 (Paper-Out/Paper-End) connected to +5V through a switch.
When I press the switch the bit should be set.

Unfortunately I don't actually seem to get what I'm looking for at
all. I'm having no end of trouble finding any example code using this
module for anything but regular 8-pin output.

Has anyone got any tips, bookmarks, or information at all about using
this module for receiving input on the status pins?

Any help would be greatly appreciated.

Regards,
Stuart.
2 Comments
  FAQ 4.32 How do I strip blank space from the beginning/end of a string?         


Author: PerlFAQ Server
Date: May 12, 2008 06:03

This is an excerpt from the latest version perlfaq4.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 .

--------------------------------------------------------------------

4.32: How do I strip blank space from the beginning/end of a string?

(contributed by brian d foy)

A substitution can do this for you. For a single line, you want to
replace all the leading or trailing whitespace with nothing. You can do
that with a pair of substitutions.

s/^\s+//;
s/\s+$//;

You can also write that as a single substitution, although it turns out
the combined statement is slower than the separate ones. That might not
matter to you, though.

s/^\s+|\s+$//g;
Show full article (3.02Kb)
no comments
  Current Time with 5 digits of milliseconds         


Author: ambarish.mitra
Date: May 12, 2008 00:39

I need to get the current date-time with milliseconds upto 5 places of
precision.

That is, 20080512T12094565266 => YYYY MM DD T HH mm SS ms-5 digits

Here, 65266 is the milli-second with 5 places of precision.

I tried with the module DateTime, but that does not give the
milliseconds.

use DateTime;
my $dt = DateTime->now( time_zone => 'floating' );

Any idea how this can be achieved in Perl?

Thanks.
7 Comments
Your Ad Here
  FAQ 4.14 How can I compare two dates and find the difference?         


Author: PerlFAQ Server
Date: May 12, 2008 00:03

This is an excerpt from the latest version perlfaq4.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 .

--------------------------------------------------------------------

4.14: How can I compare two dates and find the difference?

(contributed by brian d foy)

You could just store all your dates as a number and then subtract. Life
isn't always that simple though. If you want to work with formatted
dates, the "Date::Manip", "Date::Calc", or "DateTime" modules can help
you.

--------------------------------------------------------------------
Show full article (1.30Kb)
9 Comments