|
|
Up |
|
|
  |
Author: tadmctadmc
Date: Apr 14, 2008 23:18
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
|
|
  |
Author: Gordon EtlyGordon Etly
Date: Apr 14, 2008 20:37
Jim Cochrane wrote:
> On 2008-04-14, Chris Mattern sumire.gwu.edu> wrote:
>> On 2008-04-14, Jim Cochrane no-spam-allowed.org>
>> wrote:
>>>
>>> Actually, "I should of course said" is still wrong - missing a verb
>>> component - should be: "I should of course have said".
>>>
>> I think that sentence is also better for a little appropriate
>> punctuation: "I should, of course, have said". The commas also help
>> guide you to the correct verb choice, instead of getting confused as
>> to whether "of" is your verb.
>
> Yes, I thought of that after posting; thanks for the correction.
>
> (I better stop replying now before we get too far sidetracked from
> perl vs. Perl vs. PERL vs. pERL .......)
|
| Show full article (1.18Kb) |
|
| |
32 Comments |
|
  |
Author: TedTed
Date: Apr 14, 2008 19:10
I am trying to figure out how to use this package. It looks like it
may do what I need, and help me write the code more quickly than would
be the case if I started de novo.
First, although I have been programming in a variety of languages for
quite a while, i have managed to avoid having to parse XML until now.
I HATE parsing. I'd rather be implementing a new numeric integration
algorithm or method for some obscure but interesting statistical
analysis. But here I am and have to get this done.
The data feed I get appears to be well formed XML, but it is open
ended in that there is no defined schema. The only information I have
about what to expect in the XML is provided in the data feed
provider's documentation. The data structure appears to be very
simple, but working with it is tedious at best.
Is there a package or utility that can read an XML file of the sort I
get and create a schema based on what it sees in the data feed file?
In the page for DBIx::XML::DataLoader::MapIt, I see the following:
|
| Show full article (4.04Kb) |
|
4 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Apr 14, 2008 18:03
This is an excerpt from the latest version perlfaq9.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 .
--------------------------------------------------------------------
9.10: How do I decode or create those %%-encodings on the web?
If you are writing a CGI script, you should be using the CGI.pm module
that comes with perl, or some other equivalent module. The CGI module
automatically decodes queries for you, and provides an escape() function
to handle encoding.
The best source of detailed information on URI encoding is RFC 2396.
Basically, the following substitutions do it:
s/([^\w()'*~!.-])/sprintf '%%%%%%02x', ord $1/eg; # encode
s/%%([A-Fa-f\d]{2})/chr hex $1/eg; # decode
s/%%([[:xdigit:]]{2})/chr hex $1/eg; # same thing
|
| Show full article (2.05Kb) |
|
2 Comments |
|
  |
Author: Lore LeunoegLore Leunoeg
Date: Apr 14, 2008 16:06
Hello
I'd like to encapsulate each number in a textfile with dollar-signs ($). I
thougt to replace each number by a $-sign followed by the pattern matched
number itself and another $-sign.
How can I get the exact pattern which was replaced by
s/PATTERN/PREPLACEMENT/modifier?
In the perl docs I read that the p preserve modifier would save the replaced
pattern in a variable $<^MATCH>. But the p modifier isn't known by my perl
installation (vers5.8).
Does anybody know another way to solve the encapsulation problem? Or does
anyone can give me a hint why the p modifier isn't known?
Thank you
Sincerely
Lore
|
| |
|
4 Comments |
|
  |
Author: TravisTravis
Date: Apr 14, 2008 14:30
Hi there,
Never written a line of Perl until now but I think it might be perfect
for this little program I need.
I have some CSV files that are given to me and I need to spit them in
a format that kind of looks like XML but I don't think it is. The
structure looks something like this:
I don't think that's standard XML is it? If so please let me know so I
can change my google searching on the topic.
|
| Show full article (1.00Kb) |
|
6 Comments |
|
  |
Author: Ben MorrowBen Morrow
Date: Apr 14, 2008 13:49
> I'm trying to use CSV_XS to parse log files.
> Each field is separated by a comma and surround by double quotes.
>
> Within each field, there may be embdedded double and single quotes.
> These embedded quotes are escaped by a backslash.
>
> I'm having trouble getting it to work. I have two questions:
>
> 1) The entire script fails at the first line it can't parse. How can
> I make it ignore the current line and continue?
> I'm using getline() to read the file, like this:
>
> open my $io, "<", $logname or warn("Cannot open file ${logname} for
> reading. $!");
You want to die at this point, not warn. There's no point continuing if
the open failed: $io is undef, and the rest of the program will just
give unhelpful errors.
|
| Show full article (1.67Kb) |
|
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: Apr 14, 2008 12:03
This is an excerpt from the latest version perlfaq9.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 .
--------------------------------------------------------------------
9.7: How do I make an HTML pop-up menu with Perl?
(contributed by brian d foy)
The CGI.pm module (which comes with Perl) has functions to create the
HTML form widgets. See the CGI.pm documentation for more examples.
use CGI qw/:standard/;
print header,
start_html('Favorite Animals'),
|
| Show full article (1.66Kb) |
|
no comments
|
|
  |
Author: spydoxspydox
Date: Apr 14, 2008 10:08
I'm trying to find a repeated number in a string, like 122345 finds
22.
This works:
/(\d)\1/
This doesn't:
/\1(\d)/
I guess LLR parsing is to blame, but shouldn't the second example
first try to FIND a $1 then check to see if there is a \1, and repeat
that process moving L to R?
I though Perl sort of went to and fro trying to do matching. To me,
there IS a /\1(\d)/ in the string since $1 is 2, and there is a \1 = 2
preceeding it.
I was a little surprized this didn't work although I can sort of see
why in a way too. In some ways it seems to me that regexes should be
*disconnected* from parsing - just answer the question does this
match?
|
| |
|
15 Comments |
|
  |
|
|
  |
Author: sledzsledz
Date: Apr 14, 2008 06:24
I'm writing an perl script which should communicate over a serial
port. The script should be able to run in Linux and Win32
environments. In both environments exist modules to access the serial
port:
Win32::SerialPort (under Windows)
Device::SerialPort (else)
I know it is possible to detect the OS using Config::Config. But it
seems not possible to use different modules depending on this
information like this:
if ( $OS eq 'WINDOWS' ) {
use Win32::SerialPort qw( :PARAM :STAT );
} else {
use Device::SerialPort qw( :PARAM :STAT );
}
What's the right way to write such an OS dependent application?
Steffen
PS: Fup to comp.lang.perl.modules
|
| |
|
1 Comment |
|
|
|
|
|
|