[23526] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5735 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 31 11:05:56 2003

Date: Fri, 31 Oct 2003 08:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 31 Oct 2003     Volume: 10 Number: 5735

Today's topics:
    Re: Anybody using PERL to control their house ? (Bill)
    Re: Aps and Linux <stjm2@cam.ac.uk.remove>
    Re: Call Perl Scripts from Other Dir in Linux, Path Mes <no_thanks@bms.umist.ac.uk>
    Re: Checkbox -  database checkbox, if checked gives val <abigail@abigail.nl>
    Re: function modification <jurgenex@hotmail.com>
    Re: function modification <noreply@gunnar.cc>
    Re: Help with Video::Capture module <zentara@highstream.net>
    Re: How to prevent connection string from being public? ctcgag@hotmail.com
    Re: How to prevent connection string from being public? <jbh@example.com>
    Re: How to tell what modules are installed? <syscjm@gwu.edu>
    Re: How to tell what modules are installed? <calle@cyberpomo.com>
    Re: How to tell what modules are installed? <grazz@pobox.com>
    Re: Logic Flow Question (JR)
    Re: Logic Flow Question <usenet@morrow.me.uk>
    Re: Logic Flow Question ctcgag@hotmail.com
    Re: Need help with OCIDefineObject <jwillmore@remove.adelphia.net>
    Re: Projects <tore@aursand.no>
    Re: Sorting case insensitively <raisin@delete-this-trash.mts.net>
    Re: Video::Capture example? <zentara@highstream.net>
    Re: Video::Capture example? <zentara@highstream.net>
        Watching The ... <pasdespam_desmond@zeouane.org>
    Re: What am I doing wrong?! <tore@aursand.no>
        which host <werner.winter@asamnet.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 31 Oct 2003 07:35:09 -0800
From: wherrera@lynxview.com (Bill)
Subject: Re: Anybody using PERL to control their house ?
Message-Id: <239ce42f.0310310735.2a5b713@posting.google.com>

"Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de> wrote in message news:<bntaoh$6kr$1@nets3.rz.RWTH-Aachen.DE>...
> Also sprach Andrew Rich (VK4TEC):
> 
> > Anybody using automation and control ?
> 
> In a broader sense, in that I use it to control my computer which is
> part of my household (and that replaces TV and radio).
> 
> I heard some rumours according to which Larry would have a Perl-controllable
> coffee-machine.
> 
> Tassilo

You might want to check out the Perl source code for Misterhouse. It's
been available at http://misterhouse.net/.


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

Date: Fri, 31 Oct 2003 15:31:43 +0000
From: Stuart Moore <stjm2@cam.ac.uk.remove>
Subject: Re: Aps and Linux
Message-Id: <bntv8v$1bp$2@pegasus.csx.cam.ac.uk>

Ste wrote:

> Hi all, with my old win2k server iis i had this file working, but with linux
> and apache i have a problem:
> 
> http://delibere.onde.net/rimando.asp
> 
> Any idea?
> 

It's an ASP = Active Server Page.

I don't know much about them, but thought they were windows only. This 
might be the problem.

Stuart



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

Date: Thu, 30 Oct 2003 10:15:01 +0000
From: Chris <no_thanks@bms.umist.ac.uk>
Subject: Re: Call Perl Scripts from Other Dir in Linux, Path Messed Up
Message-Id: <3fa0e4f1$1@news.umist.ac.uk>

Public Interest wrote:
[snip]

Firstly, this post is OT. It has nothing to do with linux. So why are 
you x-posting here. The other ng you should consider is a shell one.

Secondly, it strikes me that your grasp of both perl and shell scripting 
is very limited (hence why you're posting a question, I guess). Your 
post raises many unanswered questions:
1) Why are using a shell script to run several perl scripts when you 
should really be combining them all into one perl script?
2) Why aren't you using a shebang line (#!) at the top of your perl 
script to tell the shell where to run perl from thus avoiding 'perl 
script.pl'?
3) Why don't you post the code to your perl scripts, that way we won't 
have to guess what's wrong with them?
4) In your later posts you mention CGI. Why are you even thinking about 
CGI when you still haven't sorted out your simple perl/shell problem(s)?

Go back. Rethink your questions. READ THE DOCS/FAQS/BOOKS. Search 
google. Only then post a question (with relevent code) to a relvent ng.



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

Date: 31 Oct 2003 14:27:33 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Checkbox -  database checkbox, if checked gives value of 1 .. how to sum ?
Message-Id: <slrnbq4sak.4eb.abigail@alexandra.abigail.nl>

randy (searsdvdtech@yahoo.com) wrote on MMMDCCXII September MCMXCIII in
<URL:news:506a5f6b.0310300630.39b68fbf@posting.google.com>:
&&  I don't need you to tell me how to handle my messages. If I want to
&&  top post. This is my choice. Who are you the Internet miss manners
&&  police? If you can't help then don't post to this thread.


And it's my choice to ignore you. 

*PLOINK*


Abigail
-- 


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

Date: Fri, 31 Oct 2003 14:35:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: function modification
Message-Id: <Kquob.18520$Q9.5838@nwrddc02.gnilink.net>

abraxas wrote:
> I have an html page with several links and a function that search the
> first of those links. The function is the following:
[home-cooked code based on REs snipped]
> It takes the html code as a parameter and returns the url of the
> first link that it finds. For example, if the first link that the
> function find is the following:
>       <a href="http://www.page.com">
>             My Page
>       </a>

And it fails on a myriad of legal HTML code, e.g. even if the the tag name
is upper case. While this particular problem may be easy to fix, there are
gazillions of more 'easy-to-fix' issues, which -taken as a whole- make it a
waste of time to even start fixing them when you consider that there are
ready-made modules that do the job perfectly.

> My problem is that also i want the function to return the text of the
> link, "My Page".

Actually no. Your problem is that you are trying to parse HTML using regular
expressions.
As explained in 'perldoc -q HTML': "How do I remove HTML from a string?" a
simple RE-based approach may work on simple HTML code where you have full
control of the source code. But nobody with a sane mind would attempt to
write a general HTML parser using REs.

You will be way better of using one of the HTML parser modules from CPAN.

jue




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

Date: Fri, 31 Oct 2003 15:50:59 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: function modification
Message-Id: <bntter$162drj$1@ID-184292.news.uni-berlin.de>

abraxas wrote:
> i'm just a beginner using Perl and i have a little problem. I have
> an html page with several links and a function that search the
> first of those links. The function is the following:
>       search_first_link {
>               $cadena = $_[0];
>               $p = index ($cadena, '<a');
>               return -1 if ($p < 0);
>               $p1 = index ($cadena, 'href', $p);
>               return -1 if ($p1 < 0);
>               $p2 = index ($cadena, '>', $p1);
>               return -1 if ($p2 < 0);
>               $subcadena = substr ($cadena, $p1, $p2-$p1);
>               $reg_exp = "href=\"([^\"]+)\"";
>               return ($1) if ($subcadena =~ /$reg_exp/s);
>               return (-1);
>       }

 From where did you copy that function?

> My problem is that also i want the function to return the text of
> the link, "My Page".
> How can I modify the function to get it?

This may work, but only under certain conditions:

     sub search_first_link {
         my $reg_exp = 'href="([^"]+)"[^>]*>([^<]+)<';
         return $1, $2 if shift =~ /$reg_exp/i;
         return -1;
     }
     my ($url, $text) = search_first_link($html);

But you'd better follow Jürgen's advise and use a module.

-- 
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl



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

Date: Fri, 31 Oct 2003 09:59:09 -0500
From: zentara <zentara@highstream.net>
Subject: Re: Help with Video::Capture module
Message-Id: <1vt4qvkqif2vmqvjolj6tlqici2oph929j@4ax.com>

On Thu, 30 Oct 2003 14:16:22 +0000 (UTC), Stan Brown <stanb@panix.com>
wrote:

>I'm trying to replace some system() calls to v4lctl in a script I'm
>writing.
>
>Looks like I can use Video::Capture, but I dont understand the examples.
>
>Looks like I start off by creating an object like this:
>
>$grab = new Video::Capture::V4l
>   or die "Unable to open Videodevice: $!";
>
>But, since I have more than one captur card (eg /dev/video0 ...
>/dev/vdieon), how do I specify which one the objetc opens?
>
>Also, how do I set the sourec *eg telivision, Composire1)

Read the V4l.pm module, you will see.
It defaults to /dev/video0 so you probably can do
$grab1 = new Video::Capture::V4l ('/dev/video1')
          or die "Unable to open Videodevice: $!";

From V4l.pm:
sub new(;$) {
   my $class  = shift;
   my $device = shift || "/dev/video0";
   my $self = bless { device => $device }, $class;




Our body's 20 milligrams of beta radioactive Potassium 40
emit about 340 million neutrinos per day, which go at well-nigh
lightspeed to the ends of the universe!..even thru the earth. 


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

Date: 31 Oct 2003 14:46:54 GMT
From: ctcgag@hotmail.com
Subject: Re: How to prevent connection string from being public?
Message-Id: <20031031094654.570$qC@newsreader.com>

James Henson <jbh@example.com> wrote:
> I'm using a MySQL database from within some Perl cgi's. To
> make the connection, I have to supply the username/password
> in the connection string. This info is readable for anyone
> that can view my code, e.g. all other users that can access
> the webserver directly, or by some possible exploit.
>
> How can I avoid this? I can't have my own webserver, obviously.


I made my own module that has the connection string.  It's a simple
function that returns the connection.  That way I only need to
change one thing when the connection string changes.  However,
that doesn't solve your problem, it just shifts it from hiding
many things to hiding one thing.  If Apache (assuming that's our server)
is to run your scripts, it needs to see them.  So this is an
Apache and/or system administration problem, you'll have to discuss it
with your Apache and/or system administrator.


Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: Fri, 31 Oct 2003 15:56:17 +0100
From: James Henson <jbh@example.com>
Subject: Re: How to prevent connection string from being public?
Message-Id: <3fa27870$0$58701$e4fe514c@news.xs4all.nl>

ctcgag@hotmail.com wrote:

> I made my own module that has the connection string.

I currently have it in an included piece of Perl, as
this makes setting up the app a lot less time consuming.

> However, that doesn't solve your problem, it just shifts it from hiding
> many things to hiding one thing.  If Apache (assuming that's our server)
> is to run your scripts, it needs to see them.
> So this is an Apache and/or system administration problem, you'll have to 
> discuss it with your Apache and/or system administrator.

She doesn't know the answer either. The cgi's should be readable,
so the user/passwd is exposed. I'll try to find another admin.

Thanks,
James



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

Date: Fri, 31 Oct 2003 09:51:02 -0500
From: Chris Mattern <syscjm@gwu.edu>
Subject: Re: How to tell what modules are installed?
Message-Id: <3FA276D6.3060804@gwu.edu>

Anno Siegel wrote:
> Jim Anderson <james.h.anderson@ssmb.com> wrote in comp.lang.perl.misc:
> 
>>Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message
>>news:<bnrtgk$14okgo$1@ID-184292.news.uni-berlin.de>...
>>
>>>Jim Anderson wrote:
>>>
>>>>What's the best way to get a list of all the installed modules?
>>>
>>>That's a FAQ.
>>>
>>>     perldoc -q installed
>>
>>Unfortunately, this just tells me that there's no doc for 'installed'.
> 
> 
> Ah... you're running an older Perl.  The FAQ suggests to use the
> ExtUtils::Installed module.  Another possibility is "perldoc perllocal".
> That lists all modules that were properly installed through CPAN.

My perl is 5.8.0, installed just a few months ago.  perldocs cannot
find any FAQ with the keyword "installed".  It's beginning to look
like this FAQ was recently *removed* for some reason.

           Chris Mattern
> 
> If you just want to know if module Xyz is installed, try "perldoc Xyz".
> If you can read the documentation, the module is (most likely) installed,
> if you can't it (most likely) isn't, though it can conceivably go
> wrong either way.



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

Date: Fri, 31 Oct 2003 16:00:03 +0100
From: Calle Dybedahl <calle@cyberpomo.com>
Subject: Re: How to tell what modules are installed?
Message-Id: <86r80tpi4s.fsf@ulthar.bisexualmenace.org>

>>>>> "Chris" == Chris Mattern <syscjm@gwu.edu> writes:

> My perl is 5.8.0, installed just a few months ago.  perldocs cannot
> find any FAQ with the keyword "installed".  It's beginning to look
> like this FAQ was recently *removed* for some reason.

It's still there in a new-installed 5.8.1
-- 
		    Calle Dybedahl <calle@lysator.liu.se>
    "I don't know what art these programs are state-of; possibly macrame."
		     -- Dr Richard A. O'Keefe, comp.risks


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

Date: Fri, 31 Oct 2003 15:27:39 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: How to tell what modules are installed?
Message-Id: <Lbvob.43111$4O1.7046@nwrdny01.gnilink.net>

Bernard El-Hagin <bernard.el-haginDODGE_THIS@lido-tech.net> wrote:
> Helgi Briem <HelgiBriem_1@hotmail.com> wrote:
>> james.h.anderson@ssmb.com (Jim Anderson) wrote:
>>> Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
>>>> Jim Anderson wrote:
>>>> > What's the best way to get a list of all the installed modules?
>>>> 
>>>>      perldoc -q installed
>>>
>>> Unfortunately, this just tells me that there's no doc for 'installed'.
>> 
>> Then you either do not have Perl installed on your system
>> or the installation is broken.   Which is it?
> 
> It's neither. There *is* no result for 'perldoc -q installed' except for 
> the "No documentation ... found" error.

That FAQ is new in 5.8.1 (just another possible explanation).
 
-- 
Steve


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

Date: 31 Oct 2003 06:14:48 -0800
From: jrolandumuc@yahoo.com (JR)
Subject: Re: Logic Flow Question
Message-Id: <b386d54b.0310310614.642c4b5@posting.google.com>

Ben Morrow <usenet@morrow.me.uk> wrote in message news:<bns96p$cv1$5@wisteria.csv.warwick.ac.uk>...
> jrolandumuc@yahoo.com (JR) wrote:
> > I'm having trouble understanding the logic flow of recipe 4.3 in the
> > Perl Cookbook (the below script is only slightly different from the
> > recipe in the Cookbook), and am hoping someone can clarify it for me.
> > 
> > Here's where I'm confused:
> > 
> > In the below permute subroutine, I don't understand how the $i
> > variable can ever reach 1 and 2.
> >
> > use strict;
> > use warnings;
> > 
> > my @array = ('A'..'C');
> > 
> > permute([@array]);
> > sub permute {
> >    my @items = @{ $_[0] };
> >    my @perms = @{ $_[1] } if defined @{ $_[1] };
> >    if (!@items) {
> >       print "\@perms=@perms\n"; 
> >    }
> >    else {
> >       my (@newitems, @newperms);
> >       my $i = 0;
> 
> Did you add this line?
> 
> >       for my $i (0..$#items) {
> 
> The 'my' here makes this create a new variable called $i, masking the
> old one, which now counts up from 0 to $#items. The old $i from the
> line above is never incremented, but neither is it ever printed.
> 
> If you want access to the loop variable outside the loop, remove the
> 'my'.
> 
> > print "\$i=$i\n";
> >          @newitems = @items;
> > 	 @newperms = @perms;
> >          ## Splice @newitems element and prepend it to @newperms
> > 	 unshift(@newperms, splice(@newitems, $i, 1));
> >          permute([@newitems], [@newperms]);
> >       }
> >    }
> > }
> > 
> > __END__
> 
> Ben

Thanks, Ben.  I removed the my from the for loop, the way it is
removed in recipe 4.3.  I didn't mean to have that in there-it was a
typo.  The results, even with my removed in the for loop, are still
the same.  Am I correct in guessing that the $i variable is not reset
to 0 every time the for loop is entered?  When permute is called at
the bottom of every iteration of the for loop, is the $i variable
somehow not being reset to 0 the next time the for loop is entered, or
does program control somehow stay in the for loop for a few iterations
before being passed back to the permute subroutine?

Thanks.

use strict;
use warnings;

my @array = ('A'..'C');

permute([@array]);
sub permute {
   my @items = @{ $_[0] };
   my @perms = @{ $_[1] } if defined @{ $_[1] };
   if (!@items) {
      print "\@perms=@perms\n"; 
   }
   else {
      my (@newitems, @newperms, $i);
      for $i (0..$#items) {
print "\$i=$i\n";
         @newitems = @items;
         @newperms = @perms;
         unshift(@newperms, splice(@newitems, $i, 1));
         permute([@newitems], [@newperms]);
      }
   }
}

__END__
$i=0
$i=0
$i=0
@perms=C B A
$i=1
$i=0
@perms=B C A
$i=1
$i=0
$i=0
@perms=C A B
$i=1
$i=0
@perms=A C B
$i=2
$i=0
$i=0
@perms=B A C
$i=1
$i=0
@perms=A B C


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

Date: Fri, 31 Oct 2003 14:50:54 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Logic Flow Question
Message-Id: <bntsse$d3v$1@wisteria.csv.warwick.ac.uk>


jrolandumuc@yahoo.com (JR) wrote:
>  I removed the my from the for loop, the way it is removed in recipe
> 4.3.

As Brian pointed out, I was mistaken here: Perl assumes a my even if
you don't put one in, hence

> The results, even with my removed in the for loop, are still
> the same. 

Apologies again.

> Am I correct in guessing that the $i variable is not reset
> to 0 every time the for loop is entered?  When permute is called at
> the bottom of every iteration of the for loop, is the $i variable
> somehow not being reset to 0 the next time the for loop is entered, or
> does program control somehow stay in the for loop for a few iterations
> before being passed back to the permute subroutine?

Err... I think you don't quite understand how subroutine calls work?
Calling permute() doesn't simply jump back to the top. It creates a
new lexical context: i.e., the variable $i in the new instance of
permute() is not the same as the variable $i in the old. So your print
statements are actually printing *different* '$i's all the time.

This may make it a little clearer:

> use strict;
> use warnings;
> 
> my @array = ('A'..'C');
> 
> permute([@array]);

Change this to 
  permute(1, [@array]);

> sub permute {

Add here
  my $level = shift;
  print "entering permute() level $level\n";

>    my @items = @{ $_[0] };
>    my @perms = @{ $_[1] } if defined @{ $_[1] };
>    if (!@items) {
>       print "\@perms=@perms\n"; 
>    }
>    else {
>       my (@newitems, @newperms, $i);
>       for $i (0..$#items) {
> print "\$i=$i\n";
>          @newitems = @items;
>          @newperms = @perms;
>          unshift(@newperms, splice(@newitems, $i, 1));
>          permute([@newitems], [@newperms]);

Change this to
  permute($level + 1, [@newitems], [@newperms]);

>       }
>    }

Add here
  print "leaving permute() level $level\n";

> }
> 
> __END__

Each time you enter a new level, a new copy of $i is created. When you
leave that level, that new copy is destroyed, and you go back to using
the last-oldest copy.

Ben

-- 
   Although few may originate a policy, we are all able to judge it.
                                             - Pericles of Athens, c.430 B.C.
  ben@morrow.me.uk


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

Date: 31 Oct 2003 14:58:24 GMT
From: ctcgag@hotmail.com
Subject: Re: Logic Flow Question
Message-Id: <20031031095824.136$cG@newsreader.com>

jrolandumuc@yahoo.com (JR) wrote:
>
> Thanks, Ben.  I removed the my from the for loop, the way it is
> removed in recipe 4.3.  I didn't mean to have that in there-it was a
> typo.  The results, even with my removed in the for loop, are still
> the same.  Am I correct in guessing that the $i variable is not reset
> to 0 every time the for loop is entered?

A new variable is created each time the loop is entered.  That new variable
can be referred to as $i from within the loop for which it was created (and
now where else).  This $i is set to 0, but there are still other variables,
which are also called $i but only from within their respective loops, that
are not affected here.  This is the main point of recursion, that each
recursive layer has access to only it's own lexical variables.

Xho

-- 
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service              New Rate! $9.95/Month 50GB


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

Date: Fri, 31 Oct 2003 15:59:24 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Need help with OCIDefineObject
Message-Id: <20031031102411.05c6248c.jwillmore@remove.adelphia.net>

On Thu, 30 Oct 2003 10:01:55 -0500
Greg G <ggershSNACK@CAKEctc.net> wrote:
> I'm totally confused as to how to do an OCIDefineObject to get an
> object from a database.  Here's the short form:

Is this an Oracle concept?  If so, how is this concept related to
Perl?  Are you using the DBD::Oracle module and DBI and this is what
your question relates to?

> 
> I've got an object K_PAIR defined as a KEY (varchar 20) and VALUE 
> (varchar 64).  I also have a table type of K_TABLE which is a table
> of K_PAIR objects.
> 
> The select statement I want to use is something along the lines of:
> 
> SELECT username, keys FROM MYTABLE;
> 
> username is just a plain old varchar and keys is a K_TABLE.
> 
> Of course, I get a message that I haven't done an OCIDefineObject. 
> Everything I've looked at is a confusing mash of parameters that I
> can't quite decipher.  Is there an *easy* way to do this binding?

Some _Perl_ code would be helpful :-)  Sorry, but it's not clear what
you're asking - as it relates to Perl.

-- 
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 ...
Kerr's Three Rules for a Successful College:  Have plenty of
football for the alumni, sex for the students, and parking for
the faculty. 


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

Date: Fri, 31 Oct 2003 16:57:58 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: Projects
Message-Id: <pan.2003.10.31.12.13.44.710178@aursand.no>

On Fri, 31 Oct 2003 04:04:25 -0800, Robert Shaffer wrote:
> Does anyone know where I can find some sort of list of unfinished
> programming projects or open source projects that need developers?

You can spend the rest of your pity life helping out on the Perl projects
hosted on www.sourceforge.net. :-)


-- 
Tore Aursand <tore@aursand.no>


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

Date: Fri, 31 Oct 2003 08:45:39 -0600
From: Master Web Surfer <raisin@delete-this-trash.mts.net>
Subject: Re: Sorting case insensitively
Message-Id: <MPG.1a0c318ac46bfbd69896bc@news.mts.net>

[This followup was posted to comp.lang.perl.misc]

In article <9760255.0310270626.3708125d@posting.google.com>, 
google@spongers.com says...
> Is there a way to sort case insensitively an array (without creating
> another array with lowercase values for instance) ?


@sorted = sort { uc($a) cmp uc($b) } @data;

# Note that you could also use "lc" instead of "uc" in
# the sorting specification


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

Date: Fri, 31 Oct 2003 09:45:38 -0500
From: zentara <zentara@highstream.net>
Subject: Re: Video::Capture example?
Message-Id: <kps4qv06cg99h8ombm4hukbeejsg1l9ffh@4ax.com>

On Fri, 31 Oct 2003 00:32:20 +0000 (UTC), Stan Brown <stanb@panix.com>
wrote:

>In <4u32qvgthijulq4baguj941i6a9jhr8g7p@4ax.com> zentara <zentara@highstream.net> writes:
>
>>On Wed, 29 Oct 2003 15:15:27 +0000 (UTC), Stan Brown <stanb@panix.com>
>>wrote:
>
>>>I'm writing a perl script to capture images from some cameras, and make
>>>mpes out of them on Linux.
>
>Thanks for the help on this again!

>First, why do we go through the capture/convert loop twice per grab?
>
>for ( 0 .. 1 ) {
>    my $nfr = $grab->capture( 1 - $frame, 640, 480 );
>
>I've been benchmarking, and it seems that the 2nd pass take much longer
>than the first.

Try it without it and see what happens. It is a mystery to me too.
It seems to have something with getting a sync for the image.

>
>second, could someone explain these calls to me?
>
>my $channel = $grab->channel(0);
>my $tuner   = $grab->tuner(0);
>$tuner->mode(1);
>$channel->norm(1);
>$tuner->set;
>$channel->set;
>
>It appears to me that first read the chanlel (and tuner ? what's a tuner?)
>The set them back?

From my memory of this" YMMV :-)  :
You may have to experiment with those lines. When I first wrote the
script, it wouldn't grab a frame unless the card was already initialized
with something like xawtv. That chunk of code was just copy'n'pasted
in and initializees the card to "ntsc" and "composite input".
channel(0) is composite input
$channel->mode(1) is ntsc
IIRC......

The tuner is for sound, if your card supports it. 
>
>And finally, if I want to use the 2nd capture card, I pass a 1 to the first
>2 calls, right?
>Thansk again for all the help on this!

It would seem so. :-)  I tried to experiment
You probably should try running the script with the lines in question
commented out, and see what you get.  Remember to test the case
of "first run" and see if it initializes the card.


Our body's 20 milligrams of beta radioactive Potassium 40
emit about 340 million neutrinos per day, which go at well-nigh
lightspeed to the ends of the universe!..even thru the earth. 


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

Date: Fri, 31 Oct 2003 09:53:12 -0500
From: zentara <zentara@highstream.net>
Subject: Re: Video::Capture example?
Message-Id: <fdt4qvg0duo3k0n6jlesbt5rek7qrr5d0g@4ax.com>

On Fri, 31 Oct 2003 01:21:35 +0000 (UTC), Stan Brown <stanb@panix.com>
wrote:

>In <bnsaik$1lh$1@reader2.panix.com> Stan Brown <stanb@panix.com> writes:
>
>>In <4u32qvgthijulq4baguj941i6a9jhr8g7p@4ax.com> zentara <zentara@highstream.net> writes:
>
>>>On Wed, 29 Oct 2003 15:15:27 +0000 (UTC), Stan Brown <stanb@panix.com>
>>>wrote:
>
>>>>I'm writing a perl script to capture images from some cameras, and make
>>>>mpes out of them on Linux.
>>>>
>
>Well the short version is, I have no idea how to make Videp::Capture use
>the 2nd card (/dev/video1). I suppose it hase to do with the new
>Video::Capture::V4l to create a new object. But with no docs, I could be
>guessing for a while :-(
>
>Anyone know the magic incatation Here?

Make sure you have your modules.conf setup right for your second card.
You can test it with xawtv. I've had alot of glitches when trying to
setup a modules.conf for 2 cards, especially if the cards are different.
Also watch out for your "second card" being assigned /dev/video0 and
the first card being /dev/video1.

>And nowing what magic numers to pass to what set-> routine to get composite
>video would be useful too.
The docs are not the best. Read the stuff in the kernel sources for
bttv, and probably actually read the Video::Capture::V4l module.
If in doubt.....just experiment with different numbers and note the
results. :-)   



Our body's 20 milligrams of beta radioactive Potassium 40
emit about 340 million neutrinos per day, which go at well-nigh
lightspeed to the ends of the universe!..even thru the earth. 


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

Date: Fri, 31 Oct 2003 16:34:04 +0100
From: Desmond Coughlan <pasdespam_desmond@zeouane.org>
Subject: Watching The ...
Message-Id: <c0ca71-1nf2.ln1@zeouane.org>

-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1

 ... 'How to tell what modules are installed?' thread, I couldn't find an
entry for 'perldoc -q installed' on my system, either.  Mention was then
made that 5.8.1 was the latest version, and upon checking, I have 5.8.0.

My Perl install seems to work perfectly, and if a script fails to run, it's
(so far) always been easy to trace it to my own idioc^H^H^Hinexperience.

The question is: as a newbie who's still struggling to get to grips with
hashes, arrays and regex, is it worth my while installing 5.8.1 ? 

Thanks.

- -- 
Desmond Coughlan               |desmond [at] zeouane [dot] org
http://www.zeouane.org/ 

-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: noconv

iQA/AwUBP6Jy22iD+5zjSqyTEQJ+igCg+lQWTRxopVJtErx0XRxps4Wn5z4An0/j
UXykwKdeQZGpHSzt3ZRArruU
=TpgZ
-----END PGP SIGNATURE-----


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

Date: Fri, 31 Oct 2003 16:57:57 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: What am I doing wrong?!
Message-Id: <pan.2003.10.31.12.11.38.141564@aursand.no>

On Fri, 31 Oct 2003 07:23:24 +0000, Ben Morrow wrote:
>> plus that it simply works better than writing 
>> 'for (my $i = 0..@array)'

> No. The problem there is nothing to do with for/foreach. foreach can
> in every single case be replaced with for.

I know that, but look at the actual code.  Maybe I'm misunderstanding
something here, but have tried this?

  my @array = qw( a b c d e f );
  for ( my $i = 0 .. @array ) {
      print $i . ' = ' . $array[ $i ] . "\n";
  }

Doesn't look nice to me.


-- 
Tore Aursand <tore@aursand.no>


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

Date: Fri, 31 Oct 2003 16:28:21 +0100
From: "Werner Winter" <werner.winter@asamnet.de>
Subject: which host
Message-Id: <bntv3v$6c1$01$1@news.t-online.com>

Hello,
I've setup a linux terminal server. Now I want to know, which user is logged
in on which host . So I wrote a perl-script named "which_host"

# which user
$uid=$<;
$username=(getpwuid)$uid))[0];
$username = $1;

#which host
@last= `/usr/bin/last -n 1 -a $username`;
# line 18
$host= (split (/\s+/, $last[0]))[9];

The last two lines cause an error: Use of uninitialized value in string eq
at /usr/local/bin/which_host line 18

The problem is, that "last" shows only 8 columns, no host in column 9 is
shown. If I change the line
@last= `/usr/bin/last -n 1 -a $username`;
 to
@last= `/usr/bin/last -n 3 -a $username`;
then I get 3 lines and in the third line the host is shown in column 9.

What can I do?

cu
Werner




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

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 5735
***************************************


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