comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
December 2007
motuwethfrsasuw
     12 48
3456789 49
10111213141516 50
17181920212223 51
24252627282930 52
31       1
2007
 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
  web automation         


Author: byte
Date: Dec 23, 2007 22:34

hi there,
can you tell how perl related tool

http://samie.sourceforge.net/

to enable driving IE actions?

as i know, perl is simplely a script tool

BY what way it call ie
3 Comments
  Re: pack a script and its modules in one file         


Author: John Bokma
Date: Dec 23, 2007 21:10

Larry wrote:
> Hi peeps,
>
> I was wondering is there were any way to pack a script and the
> modules it uses in a single perl script...I wonder how perl2exe
> accomplishes that!!!

Check out PAR (it almost feels like a FAQ)

2 Comments
  I'm thinking why those two modules are removed from CPAN         


Author: Fayland Lam
Date: Dec 23, 2007 19:29

any reason for Email-Obfuscate and WWW-GMail?

I'm using them in my daily life. hmm

now what I can do is to use HTML::Email::Obfuscate and
Mail::Webmail::Gmail

hmm, don't feel comfortable.
2 Comments
  FAQ 5.17 How can I open a file with a leading ">" or trailing blanks?         


Author: PerlFAQ Server
Date: Dec 23, 2007 18:03

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

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

5.17: How can I open a file with a leading ">" or trailing blanks?

(contributed by Brian McCauley)

The special two argument form of Perl's open() function ignores trailing
blanks in filenames and infers the mode from certain leading characters
(or a trailing "|"). In older versions of Perl this was the only version
of open() and so it is prevalent in old code and books.

Unless you have a particular reason to use the two argument form you
should use the three argument form of open() which does not treat any
charcters in the filename as special.

open FILE, "<", " file "; # filename is " file "
open FILE, ">", ">file"; # filename is ">file"

--------------------------------------------------------------------
Show full article (1.69Kb)
no comments
  FAQ 6.3 How can I pull out lines between two patterns that are themselves on different lines?         


Author: PerlFAQ Server
Date: Dec 23, 2007 12:03

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

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

6.3: How can I pull out lines between two patterns that are themselves on different lines?

You can use Perl's somewhat exotic ".." operator (documented in perlop):

perl -ne 'print if /START/ .. /END/' file1 file2 ...

If you wanted text and not lines, you would use

perl -0777 -ne 'print "$1\n" while /START(.*?)END/gs' file1 file2 ...

But if you want nested occurrences of "START" through "END", you'll run
up against the problem described in the question in this section on
matching balanced text.

Here's another example of using "..":
Show full article (1.81Kb)
no comments
  Win32::OLE ADO Table Field names         


Author: goldtech
Date: Dec 23, 2007 10:15

Hi,

Given code below, I can get tables and run SQL on an ms-access db -
this works well. But, I want to get the field names per each column
of a table. I'm sure there's an ADO way of doing it. Help appreciated.
Thanks.

Question: How do I get the field names of each column of a table?

#!/usr/bin/perl

# use strict;
use Win32::OLE();
$Win32::OLE::Warn=2;

my $conn = Win32::OLE->new("ADODB.Connection");
my $db = 'C:\Folder4\usa.mdb';
$conn->Open('Provider = Microsoft.Jet.OLEDB.4.0; Data Source='.$db);
my $rs= $conn->OpenSchema(20);
Show full article (0.88Kb)
1 Comment
  FAQ 5.38 Why do I get weird spaces when I print an array of lines?         


Author: PerlFAQ Server
Date: Dec 23, 2007 06:03

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

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

5.38: Why do I get weird spaces when I print an array of lines?

Saying

print "@lines\n";

joins together the elements of @lines with a space between them. If
@lines were "("little", "fluffy", "clouds")" then the above statement
would print

little fluffy clouds

but if each element of @lines was a line of text, ending a newline
character "("little\n", "fluffy\n", "clouds\n")" then it would print:

little
fluffy
clouds

If your array contains lines, just print them:
Show full article (1.57Kb)
no comments
  FAQ 5.37 How do I select a random line from a file?         


Author: PerlFAQ Server
Date: Dec 23, 2007 00:03

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

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

5.37: How do I select a random line from a file?

Here's an algorithm from the Camel Book:

srand;
rand($.) < 1 && ($line = $_) while <>;

This has a significant advantage in space over reading the whole file
in. You can find a proof of this method in *The Art of Computer
Programming*, Volume 2, Section 3.4.2, by Donald E. Knuth.

You can use the File::Random module which provides a function for that
algorithm:

use File::Random qw/random_line/;
my $line = random_line($filename);

Another way is to use the Tie::File module, which treats the entire file
as an array. Simply access a random array element.
Show full article (1.67Kb)
no comments