[29752] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 996 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 1 18:09:40 2007

Date: Thu, 1 Nov 2007 15:09:07 -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, 1 Nov 2007     Volume: 11 Number: 996

Today's topics:
    Re: !Help: can't get into perl -MCPAN -e shell <mmccaws@comcast.net>
    Re: !Help: can't get into perl -MCPAN -e shell <brian.d.foy@gmail.com>
    Re: Get length of returned array without storing? xhoster@gmail.com
    Re: How to convert timestamp to epoch? <jl_post@hotmail.com>
    Re: Issue in executing more than one perl script from S <5502109103600001@t-online.de>
    Re: Looking for a module (or anything) to grab a webcam <glex_no-spam@qwest-spam-no.invalid>
    Re: Looking for a module (or anything) to grab a webcam <paulburto@gmail.com>
        poe::component::server::syslog  scott.jarman@gmail.com
        Problems with Airthmetic Operators in a hash <naureen.nizam@gmail.com>
    Re: Problems with Airthmetic Operators in a hash <Narthring@gmail.com>
        Problems with Arithmetic Operators in a Perl hash <naureen.nizam@gmail.com>
    Re: Problems with Arithmetic Operators in a Perl hash <glex_no-spam@qwest-spam-no.invalid>
    Re: Problems with Arithmetic Operators in a Perl hash <peter@makholm.net>
    Re: Problems with Arithmetic Operators in a Perl hash <krahnj@telus.net>
    Re: Script to find largest files <jurgenex@hotmail.com>
    Re: Simple string search <glex_no-spam@qwest-spam-no.invalid>
    Re: Simple string search <5502109103600001@t-online.de>
        string matching doesn't work <accpactec@hotmail.com>
    Re: string matching doesn't work <usenet@larseighner.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Thu, 01 Nov 2007 08:18:19 -0700
From:  mmccaws2 <mmccaws@comcast.net>
Subject: Re: !Help: can't get into perl -MCPAN -e shell
Message-Id: <1193930299.999692.10260@e9g2000prf.googlegroups.com>

On Oct 31, 1:34 pm, smallpond <smallp...@juno.com> wrote:
> On Oct 31, 11:47 am, mmccaws2 <mmcc...@comcast.net> wrote:
>
>
>
> > I try to login in at command line.  It gives me the output below.  It
> > then kicks me out of the perl shell.  What do I need to do to be able
> > to use it?
>
> > Mike
>
> > Here is the error message:
>
> > Can't load '/opt/perl/lib/5.8.3/IA64.ARCHREV_0-thread-multi/auto/IO/
> > IO.so' for module IO: Exec format error at /opt/perl/lib/5.8.3/
> > IA64.ARCHREV_0-thread-multi/XSLoader.pm line 68.
> >  at /opt/perl/lib/5.8.3/IA64.ARCHREV_0-thread-multi/IO.pm line 11
> > Compilation failed in require at /opt/perl/lib/5.8.3/IA64.ARCHREV_0-
> > thread-multi/IO/Handle.pm line 260.
> > BEGIN failed--compilation aborted at /opt/perl/lib/5.8.3/
> > IA64.ARCHREV_0-thread-multi/IO/Handle.pm line 260.
> > Compilation failed in require at /opt/perl/lib/5.8.3/IA64.ARCHREV_0-
> > thread-multi/IO/Seekable.pm line 101.
> > BEGIN failed--compilation aborted at /opt/perl/lib/5.8.3/
> > IA64.ARCHREV_0-thread-multi/IO/Seekable.pm line 101.
> > Compilation failed in require at /opt/perl/lib/5.8.3/IA64.ARCHREV_0-
> > thread-multi/IO/File.pm line 117.
> > BEGIN failed--compilation aborted at /opt/perl/lib/5.8.3/
> > IA64.ARCHREV_0-thread-multi/IO/File.pm line 117.
> > Compilation failed in require at /opt/perl/lib/5.8.3/FileHandle.pm
> > line 9.
> > Compilation failed in require at /opt/perl/lib/5.8.3/CPAN.pm line 26.
> > BEGIN failed--compilation aborted at /opt/perl/lib/5.8.3/CPAN.pm line
> > 26.
> > Compilation failed in require.
> > BEGIN failed--compilation aborted.
>
> Exec format error means the file will not run on your machine.
> Either
> it is corrupted or (more likely) built for the wrong architecture.
> Are you on an Itanium system?  Try the command:
>
> file /opt/perl/lib/5.8.3/IA64.ARCHREV_0-thread-multi/auto/IO/IO.so

I still can't log in.  This is a production server, so it is important
for this to get resolved with minimal service disruption.  Do I try to
install the module again.  If so, since I can't use perl -MCPAN -e
shell to do this, how do I try to reinstall on a HPUX 11i platform?

Or what do I need to do?

Mike



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

Date: Thu, 01 Nov 2007 16:55:17 -0400
From: brian d  foy <brian.d.foy@gmail.com>
To: smallpond <smallpond@juno.com>
Subject: Re: !Help: can't get into perl -MCPAN -e shell
Message-Id: <011120071655172461%brian.d.foy@gmail.com>

[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

In article <1193862880.246245.35010@o3g2000hsb.googlegroups.com>,
smallpond <smallpond@juno.com> wrote:

> On Oct 31, 11:47 am, mmccaws2 <mmcc...@comcast.net> wrote:
> > I try to login in at command line.  It gives me the output below.  It
> > then kicks me out of the perl shell.  What do I need to do to be able
> > to use it?

I'm not sure what this means. Are you talking about logging into your
user account and getting this error before you type any commands?

A complete transcript of your session would be helpful. :)


> > Here is the error message:
> >
> > Can't load '/opt/perl/lib/5.8.3/IA64.ARCHREV_0-thread-multi/auto/IO/
> > IO.so' for module IO: Exec format error at /opt/perl/lib/5.8.3/
> > IA64.ARCHREV_0-thread-multi/XSLoader.pm line 68.

Can you run anything else with perl or is it just this module giving
you problems?

What happens when you try:

   $ perl -MIO -e 0

If that doesn't work, I suggest re-installing perl. You have something
wrong with a core module.


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

Date: 01 Nov 2007 17:56:50 GMT
From: xhoster@gmail.com
Subject: Re: Get length of returned array without storing?
Message-Id: <20071101135652.820$vo@newsreader.com>

Big and Blue <No_4@dsl.pipex.com> wrote:
> boole wrote:
> >
> > I want to get the length of that array without storing the result in
> > an array variable.
>
>     my $len = (func_call());

No, that does the same thing as not using the extra parens.  Maybe you
mean this:

my $len = () = func_call();

-- 
-------------------- http://NewsReader.Com/ --------------------
The costs of publication of this article were defrayed in part by the
payment of page charges. This article must therefore be hereby marked
advertisement in accordance with 18 U.S.C. Section 1734 solely to indicate
this fact.


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

Date: Thu, 01 Nov 2007 08:11:30 -0700
From:  "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: How to convert timestamp to epoch?
Message-Id: <1193929890.524913.288550@z9g2000hsf.googlegroups.com>

On Nov 1, 7:09 am, Ben Morrow <b...@morrow.me.uk> wrote:
>
> Rather confusingly, ppm installs 'distributions' rather than 'modules',
> and unlike CPAN.pm won't cross-reference them for you. If you look
> Date::Parse up on search.cpan.org you will see it is in the TimeDate
> distribution, so you should be able to get it with
>
>     ppm install TimeDate


   Thank-you for sharing that, Ben.  I never knew that, and now I know
what to do in case I have trouble with it in the future.

   (Oh, the "ppm install TimeDate" command you gave me worked
perfectly.)

   Thanks again.

   -- Jean-Luc Romano



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

Date: Thu, 01 Nov 2007 19:19:30 +0100
From: Josef Moellers <5502109103600001@t-online.de>
Subject: Re: Issue in executing more than one perl script from Single perl script
Message-Id: <fgd5bo$7fb$03$1@news.t-online.com>

Jim.Lane@cibc.com wrote:
> On Nov 1, 2:52 am, nilesh.sonaw...@gmail.com wrote:
>> Hi,
>> I am calling "1.pl" from "main.pl" file.
>> using
>> #main.pl
>> system ("perl 1.pl");
>>
>> In this case it works fine.
>>
>> But when I am doing
>> #main.pl
>> system ("perl 1.pl");
>> system ("perl 2.pl");
>>
>> then it doesn't executes "1.pl" properly.
>> So I would like to know, is there any constraint for this? Do I need
>> to take any precautions for this?
>>
>> Thanks,
> 
> Why are you using system() for this? AFAIK it forks a
> whole new process - a lot of overhead to go to.
> Isn't this what the "require" facility is for?

Using system, you start a completely new program which executes on its 
own, in its own context and e.g. is not required to be a Perl program at 
all.

OTOH "require" will include the Perl program code into the current 
program code.

-- 
Mails please to josef dot moellers
and I'm on gmx dot de.


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

Date: Thu, 01 Nov 2007 10:28:08 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Looking for a module (or anything) to grab a webcam image
Message-Id: <4729f089$0$502$815e3792@news.qwest.net>

PB wrote:
> A perldoc -q query didn't turn up anything camera- or webcam-related
> that looked useful; neither did a CPAN module search nor a Google Groups
> search or a Google Web search.

Oh Really.  Searching CPAN for 'video' or the Internet for
ohhh.. "webcam capture image" didn't find anything useful?
How strange.. Doing just that I see a lot of possibilities.


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

Date: Thu, 01 Nov 2007 12:11:12 -0400
From: PB <paulburto@gmail.com>
Subject: Re: Looking for a module (or anything) to grab a webcam image
Message-Id: <4729edf3$0$26476$88260bb3@free.teranews.com>

* J. Gleixner wrote, On 11/1/2007 11:28 AM:
> Oh Really.  Searching CPAN for 'video' or the Internet for
> ohhh.. "webcam capture image" didn't find anything useful?
> How strange.. Doing just that I see a lot of possibilities.



OK, OK, there was Video::Capture::V4l::Imager at CPAN (I did find that
before posting.)

As for your other recommendation, I thought the fact that I was asking
the question in a Perl/perl group would obviate the fact that I was
searching for a perl solution to my problem. Try Googling /"webcam
capture image" perl/ and see what I mean.

So, let me restate my question:

Is there any perl-ish way to capture a USB webcam image and save it to a
 file?

Has anyone used Video::Capture::V4l::Imager? I'd just install and start
mucking around with it, but I'm at work now and just thought I'd test
the waters here for some ideas.

-- 

Paul Burton
paulburto *at* gmail *dot* com

-- 
Posted via a free Usenet account from http://www.teranews.com



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

Date: Thu, 01 Nov 2007 10:33:11 -0700
From:  scott.jarman@gmail.com
Subject: poe::component::server::syslog
Message-Id: <1193938391.577993.77140@y42g2000hsy.googlegroups.com>

Hi

I've been using poe::component::server::syslog for some time without
issue.

I now however need to receive syslog messages from a VMS server that
isn't using any kind of name resolution.
As such when I get a message from this server the hostname is undef.

Want I really want is to find out the IP address of the sending host
not the hostname.
Does anyone have any ideas how I can achieve this ?



Thanks



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

Date: Thu, 01 Nov 2007 08:25:03 -0700
From:  coolchick <naureen.nizam@gmail.com>
Subject: Problems with Airthmetic Operators in a hash
Message-Id: <1193930703.949530.27260@z9g2000hsf.googlegroups.com>

Hi All,

I am trying to go through a file and grab all the arithmetic operators
using a perl hash.
It is not working for me. What am I doing wrong? I think my issue is
with the key value that I can't escape. HELP!

#!/usr/bin/perl

%operators = ('+',0,'-',0,'=',0,'*',0,'/',0);

$FILE="operator.txt";
open(FILE) or die("Could not open $FILE.");

foreach $line (<FILE>) {

         while (($key,$value) = each(%operators)){
                    if ($line =~ /\$key/) {
                       $operators{$key}=$value+1;
                }
       }
}



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

Date: Thu, 01 Nov 2007 11:16:23 -0700
From:  Narthring <Narthring@gmail.com>
Subject: Re: Problems with Airthmetic Operators in a hash
Message-Id: <1193940983.041014.33210@k35g2000prh.googlegroups.com>

On Nov 1, 10:25 am, coolchick <naureen.ni...@gmail.com> wrote:
> Hi All,
>
> I am trying to go through a file and grab all the arithmetic operators
> using a perl hash.
> It is not working for me. What am I doing wrong? I think my issue is
> with the key value that I can't escape. HELP!
>
> #!/usr/bin/perl
>
> %operators = ('+',0,'-',0,'=',0,'*',0,'/',0);
>
> $FILE="operator.txt";
> open(FILE) or die("Could not open $FILE.");
>
> foreach $line (<FILE>) {
>
>          while (($key,$value) = each(%operators)){
>                     if ($line =~ /\$key/) {
>                        $operators{$key}=$value+1;
>                 }
>        }
>
> }


Change /\$key/ to /\Q$key\E/

\Q quotes pattern metacharacters until \E



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

Date: Thu, 01 Nov 2007 08:40:32 -0700
From:  coolchick <naureen.nizam@gmail.com>
Subject: Problems with Arithmetic Operators in a Perl hash
Message-Id: <1193931632.621541.160610@o3g2000hsb.googlegroups.com>

Hi All,

I am trying to go through a file and grab all the arithmetic operators
using a perl hash.
It is not working for me. What am I doing wrong? I think my issue is
with the key value that I can't escape. HELP!

#!/usr/bin/perl

%operators = ('+',0,'-',0,'=',0,'*',0,'/',0);

$FILE="operator.txt";
open(FILE) or die("Could not open $FILE.");

foreach $line (<FILE>) {

        while (($key,$value) = each(%operators)){
                   if ($line =~ /\$key/) {
                      $operators{$key}=$value+1;
               }
      }
}



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

Date: Thu, 01 Nov 2007 10:58:47 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Problems with Arithmetic Operators in a Perl hash
Message-Id: <4729f7b7$0$10301$815e3792@news.qwest.net>

coolchick wrote:
> Hi All,

Yeah, we heard you the first time you posted this same question 
15-minutes ago.

> 
> I am trying to go through a file and grab all the arithmetic operators
> using a perl hash.
> It is not working for me. What am I doing wrong? I think my issue is
> with the key value that I can't escape. HELP!
> 
> #!/usr/bin/perl

use strict;
use warnings;

> 
> %operators = ('+',0,'-',0,'=',0,'*',0,'/',0);
> 
> $FILE="operator.txt";
> open(FILE) or die("Could not open $FILE.");

Why not have it die with why it failed?

                 die "Could not open $FILE: $!";

You should be using the three argument open.

open( my $file, '<', $FILE ) or die "Could not open $FILE: $!";

perldoc -f open

> 
> foreach $line (<FILE>) {
> 
>         while (($key,$value) = each(%operators)){
>                    if ($line =~ /\$key/) {
                      if ( $line =~ /\Q$key\E/ ) {
>                       $operators{$key}=$value+1;
>                }
>       }
> }
> 

To learn more about regular expressions, see:

perldoc perlretut


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

Date: Thu, 01 Nov 2007 16:46:01 +0000
From: Peter Makholm <peter@makholm.net>
Subject: Re: Problems with Arithmetic Operators in a Perl hash
Message-Id: <87bqadhq2e.fsf@hacking.dk>

coolchick <naureen.nizam@gmail.com> writes:

> %operators = ('+',0,'-',0,'=',0,'*',0,'/',0);

>         while (($key,$value) = each(%operators)){
>                    if ($line =~ /\$key/) {

I'm not quite sure of the exact rules, but in regular expressions a $
can be both an sigil for a scalar variable or the special character
matching the end of the string. In the above I would guess that perl
will match the literal string '$key'.

What you need is to interpolate the variable $key but with any special
characters escaped. This is done by using the \Q escape:

                     if ($line =~ /\Q$key/) {

>                       $operators{$key}=$value+1;
>                }
>       }

//Makholm


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

Date: Thu, 01 Nov 2007 17:50:54 GMT
From: "John W. Krahn" <krahnj@telus.net>
Subject: Re: Problems with Arithmetic Operators in a Perl hash
Message-Id: <472A11DA.5B83920F@telus.net>

coolchick wrote:
> 
> I am trying to go through a file and grab all the arithmetic operators
> using a perl hash.
> It is not working for me. What am I doing wrong? I think my issue is
> with the key value that I can't escape. HELP!
> 
> #!/usr/bin/perl

use warnings;
use strict;


> %operators = ('+',0,'-',0,'=',0,'*',0,'/',0);

my %operators = map { $_ => 0 } qw( + - = * / );


> $FILE="operator.txt";

my $FILE = 'operator.txt';


> open(FILE) or die("Could not open $FILE.");

open FILE, '<', $FILE or die "Could not open '$FILE' $!";


> foreach $line (<FILE>) {

while ( my $line = <FILE> ) {


>         while (($key,$value) = each(%operators)){
>                    if ($line =~ /\$key/) {
>                       $operators{$key}=$value+1;
>                }

        for my $key ( keys %operators ) {
                $operators{ $key }++ if $line =~ /\Q$key/;
        }


>       }
> }



John
-- 
use Perl;
program
fulfillment


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

Date: Thu, 01 Nov 2007 15:19:51 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Script to find largest files
Message-Id: <r8mWi.2$Rd.0@trndny08>

groups.user@gmail.com wrote:
> Hi Script Gurus..

Hi Groups

> i'm looking for a script to find the largest files in a filesystem,
> ordered by size.

Reading these should get you started:
    perldoc File::Find
    perldoc -f -s
    perldoc -f sort

jue 




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

Date: Thu, 01 Nov 2007 10:20:12 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Simple string search
Message-Id: <4729eead$0$494$815e3792@news.qwest.net>

Jack wrote:
> hi guys,
> A little problem here. I am very new to perl and i am having a problem
> search for a substring in a file. So here is a sample
> 
> (this is my id for id="wksOI*84sk_")
> (this is my id for id="@s3dSSos_")
> (this is my id for id="dksWDkps_")
> 
> So i have page with 20 of these lines. all I am interested in the id
> part of each line ie, wksOl*84sk_  . As you maybe able to tell the id
> part of each line is 12 char and it always ends with _"). I think the
> regex must be for  an expression that starts with id=" and ends with
> ") with 12 letters in the middle. So once this id has been found I
> need to write it in a file.
> 
> I know with m/regex/ I can find stuff, but I don' t how to return the
> cryptic id.
> 
> Any solutions.

Many solutions.

perldoc perlretut

See "Extracting matches"


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

Date: Thu, 01 Nov 2007 19:25:39 +0100
From: Josef Moellers <5502109103600001@t-online.de>
Subject: Re: Simple string search
Message-Id: <fgd5nf$rf0$00$1@news.t-online.com>

Jack wrote:
> hi guys,
> A little problem here. I am very new to perl and i am having a problem
> search for a substring in a file. So here is a sample
> 
> (this is my id for id="wksOI*84sk_")
> (this is my id for id="@s3dSSos_")
> (this is my id for id="dksWDkps_")
> 
> So i have page with 20 of these lines. all I am interested in the id
> part of each line ie, wksOl*84sk_  . As you maybe able to tell the id
> part of each line is 12 char and it always ends with _"). I think the
> regex must be for  an expression that starts with id=" and ends with
> ") with 12 letters in the middle. So once this id has been found I
> need to write it in a file.

This is somewhat inconsistent. The example you gave (wksOl*84sk_) is 
only 11 characters long.

> I know with m/regex/ I can find stuff, but I don' t how to return the
> cryptic id.
> 
> Any solutions.

if ($string =~ m/id="(.{12})"/) {
     $desired_id = $1;
}

-- 
Mails please to josef dot moellers
and I'm on gmx dot de.


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

Date: Thu, 01 Nov 2007 21:48:44 -0000
From:  Jack <accpactec@hotmail.com>
Subject: string matching doesn't work
Message-Id: <1193953724.538513.117370@y27g2000pre.googlegroups.com>

Hello, I have a little problem. i am trying to extract some text from
a file. I need to get the first names and last names as well as the
data between the <TD> tags which corresponds to Current Status. For
example:

<h1>Mr. firstname lastname</h1>
<th class="profile"><nobr>Current Status</nobr></th><td
class="profile" colspan="2">Some data</td>

so i need firstname lastname as well as some data. my current string
looks like this but it doesn't work.

 if (@content =~ m/<h1>Mr.*<\/h1>/){
                print "here " . $1;
        }

Please help....



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

Date: 01 Nov 2007 21:56:47 GMT
From: Lars Eighner <usenet@larseighner.com>
Subject: Re: string matching doesn't work
Message-Id: <slrnfikiqf.1rl8.usenet@debranded.larseighner.com>

In our last episode,
<1193953724.538513.117370@y27g2000pre.googlegroups.com>, the lovely and
talented Jack broadcast on comp.lang.perl.misc:

> Hello, I have a little problem. i am trying to extract some text from
> a file. I need to get the first names and last names as well as the
> data between the <TD> tags which corresponds to Current Status. For
> example:

><h1>Mr. firstname lastname</h1>
><th class="profile"><nobr>Current Status</nobr></th><td
> class="profile" colspan="2">Some data</td>

> so i need firstname lastname as well as some data. my current string
> looks like this but it doesn't work.

>  if (@content =~ m/<h1>Mr.*<\/h1>/){
>                 print "here " . $1;
>         }

> Please help....


perldoc -q matching

-- 
Lars Eighner     <http://larseighner.com/>     <http://myspace.com/larseighner>
                         Countdown: 445 days to go.
                    What do you do when you're debranded?


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

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.  

NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice. 

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 V11 Issue 996
**************************************


home help back first fref pref prev next nref lref last post