[23422] in Perl-Users-Digest
Perl-Users Digest, Issue: 5639 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 9 14:06:46 2003
Date: Thu, 9 Oct 2003 11:05:08 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 9 Oct 2003 Volume: 10 Number: 5639
Today's topics:
Re: converting file to excel problem <mikeflan@earthlink.net>
Re: converting file to excel problem <mikeflan@earthlink.net>
CPAN seems to be broken on my system <nospam@nospam.org>
Re: CPAN seems to be broken on my system <jwillmore@remove.adelphia.net>
Re: CPAN seems to be broken on my system <nospam@nospam.org>
Re: Debug Messages <konny@waitrose.com>
Re: File::Copy Adds a ? (Sylvie Stone)
Re: Forking in Window enviroment <Graham.T.Wood@oracle.com>
Re: How To activate command line history in debugger? (Peter Scott)
Re: How to get locally configured IP addresses <ama@PW.CA>
Re: How to get locally configured IP addresses <jwillmore@remove.adelphia.net>
Re: Newbie "undefined value" <mikeflan@earthlink.net>
Newbie trying to access local repository with ppm on wi (Piet)
Re: Newbie trying to access local repository with ppm o <kuujinbo@hotmail.com>
News Test angelina@erotismo.es
Perl Examples <kristoffhahns@*NOSPAM*lycos.net>
Re: Question about comparing Remote image with Local on (Anno Siegel)
Re: regex to get OS from combined log <vervoom@hotmail.com>
Re: regex to get OS from combined log (Anno Siegel)
Re: regex to get OS from combined log <glex_nospam@qwest.net>
Re: Rookie: HTML::TableExtract test will not print <sdfg@sdg.com>
Re: rotate items in log file <robertw@nospam.acm.org>
Re: rotate items in log file (Tad McClellan)
Re: Search-replace in multiple files? <no-email@home.se>
Re: Search-replace in multiple files? (Tad McClellan)
Re: Switch and function prototypes (Anno Siegel)
Re: Teach me how to fish, regexp <HelgiBriem_1@hotmail.com>
Re: Teach me how to fish, regexp (Roy Johnson)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Oct 2003 16:13:10 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: converting file to excel problem
Message-Id: <3F8589BD.5BF456F2@earthlink.net>
Shawn wrote:
> Hi,
>
> We are using the below script to convert a file into excel format. The
> problem is that my file contains ssn in which they can start with zero.
> Well, when it gets converted to excel it drops the leading zero. I need
> that leading zero and am not sure how to modify this script to keep the
> zero.
>
> Any asistance would be greatly appreciated!
>
> Shawn
>
> --
>
> #!/opt/bin/perl5.6 -w
> ############################################################################
> ###
> # Example of how to use the WriteExcel module
> # Program to convert a text [delim] separated value file into an Excel file.
> # Usage: txt2xls.pl file.txt newfile.xls
>
> use Getopt::Long;
> use Spreadsheet::WriteExcel::Big;
>
> GetOptions ("d=s" => \$delim);
> $delim = "|" if !defined($delim);
> $delim =~ s/\|/\\|/g;
>
> # Check for valid number of arguments
> if (($#ARGV < 1) || ($#ARGV > 2)) {
> die("Usage: txt2xls file.txt newfile.xls\n");
> };
>
> # Open the Comma Seperated Variable file
> open (TXTFILE, $ARGV[0]) or die "$ARGV[0]: $!";
>
> # Create a new Excel workbook
> my $workbook = Spreadsheet::WriteExcel::Big->new($ARGV[1]);
> my $worksheet = $workbook->add_worksheet();
>
> # Row and column are zero indexed
> my $row = 0;
>
> while (<TXTFILE>) {
> chomp;
> @cols = split(/\s*${delim}\s*/,$_);
>
> $col = 0;
> foreach my $token (@cols) {
> $worksheet->write($row, $col, $token);
> $col++;
> }
> $row++;
> }
I'm trying to get this script to work. I can't find the
Spreadsheet::WriteExcel::Big module. I can find
Spreadsheet::WriteExcel::Simple and am trying to
get that to work right now.
I can find the Spreadsheet::WriteExcel::Big
module in google:
http://search.cpan.org/dist/Spreadsheet-WriteExcel/
and wonder why ActiveState does not list it.
I'll probably figure it out, but am open to any
suggestions anybody might have.
I'm using the latest Perl on Win2000.
Mike Flannigan
mikeflan@earthlink.net
------------------------------
Date: Thu, 09 Oct 2003 17:39:31 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: converting file to excel problem
Message-Id: <3F859DFE.F8DCD40A@earthlink.net>
Mike Flannigan wrote:
> I'm trying to get this script to work. I can't find the
> Spreadsheet::WriteExcel::Big module. I can find
> Spreadsheet::WriteExcel::Simple and am trying to
> get that to work right now.
>
> I can find the Spreadsheet::WriteExcel::Big
> module in google:
> http://search.cpan.org/dist/Spreadsheet-WriteExcel/
> and wonder why ActiveState does not list it.
>
> I'll probably figure it out, but am open to any
> suggestions anybody might have.
>
> I'm using the latest Perl on Win2000.
>
> Mike Flannigan
> mikeflan@earthlink.net
Never mind. I got it to work by installing the base
Spreadsheet::WriteExcel module along with the
OLE::Storage_Lite module.
Mike
------------------------------
Date: Thu, 9 Oct 2003 09:44:40 -0400
From: "Christian Caron" <nospam@nospam.org>
Subject: CPAN seems to be broken on my system
Message-Id: <bm3oo8$hl825@nrn2.NRCan.gc.ca>
Hi all,
when I tried to upgrade CGI.pm (perl -MCPAN -e 'install CGI'), I got the
following:
===================================
We have to reconfigure CPAN.pm due to following uninitialized parameters:
cpan_home, keep_source_where, build_dir, build_cache, scan_cache,
index_expire,
gzip, tar, unzip, make, pager, makepl_arg, make_arg, make_install_arg,
urllist,
inhibit_startup_message, ftp_proxy, http_proxy, no_proxy,
prerequisites_policy
/usr/perl5/5.00503/CPAN/Config.pm initialized.
CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.
If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)
Are you ready for manual configuration? [yes]
The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.
I see you already have a directory
/.cpan
Shall we use it as the general CPAN build and cache directory?
CPAN build and cache directory? [/.cpan]
If you want, I can keep the source files after a build in the cpan
home directory. If you choose so then future builds will take the
files from there. If you don't want to keep them, answer 0 to the
next question.
How big should the disk cache be for keeping the build directories
with all the intermediate files?
Cache size for build directory (in MB)? [10]
By default, each time the CPAN module is started, cache scanning
is performed to keep the cache size in sync. To prevent from this,
disable the cache scanning with 'never'.
Perform cache scanning (atstart or never)? [atstart]
The CPAN module can detect when a module that which you are trying to
build depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.
Policy on building prerequisites (follow, ask or ignore)? [follow]
The CPAN module will need a few external programs to work
properly. Please correct me, if I guess the wrong path for a program.
Don't panic if you do not have some of them, just press ENTER for
those.
Where is your gzip program? [/usr/bin/gzip]
Where is your tar program? [/usr/sbin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/ccs/bin/make]
Warning: lynx not found in PATH
Where is your lynx program? []
Where is your ncftpget program? [/usr/local/bin/ncftpget]
Where is your ftp program? [/usr/bin/ftp]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/sbin/sh]
Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in processes. If you have any parameters
(e.g. PREFIX, INSTALLPRIVLIB, UNINST or the like) you want to pass to
the calls, please specify them here.
If you don't understand this question, just press ENTER.
Parameters for the 'perl Makefile.PL' command? []
Parameters for the 'make' command? []
Parameters for the 'make install' command? []
Sometimes you may wish to leave the processes run by CPAN alone
without caring about them. As sometimes the Makefile.PL contains
question you're expected to answer, you can set a timer that will
kill a 'perl Makefile.PL' process after the specified time in seconds.
If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.
Timeout for inactivity during Makefile.PL? [0]
If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.
Your ftp_proxy?
Your http_proxy?
Your no_proxy?
Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.
First, pick a nearby continent and country (you can pick several of
each, separated by spaces, or none if you just want to keep your
existing selections). Then, you will be presented with a list of URLs
of CPAN mirrors in the countries you selected, along with previously
selected URLs. Select some of those URLs, or just keep the old list.
Finally, you will be prompted for any extra URLs -- file:, ftp:, or
http: -- that host a CPAN mirror.
Select your continent (or several nearby continents) []
===================================
There is no choices here, so I can't continue... How do I reset this thing?
Thanks!
PS: CPAN FAQ and Google search returned no results...
Christian
------------------------------
Date: Thu, 09 Oct 2003 17:22:02 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: CPAN seems to be broken on my system
Message-Id: <20031009132216.24800f58.jwillmore@remove.adelphia.net>
On Thu, 9 Oct 2003 09:44:40 -0400
"Christian Caron" <nospam@nospam.org> wrote:
> Hi all,
>
> when I tried to upgrade CGI.pm (perl -MCPAN -e 'install CGI'), I got
> the following:
<snip>
perl -MCPAN -eshell
This will invoke the CPAN shell. You can then configure CPAN. To
change options, type 'o conf <option>' from within the CPAN shell. To
list the options, type 'o conf' in the CPAN shell. Last, but not
least, type 'perldoc CPAN' at the command line to get the
documentation for CPAN -or- go to http://search.cpan.org and search
for CPAN. This will give you the documentation for CPAN and other
modules, as well as allow you to download and install manually modules
from CPAN.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Democracy is good. I say this because other systems are worse.
-- Jawaharlal Nehru
------------------------------
Date: Thu, 9 Oct 2003 13:38:59 -0400
From: "Christian Caron" <nospam@nospam.org>
Subject: Re: CPAN seems to be broken on my system
Message-Id: <bm46fj$hl934@nrn2.NRCan.gc.ca>
"James Willmore" <jwillmore@remove.adelphia.net> wrote in message
news:20031009132216.24800f58.jwillmore@remove.adelphia.net...
> On Thu, 9 Oct 2003 09:44:40 -0400
> "Christian Caron" <nospam@nospam.org> wrote:
>
> > Hi all,
> >
> > when I tried to upgrade CGI.pm (perl -MCPAN -e 'install CGI'), I got
> > the following:
> <snip>
>
> perl -MCPAN -eshell
>
> This will invoke the CPAN shell. You can then configure CPAN. To
Ok, I forgot to say "perl -MCPAN -eshell" is giving me the same results.
Seems like CPAN is complaining about some misconfiguration and because of
that, it asks to be configured again (everytime I invoke it). But when I do
try to configure it, I get the question where I can't input an answer
(continent). Chicken and egg. That's why I was wondering if there is a
possibility to remove and reinstall CPAN from scratch.
Thanks!
Christian
------------------------------
Date: Thu, 09 Oct 2003 16:47:59 +0100
From: Mr I <konny@waitrose.com>
Subject: Re: Debug Messages
Message-Id: <gkcg51-v39.ln1@sam.amaretti.net>
Anno Siegel wrote:
> Kasp <kaspREMOVE_CAPS@epatra.com> wrote in comp.lang.perl.misc:
>
>>"Abigail" <abigail@abigail.nl> wrote in message
>>news:slrnbnipqq.e7b.abigail@alexandra.abigail.nl...
>>
>>
>>>Given that you already know how to get command line arguments,
>>>what exactly is your question? Surely your "dumb clients" can
>>>type '--debug' as a parameter?
What I believe you're *REALLY* asking is whether Perl has a builtin /
generic VERBOSE mode, so without adding any extra code [i.e. if(DEBUG)
statements] the variable + environment + state settings are some how
printed to STDOUT while the program executes.
I 4 one have always thought this would be an ideal feature of Perl. Say
for example you could all your code like below:
perl --DeBuG -L1 ./perlcode.pl <ARGV>
Perl would then run the code displaying all the variable /environment
etc changes as the program is executed. The -L1 defines the depth of sub
routines /modules / functions it should print out this information for
(otherwise the output could be unreadable especailly with nested sub
routinues).
But I think we (if you agree with me) are in the minority :)
Oh b4 I forget. To the best of my knowledge Perl DOES NOT provide this
functionality and I've yet to find a tool that does this (perl -d does
not meet the requirement. great for me, not so great for non perl user).
K
------------------------------
Date: 9 Oct 2003 04:47:40 -0700
From: sylviestone@canada.com (Sylvie Stone)
Subject: Re: File::Copy Adds a ?
Message-Id: <181a24a8.0310090347.13fdcde9@posting.google.com>
Glenn Jackman <xx087@freenet.carleton.ca> wrote in message news:<slrnbo8kdk.jb8.xx087@smeagol.ncf.ca>...
> Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> wrote:
> > Sylvie Stone (sylviestone@canada.com) wrote:
> >
> > The date command may be able to output the format you want without using
> > awk.
> >
> > $ date '+%b%Y'
> > Oct2003
>
> Or don't use date at all:
> use POSIX qw(strftime);
> $month = strftime "%b%Y", localtime;
>
> > : #!/usr/bin/perl
> > : $month=`/bin/date | awk '{print \$2\$6}'`;
> [...]
> > Perhaps it isn't a `?', I will guess the ? is a place holder to indicate a
> > control character in the name, such as a new-line from the end of the awk
> > output.
>
> Indeed:
> $month=`/bin/date | awk '{print \$2\$6}'`;
> $len = length $month;
> print "'$month' is $len characters long\n";
Thank you all for the reply's. I ended up using the POSIX commend and
it's works great. Thanks -
Syl.
------------------------------
Date: Thu, 09 Oct 2003 17:55:49 +0100
From: Graham Wood <Graham.T.Wood@oracle.com>
Subject: Re: Forking in Window enviroment
Message-Id: <3F859315.C5EBC02D@oracle.com>
You could try using Win32::Process in place of fork. This will mean
that it won't run on Unix any more but if you are running on Win2K, this
is a good way of launching child processes and watching what they do.
See
http://aspn.activestate.com/ASPN/CodeDoc/libwin32/Process/Process.html
or perldoc Win32::Process for details.
I see another module called Win32::ProcFarm on Activestates web site
too. This may be a new improved version of Win32::Process.
Hope this helps.
Graham
------------------------------
Date: Thu, 09 Oct 2003 14:34:28 GMT
From: peter@PSDT.com (Peter Scott)
Subject: Re: How To activate command line history in debugger?
Message-Id: <Ulehb.54119$6C4.25968@pd7tw1no>
In article <3F84F4EA.7000607@ica-intercom-akademie.de>,
Kurt Kronschnabl <kurt.kronschnabl-nospam@ica-intercom-akademie.de> writes:
>Peter Scott wrote:
>> Install Term::ReadKey as root with
>>
>> perl -MCPAN -e shell
>> CPAN> install Term::ReadKey
>> CPAN> q
>>
>> and email me if that doesn't fix the problem.
>>
>ok, here my reply from 10/01/03 once again:
>
>Hello Peter.
>
>As already told, there is no "ReadKey.pm" in a Knoppix and Suse 8.2
>installation. ReadLine is available in both distries. But only under
>Suse it works. [snip]
Please read what I wrote. I know Term::ReadKey isn't on your system.
I told you how to install it. Install it.
--
Peter Scott
http://www.perldebugged.com
------------------------------
Date: Thu, 9 Oct 2003 09:24:17 -0400
From: "A. Ma" <ama@PW.CA>
Subject: Re: How to get locally configured IP addresses
Message-Id: <bm3nin$s1v4@shark.pwgsc.gc.ca>
Obviously, I needed to get the list of locally configured IP addresses from
a Perl script. I didn't want to do system 'ifconfig' because it is not
portable. It does not work in Windows.
Anyway, if anyone is interested, I found the answer myself. There is a
module from ActiveState called Net::Ifconfig::Wrapper. I tried it yesterday
and it works for both Unix and Windows.
A.Ma
"James Willmore" <jwillmore@cyberia.com> wrote in message
news:e0160815.0310081518.5507e22f@posting.google.com...
> "A. Ma" <ama@PW.CA> wrote in message
news:<bm1bt3$dhh21@shark.pwgsc.gc.ca>...
> > Does anyone know how to find out what IP addresses are configured
locally?
> > Thanks.
> >
> > A.Ma
>
> In Perl? Using a system command? What?
>
> What methods have you tried? Did you search for the answer to your
> question? If so, where?
>
> You may far better posting this _exact_ question to another group -or-
> rephrase the question into one that this group deals with.
>
> Jim
------------------------------
Date: Thu, 09 Oct 2003 17:15:19 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: How to get locally configured IP addresses
Message-Id: <20031009131533.10c65bb4.jwillmore@remove.adelphia.net>
On Thu, 9 Oct 2003 09:24:17 -0400
"A. Ma" <ama@PW.CA> wrote:
> Obviously, I needed to get the list of locally configured IP
> addresses from a Perl script. I didn't want to do system 'ifconfig'
> because it is not portable. It does not work in Windows.
>
> Anyway, if anyone is interested, I found the answer myself. There is
> a module from ActiveState called Net::Ifconfig::Wrapper. I tried it
> yesterday and it works for both Unix and Windows.
>
> A.Ma
< snip - DON'T top post - it's rude:-) >
No, it was _not_ obvious. Otherwise, you would have gotten better
responses :-)
More importantly, if you had done the leg work _before_ posting, you
would not have had to post at all :-)
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Washington [D.C.] is a city of Southern efficiency and Northern
charm. -- John F. Kennedy
------------------------------
Date: Thu, 09 Oct 2003 15:25:47 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: Newbie "undefined value"
Message-Id: <3F857EA6.708BFC04@earthlink.net>
Nadine wrote:
> Hello,
>
> I get a "cannot use undefined value as symbol ref at line 45." I have
> used strict and -w. I am using CARP. From the command line, my syntax
> checks out as OK. From that same command line, if I pass in parameters,
> then I get the "undefined value." I thought "strict" would catch all
> undefined variables. I am using Perl 5 and Apache.
>
> I had a short script that printed to the browser. Now I am changing it
> to print to a file and using parts of Stein's guestbook script. Here is
> the resulting script.
>
> #!/usr/bin/perl -w
> use strict;
> use warnings;
> use CGI qw(:standard Carp qw(fatalsToBrowser)); # import shortcuts
> use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB
>
> my(
> $DATAFILE,
> $fh, # File Handle
> $TIMEOUT,
> $path_name,
> $path,
> $description,
> $lock_type,
> );
>
> # give path and name of data file
> $DATAFILE="Eval.dat";
>
> my $cgi = CGI->new();
> my $value = $cgi->param( 'keyword' ) || '';
>
> sub write_datafile {
> my $fh = filelock($DATAFILE,1);
> unless ($fh) {
> print strong('Sorry, an error occurred: unable to open file.'),p();
> Delete('action');
> print a({-href=>self_url},'Try again');
> return undef;
> }
> }
>
> # List field names in order.
> foreach my $item ( qw(orgclass relevance majorReq course) ) {
> my $value = $cgi->param( $item ) || 0;
> print $fh "$value . |\n";
> }
>
> # Generate web page saying thank you
>
> print $cgi->header,
> $cgi->start_html('Thank You'),
> $cgi->h2('Thank You'),
> $cgi->p("Thank you for your feedback."),
> $cgi->p("Return to ", a({-href=>'http://www-rohan.sdsu.edu/~ssrllab/'},
> "SSRL Lab home page")),
> $cgi->hr({-width=>"100%"}),
> $cgi->end_html;
>
> unlock($fh);
> 1;
>
> sub filelock {
> my $path = shift;
> my $for_writing = shift;
>
> my ($lock_type,$path_name,$description);
>
> $lock_type = LOCK_EX;
> $path_name = ">>$path";
> $description = 'writing';
> }
>
> local($main::msg,$main::oldsig);
> my $handler = sub { $main::msg='timed out';
> $SIG{ALRM}=$main::oldsig; };
> ($main::oldsig,$SIG{ALRM}) = ($SIG{ALRM},$handler);
> alarm($TIMEOUT);
>
> open ($fh,$path_name) or
> warn("Couldn't open $path for $description: $!"), return undef;
>
> # now try to lock it
> unless (flock ($fh,$lock_type)) {
> warn("Couldn't get lock for $description (" . ($main::msg ||
> "$!") . ")");
> alarm(0);
> close $fh;
> return undef;
> }
>
> alarm(0);
> return $fh;
>
> sub unlock {
> my $fh = shift;
> flock($fh,LOCK_UN);
> close $fh;
> }
Wow, that's some pretty advanced code for a Newbie.
I guess everything is relative.
Mike
------------------------------
Date: 9 Oct 2003 04:15:32 -0700
From: pit.grinja@gmx.de (Piet)
Subject: Newbie trying to access local repository with ppm on win2k
Message-Id: <39cbe663.0310090315.7d45a6f7@posting.google.com>
Hi there.
I have a problem with the ppm. THe ppm itself is working fine, but
aspparently I cannot access a local repository. ppm has two
repositories predefined on startup which both access the internet.
When I use the search command while connected to the net, everything
is fine, though the number of returned modules is quite large.
I have thus created a subdirectory ""rep" in my perl installation
"c:\programme\perl580" and defined a local repository via "rep add
Local c:\programme\perl580\rep". I copied some perl modules in form of
their *.tar and *.gz files in this directory, deactivated the
predefined repositories and performed a complete search via "search *"
but the ppm just returned "No matches for “*“; see “help search“."
I tried slashes instead of backslashes and adding (back)slashes at the
end of the pathname, but nothing worked. The repository itself seems
to be ok; when I rename the directory "rep" to "repo" I get the
expected error message"Error: No valid repositories: Error: Can't
initialize repository at 'c:/programme/perl580/rep/': No such file or
directory". So the problem seems to be that the modules are not
recognized. What is wrong or missing?
I would really like to keep my perl installation clean and working...
please help!
Piet
------------------------------
Date: Thu, 09 Oct 2003 21:18:50 +0900
From: ko <kuujinbo@hotmail.com>
Subject: Re: Newbie trying to access local repository with ppm on win2k
Message-Id: <bm3jr7$10g$1@pin3.tky.plala.or.jp>
Piet wrote:
> Hi there.
> I have a problem with the ppm. THe ppm itself is working fine, but
> aspparently I cannot access a local repository. ppm has two
> repositories predefined on startup which both access the internet.
> When I use the search command while connected to the net, everything
> is fine, though the number of returned modules is quite large.
> I have thus created a subdirectory ""rep" in my perl installation
> "c:\programme\perl580" and defined a local repository via "rep add
> Local c:\programme\perl580\rep". I copied some perl modules in form of
> their *.tar and *.gz files in this directory, deactivated the
> predefined repositories and performed a complete search via "search *"
> but the ppm just returned "No matches for “*“; see “help search“."
> I tried slashes instead of backslashes and adding (back)slashes at the
> end of the pathname, but nothing worked. The repository itself seems
> to be ok; when I rename the directory "rep" to "repo" I get the
> expected error message"Error: No valid repositories: Error: Can't
> initialize repository at 'c:/programme/perl580/rep/': No such file or
> directory". So the problem seems to be that the modules are not
> recognized. What is wrong or missing?
> I would really like to keep my perl installation clean and working...
> please help!
> Piet
1. Extract the files.
2. Try moving extracted the files/directories *themselves* in your
c:\programme\perl580 directory, if they aren't already there.
3. I've had problems using 'rep rename ...' too. You could try deleting
the local repository you created, and then starting over.
4. Read the docs => ActivePerl Components => PPM
'ppm install PATH2/MOD_NAME.ppd' will also allow you to install locally.
(use the absolute path to where the *.ppd file is located)
HTH - keith
------------------------------
Date: Thu, 9 Oct 2003 13:02:27 +0000 (UTC)
From: angelina@erotismo.es
Subject: News Test
Message-Id: <bm3m93$6hr$1@localhost.localdomain>
Testeo of the News
--
Angelina
Mi Photo Gallery
http://erotismo.dnsq.org
------------------------------
Date: Thu, 09 Oct 2003 10:52:26 -0700
From: Kristoff <kristoffhahns@*NOSPAM*lycos.net>
Subject: Perl Examples
Message-Id: <Kfhhb.63130$Ms2.14327@fed1read03>
Hi,
I'm learning Perl and CGI with the book Visual Quickstart Guide by
Elizabeth Castro. The problem is that I have the first edition book,
while Castro only has Perl and CGI example files for her second edition
book (available from her web site). Does anybody out there happen to
still have the Perl and CGI examples from Castro's first book??
I've emailed Castro, but have not received a response, as of yet.
Kristoff
------------------------------
Date: 9 Oct 2003 12:00:25 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Question about comparing Remote image with Local one
Message-Id: <bm3ikp$6a4$2@mamenchi.zrz.TU-Berlin.DE>
Vijoy Varghese <viijv@thedifferenZ.com> wrote in comp.lang.perl.misc:
> Hello Group,
>
> My final goal is to show a green/red gif image on my webpage when I am
> available on yahoo chat. Yes for this I could have used the url
> provided by yahoo
> http://opi.yahoo.com/online?u=xxxx&m=g&t=2, where xxxx is my yahoo
> userid. But the images yahoo print wont match with my webpage's
> colors. So I want to display a custom one. Now I know some Perl and I
> decided to give it a try.
>
> I used the LWP module to get the image (either online image/ offline
> image) from yahoo.
[snip irrelevant code]
> Now, I have the image from yahoo through my script. Now what I want is
> to see if the image is that of 'online_status' or 'offline_status'.
> And according to that, display my custom 'online/offline' image.
>
> For this, what I can do is to get the two images from yahoo, when my
> id is offline and when my id is online and save it.
> Then when ever the script is called, compare the real_time image from
> yahoo to the ones saved and take the decision.
>
> Now, my question is, Which is the best way to compare the remote image
> with the one I have on my server?
This sounds like a rather strange plan.
Use MD5 checksums to compare the files, don't compare the whole content.
See Digest::MD5 for how to.
Anno
------------------------------
Date: Fri, 10 Oct 2003 11:53:26 +0100
From: JS <vervoom@hotmail.com>
Subject: Re: regex to get OS from combined log
Message-Id: <bm3eog$ru8$1@cspc1n11.baplc.com>
JS wrote:
> Hi,
>
> I have the following regex to pull the IP address and Operating System
> from a log in combined logformat:
>
> if (/^(\d*.\d*.\d*.\d*).*\((.*;.*;.*)\)"/){
> $ip=$1;
> ($j1,$j2,$os,$j3)=split /;/,$2;
> $os=~s/^\s//;
>
>
> For the most part this works, but every now and again I get an OS with
> characters on the end of it e.g Windows NT 5.1)" "CTG=1065689351
>
> Can anyone help me fix the regex above please? Here's a an example lines
> from the log just to show how difficult this is:
>
> 12.110.129.108 - u768912 [07/Oct/2003:00:02:07 +0000] "GET
> http://www.anpe.fr/offres/unitary/menu_cand_offre.jsp;jse
> ssionid=1B0v5E29JcsNTVJlJPuDyvAP3E4O8zs1aeCZAVqvtCp8CCxYcZCk!1647636474!-1062731341!10000!7002
> HTTP/1.1" 200 1733 "h
> ttp://www.anpe.fr/offres/index.html?option=1&zone=64D&submit=1"
> "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
> .NET CLR 1.0.3705)"
>
> 166.2.123.85 - u617856 [07/Oct/2003:00:04:30 +0000] "GET
> http://www.toptable.co.uk/images/restaurant/small/1389.jpg
> HTTP/1.1" 200 1926
> "http://www.toptable.co.uk/details.cfm?bf=172,1296,1361,394,1472,1284,40,1389,1322,1229,829,941,1
>
> 163,1387,785,1295,701,1092&&bfh=133" "Mozilla/4.0 (compatible; MSIE
> 6.0; Windows NT 5.1; .NET CLR 1.0.3705)" "CFI
> D=1218747;CFTOKEN=ca5a76%2Dbfd444bd%2Db2d4%2D4b80%2Da588%2Df24fdd8e1484"
>
> 13.59.16.245 - - [07/Oct/2003:00:08:57 +0000] "OPTIONS
> http://161.2.67.76/ HTTP/1.0" 504 1548 "-" "Microsoft-WebDAV-
> MiniRedir/5.1.2600"
>
> 12.32.34.43 - - [07/Oct/2003:00:10:41 +0000] "GET
> http://www.nyc.com/web/website.nsf/Images/$file/header.gif HTTP/1.1" 200
> 1023 "http://www.nyc.com/web/website.nsf" "Mozilla/4.0 (compatible; MSIE
> 5.01; Windows 95)"
>
> Thanks for any help.
>
> JS.
>
Can I rephrase the question please! Could someone show me a better way
to get the OS out of the User-Agent please?:
Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
Microsoft-WebDAV-MiniRedir/5.1.2600
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)
Mozilla/4.08 [en] (WinNT; U ;Nav)
Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)
Thanks,
JS.
------------------------------
Date: 9 Oct 2003 11:49:02 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: regex to get OS from combined log
Message-Id: <bm3hve$6a4$1@mamenchi.zrz.TU-Berlin.DE>
JS <vervoom@hotmail.com> wrote in comp.lang.perl.misc:
[...]
> Can I rephrase the question please! Could someone show me a better way
> to get the OS out of the User-Agent please?:
>
> Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)
> Mozilla/4.0 (compatible; MSIE 5.01; Windows NT)
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
> Microsoft-WebDAV-MiniRedir/5.1.2600
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
> Mozilla/4.0 (compatible; MSIE 5.5; Windows 95)
> Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)
> Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)
> Mozilla/4.08 [en] (WinNT; U ;Nav)
> Mozilla/4.0 (compatible; MSIE 5.01; Windows 95)
Before one can think of a method, there would have to be a way to
identify the OS name. There doesn't seem to be much rhyme or reason
in the samples above (even ignoring the line beginning "Microsoft-Web...".
Neither is it always the third semicolon-separated item in (), nor is
it always the last one.
The only way I see is to have a collection of patterns that match
possible OS names (like /^Windows/, /^WinNT/, ...). Split the part
in parens on /;\s*/ and see if one matches. Resort to guessing if
none of the expected OS names is found. Mark the guesses as such, so
you can update the pattern collection if something new appears.
Anno
------------------------------
Date: Thu, 09 Oct 2003 10:32:44 -0500
From: "J. Gleixner" <glex_nospam@qwest.net>
Subject: Re: regex to get OS from combined log
Message-Id: <R9fhb.16$Pe5.14483@news.uswest.net>
> Can I rephrase the question please! Could someone show me a better way
> to get the OS out of the User-Agent please?:
If you're using Apache, possibly
http://search.cpan.org/~akira/Apache-ParseLog-1.02/ParseLog.pm
may help.
------------------------------
Date: Thu, 09 Oct 2003 15:31:03 GMT
From: "sdfgsd" <sdfg@sdg.com>
Subject: Re: Rookie: HTML::TableExtract test will not print
Message-Id: <Xafhb.74446$Of2.3085008@twister.tampabay.rr.com>
"Sam Holden" <sholden@flexal.cs.usyd.edu.au> wrote in message
news:slrnbo9lge.ia9.sholden@flexal.cs.usyd.edu.au...
> On Thu, 09 Oct 2003 02:00:33 GMT, sdfgsd <sdfg@sdg.com> wrote:
> >
> > Thanks! This worked. If it's not too much trouble, could you give me a
> > sentence or two on this construct:
> >==> {local $/;$target=<IN>}
> > I know this'll send me scrambling to the books.
>
> Slurps the entire file into $target.
>
> See "perldoc perlvar" and the section on $/ for information on why.
>
> The block and local are used to limit the effect of the
> change to $/ (it is set to undef by the local) to just the
> read into $target.
Well put. This would have taken me a long time to internalize. Thank you.
------------------------------
Date: Thu, 09 Oct 2003 09:49:17 -0400
From: Robert Wallace <robertw@nospam.acm.org>
Subject: Re: rotate items in log file
Message-Id: <3F85675D.83D82CFC@nospam.acm.org>
Tad McClellan wrote:
>
> Robert Wallace <robertw@nospam.acm.org> wrote:
> > Tad McClellan wrote:
>
> >> Is logging going on while
> >> you are rotating the log?
yes, it's possible.
I guess that's also my answer.
>
> > you think it'll be a problem without locking?
>
> If you answer my question, then I will answer your question.
>
> (the reason for asking the question was to determine whether
> there might be a problem. But you did not answer it, so I
> don't know if it will be a problem or not...
> )
>
------------------------------
Date: Thu, 9 Oct 2003 08:58:38 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: rotate items in log file
Message-Id: <slrnboaqce.2qb.tadmc@magna.augustmail.com>
Robert Wallace <robertw@nospam.acm.org> wrote:
> Tad McClellan wrote:
>> Robert Wallace <robertw@nospam.acm.org> wrote:
>> > Tad McClellan wrote:
>>
>> >> Is logging going on while
>> >> you are rotating the log?
>
> yes, it's possible.
> I guess that's also my answer.
>
>>
>> > you think it'll be a problem without locking?
Yes, it will surely be a problem without locking.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 09 Oct 2003 15:51:12 +0200
From: Roger Johansson <no-email@home.se>
Subject: Re: Search-replace in multiple files?
Message-Id: <4unaovstvka9ja3pep7b338jd57i22f3lr@4ax.com>
ko <kuujinbo@hotmail.com> wrote:
>If its a simple search/replace, you can do it with a one-liner from your
>shell:
>WINDOWS (wrapped, but should be on one line):
>perl -p -i.orig -e "BEGIN {@ARGV = map { glob } @ARGV }
>s/SEARCH/REPLACE/g" *.html
>
>These commands will do replacement on HTML files in the current
>directory. In the second example, you need the BEGIN block because the
>Windows shell doesn't do wildcard expansion. 'perlrun' will give you a
>better idea of what you can do with the -i, -p, and -e command line
>switches.
Thanks. It works.
I had some practical problems because a DOS Prompt window does not
allow copy and paste from the windows clipboard, so I would have to
write everything manually in the DOS window.
I had to change autoexec.bat to get my swedish keyboard to work in DOS
windows.
I finally found a way to do it in my file handler Total Commander, and
that worked, but it would be nice to have a DOS console program which
was more useful than the DOS Prompt window. How do you perl
programmers solve that problem? Is there a DOS console program you can
use to work in which allows copying and pasting from the windows
environment?
A window which doesn't close every time a script has ended, and with
better background color, better font, etc..
I tried to put your line of code into a .pl script, like this:
#! ./perl
#
# search and replace in all html files in current directory
use strict;
use warnings;
{
perl -p -i.orig -e "BEGIN {@ARGV = map { glob } @ARGV }
s/SEARCH/REPLACE/g" *.html
}
{
print "Press [ ENTER ] to continue\n";
<STDIN>;
}
But it didn't work. I probably made some stupid mistake.
(I unwrapped the long line, so it is not that problem)
I found several online books on learn.perl.org but I haven't had time
to read them yet. I will tonight :-)
--
Roger J.
(My email address is a spam trap, do not use it)
------------------------------
Date: Thu, 9 Oct 2003 09:03:35 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Search-replace in multiple files?
Message-Id: <slrnboaqln.2qb.tadmc@magna.augustmail.com>
Roger Johansson <no-email@home.se> wrote:
> ko <kuujinbo@hotmail.com> wrote:
>
>>If its a simple search/replace, you can do it with a one-liner from your
>>shell:
>
>>WINDOWS (wrapped, but should be on one line):
>>perl -p -i.orig -e "BEGIN {@ARGV = map { glob } @ARGV }
>>s/SEARCH/REPLACE/g" *.html
> I tried to put your line of code into a .pl script, like this:
>
> #! ./perl
> #
> # search and replace in all html files in current directory
>
> use strict;
> use warnings;
>
> {
> perl -p -i.orig -e "BEGIN {@ARGV = map { glob } @ARGV }
> s/SEARCH/REPLACE/g" *.html
> }
>
> {
> print "Press [ ENTER ] to continue\n";
> <STDIN>;
> }
>
> But it didn't work.
The switches go on the shebang (#!) line.
#!perl -p -i.orig
BEGIN {@ARGV = map { glob } @ARGV }
s/SEARCH/REPLACE/g;
or, you read perlrun.pod to see what the switches do for you,
then write code that does it yourself:
#!perl
BEGIN {@ARGV = map { glob } @ARGV }
$^I = '.orig'; # turn on in-place editing
while ( <> ) {
s/SEARCH/REPLACE/g;
print;
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 9 Oct 2003 12:37:13 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Switch and function prototypes
Message-Id: <bm3kpp$83b$1@mamenchi.zrz.TU-Berlin.DE>
Joe Gottman <jgottman@carolina.rr.com> wrote in comp.lang.perl.misc:
> I tried to compile the following code in my Perl program:
>
> #!/usr/bin/perl
>
> use strict;
> use Switch;
>
> sub testSwitch ($)
> {
> my $param = shift;
> switch ($param) {}
> }
>
>
> I got the following error:
> syntax error at test.pl line 9, near ") {"
> syntax error at test.pl line 10, near "}"
> Execution of test.pl aborted due to compilation errors.
>
> Strangely, when I declared the function with no prototype, or replaced the
> "$" with "$;", the program compiled fine. Does anyone have any idea why
> this is happening?
That looks like a bug in the Switch module to me, though it could also
be a bug in Perl's prototyping system. It's hard to see what's going on,
because Switch.pm uses a source filter. Unless someone else has a better
idea, I'd report it.
Anno
------------------------------
Date: Thu, 09 Oct 2003 10:53:53 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: Teach me how to fish, regexp
Message-Id: <v9faovgncsra10do4urv7g81af0diji8v5@4ax.com>
On Wed, 08 Oct 2003 19:21:02 GMT, Henry <henryn@zzzspacebbs.com>
wrote:
>That's a lot of stuff, and in a reference format. Fortunately, the examples
>are generally quite good, but this isn't exactly the most friendly
>environment.
What do you mean? Plain text, a pageful at a time, readily
searchable, isn't friendly enough for you? How much more
friendly can you get. If you prefer, the Activestate distribution
of Perl for Windows, Linux and Solaris, comes with all the
documentation in html format. I use that a little, but usually
prefer perldoc.
>> Furthermore: Don't worry too much that some of this stuff looks
>> magical. It is. Perl is full of things that you just have to learn
>> about by immersion, and by repeated visits to the same documentation.
>> it can take a while before some of this stuff becomes automatic.
>
>Perl doesn't seem to be anything one can pick up quickly, that's for sure.
I disagree. Programming logic in itself takes a while, but
if you are a programmer, you can pick up enough Perl to do
useful things in a couple of weeks, *if* you learn how to use
perldoc. It is the very core of learning Perl, more important than
anything else.
------------------------------
Date: 9 Oct 2003 06:52:29 -0700
From: rjohnson@shell.com (Roy Johnson)
Subject: Re: Teach me how to fish, regexp
Message-Id: <3ee08638.0310090552.2821c3a4@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbo88m4.lk2.tadmc@magna.augustmail.com>...
> Roy Johnson <rjohnson@shell.com> wrote:
> > "Programming Perl" is a good alternative to looking everything up
> > in perldoc and man pages.
>
> No it isn't.
>
> The Camel book describes some old version of Perl.
I think a little more significance is being given to the differences
in versions than is warranted. For most things, the Camel book is a
fine reference. Particularly for someone just getting acquainted with
Perl, it is going to be more than adequate. You give the impression
that there are major compatibility problems between versions of Perl
5.
That said, I should have had a caveat that features do change.
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 5639
***************************************