[28888] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 132 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 13 00:10:17 2007

Date: Mon, 12 Feb 2007 21:09:05 -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           Mon, 12 Feb 2007     Volume: 11 Number: 132

Today's topics:
    Re: Accessing Access QoS@domain.invalid.com
    Re: bypass shell - pipe into child pid and receive otpu <uri@stemsystems.com>
    Re: bypass shell - pipe into child pid and receive otpu <wahab-mail@gmx.de>
        for rossie: dominating nntp server -  saf - (1/1) <mellick@manaical.us>
    Re: handling STDIN line by line in Gtk <news24@8439.e4ward.com>
        Hashes in subroutines? <dafass@ix.netcom.com>
    Re: Hashes in subroutines? <uri@stemsystems.com>
    Re: Hashes in subroutines? <DJStunks@gmail.com>
        Win32: Need the intact ARGV string <rss@idiom.com>
    Re: Win32: Need the intact ARGV string <uri@stemsystems.com>
        works now ! was: bypass shell - pipe into child pid and <wahab-mail@gmx.de>
    Re: works now ! was: bypass shell - pipe into child pid <rvtol+news@isolution.nl>
    Re: works now ! was: bypass shell - pipe into child pid <uri@stemsystems.com>
    Re: works now ! was: bypass shell - pipe into child pid <uri@stemsystems.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Mon, 12 Feb 2007 21:47:51 GMT
From: QoS@domain.invalid.com
Subject: Re: Accessing Access
Message-Id: <bg5Ah.2444$g82.1459@trndny09>


espie@lain.home (Marc Espie) wrote in message-id:
<eqqhgi$2fja$1@biggoron.nerim.net>
>
>In article <nn1Ah.2617$2%1.2205@trndny02>,  <QoS@domain.invalid.com> wrote:
>>
>>Hello, what would be a good module for accessing data contained in
>>a MS Access database file?  Are there any examples of doing this
>>that you know of?
>
>Depends what kind of platform you can use.
>
>If you are under Windows, DBD::ODBC will work wonders.
>
>If you `bridge' Windows <-> Unix, you can set up a DBI::ProxyServer on
>a windows box using DBD::ODBC, and talk to it from a DBD::Proxy on the Unix
>machine (works wonders, allows you to read and write stuff, the only problem
>I've had so far with it is that it cannot be used to dump schema via
>DBIx::Class::Schema::Loader).
>
>If you just have the Access file on a new windows machine, as far as I can
>tell, you can use commercial tools that I don't know quite well, or you can
>use a sourceforge project called mdbtools. The main catch with it is that
>they don't release very often, the official release does not read a lot
>of Access files correctly, and you will have to compile it from CVS.
>The end result is not a DBD driver, it's a bit more akward to use. And I
>wouldn't use it to write to the database...
>
>KDE also includes keximdb along its koffice suite. I have little experience
>with it, but it should be usable to convert access files.

Thank you very much for your enlightening reply.

The data system will be entirely stand-alone, the access database and the
perl script will run on the same system.

I've downloaded DBD::ODBC and it appears to be a solid solution for opening
these types of files, I'm just hoping that in the end this will be a cross-
platform solution.


Here is an example from the DBD::ODBC POD

    Connect without DSN The ability to connect without a full DSN is
    introduced in version 0.21.
        Example (using MS Access): my $DSN = 'driver=Microsoft Access Driver
        (*.mdb);dbq=\\\\cheese\\g$\\perltest.mdb'; my $dbh =
        DBI->connect("dbi:ODBC:$DSN", '','') or die "$DBI::errstr\n";

I would like to know if this or something similar to this will work on
both the linux, and windows platforms?




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

Date: Mon, 12 Feb 2007 16:13:25 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: bypass shell - pipe into child pid and receive otput
Message-Id: <x7y7n3ulje.fsf@mail.sysarch.com>

>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:

  SP> Mirco's version which used qx[] used '-' as the input filename. It worked,
  SP> but used an "echo '$input'" to provide the input to htmldoc's stdin. I
  SP> assumed the '-' worked because of shell expansion, and that he'd omitted
  SP> it from the open2() version because he was using the multi-arg form and
  SP> bypassing the shell.

on reexamination of his code it does seem to support - for stdin and he
was echoing in the html and not the filename. so it does seem like a
problem with his use of open2. and i think i have found the bug.

    my @args = qw' --webpage --quiet -t pdf14 ';

     if(1) { # this works o.k. after removing \' from the html stream
        return  qx{echo -e '$ht' | $prog @args -}
     }
     else { # this will wait forever
        use IPC::Open2;
        my($chld_out, $chld_in);
        my $childpid  = open2($chld_out, $chld_in, $prog, @args)
                        or die "can't open pipe to $prog: $!";
        print $chld_in $ht;
        close $chld_in;
        my $pdf; do { local $/; $pdf = <$chld_out> };

in the qx version he has - there for the input file but in the open2
version he only the @args which doesn't have - in them. so i bet the
open2 worked but the htmldoc program barfed on no input file and
exited. he should check close for an error there.

also to make it faster, use syswrite instead of print and possibly
file::slurp instead of the slower $/ trick. it will make the code
cleaner too. also i declared the handles in the open2 call to save a
line. untested:

	use File::Slurp ;
        my $childpid  = open2(
			my $chld_out, my $chld_in, $prog, @args, '-' )
                        or die "can't open pipe to $prog: $!";

	syswrite( $chld_in, $ht ) ;
	close $chld_in or die "close error from open2 $!" ;
	my $pdf = read_file( $chld_out ) ;

the open2 docs state that a list of args will bypass the shell as well
which is similar to how system/exec do that. so that should not call a
shell.

and the OP should tell the authors of htmldoc to document that - works
for reading from stdin (if it truly works!).

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Tue, 13 Feb 2007 00:51:41 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: bypass shell - pipe into child pid and receive otput
Message-Id: <eqqush$npr$1@mlucom4.urz.uni-halle.de>

Uri Guttman wrote:
> in the qx version he has - there for the input file but in the open2
> version he only the @args which doesn't have - in them. so i bet the
> open2 worked but the htmldoc program barfed on no input file and
> exited. he should check close for an error there.

After I added '-' to the args list, it *still* didn't
work (at first)- of course until I tried it then from the
command line, and then under cgi-mode. Bummer. No mod_perl.

Thanks for the '-' hint.

> also to make it faster, use syswrite instead of print and possibly
> file::slurp instead of the slower $/ trick. it will make the code
> cleaner too. also i declared the handles in the open2 call to save a
> line. untested:

Now I have to choose between perl/cgi and 'echoing'
it through the shell, I'll do (go back to) the latter, it
turns out to be very simple (in comparison):

  ...
  {
   my $html = get_big_html_chunk_from_somewhere();
   $html =~ s/'/&acute;/g;

   my $prog = '/usr/bin/htmldoc';
   my @args = qw'--webpage --quiet -t pdf14 -';

   return qx{echo '$html' | $prog @args}
  }
  ...

I found out (hope so), echo wouldn't escape
anything - so this sould be safe (imho).

> and the OP should tell the authors of htmldoc to document that - works
> for reading from stdin (if it truly works!).

There's (at least) one little paragraph in the
docs where it appears to be properly mentioned
(http://www.htmldoc.org/documentation.php/CallingHTMLDOCfromC.html):

<quote>
     ...
     Here are some simple C functions that can be used
     to generate a PDF report to the HTTP client from a
     temporary file or pipe:
     ...
     puts("Content-Type: application/pdf\n");
     /*
      * Open a pipe to HTMLDOC...
      */
     return (popen("htmldoc --quiet -t pdf --webpage -", "w"));
     ...
</quote>


Thank you & regards

Mirco


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

Date: 12 Feb 2007 23:03:16 GMT
From: rusty <mellick@manaical.us>
Subject: for rossie: dominating nntp server -  saf - (1/1)
Message-Id: <768H8228939E1q365921756R2g52464644X764568321a352214Q@news.manaical.us>

I have to share!

One thing I love about them, they don't keep log files of the news I read or files I download.
With some of the fastest connections around it's no wonder people love it and keep coming back.
Images, video, mp3 music, the real news from around the world... it's all inside waiting for you.
They give you access to some of the best groups others may not carry.
Take a look at all the great features below and imagine! You'll LOVE it.
Take a look, I know you'll love it as much as I do.
You can find almost anything you are looking for.
They offer some of the best premium newsgroup access anywhere.

Posting allowed!
2,000,000 new posts each day
Very long retention
800 GIGS of new multimedia content each day

Just go to newsdude.net - they're amazing.


Kovti wolzu
 ...


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

Date: Tue, 13 Feb 2007 00:06:50 +0100
From: Michael Goerz <news24@8439.e4ward.com>
Subject: Re: handling STDIN line by line in Gtk
Message-Id: <53ca8dF1rnkpcU1@mid.uni-berlin.de>

zentara wrote:
> On Sun, 11 Feb 2007 23:39:31 +0100, Michael Goerz
> <news24@8439.e4ward.com> wrote:
> 
>> This really seems tricky...
>> Michael
> 
> Here is the best way I found. It avoids the hacking of
> the 1024 byte boundary on the input chunks.
> 
> One other thing, don't put
> a sleep call in any gui apps, because it blocks the gui.
> If you want to slow down  the display of the blocks appearing 
> on the drawing area, push the data into and array, and call
> a timer to shift them off, one at a time, and display them.

Thanks so much for your answer! Your last comment actually provided the
solution: I use the stdin_handler only to read input and store
everything into a global array, and the I can have a timeout that shifts
off one line from that array once every interval. This way, the
animation of the data is it comes in is drawn out on the screen, just
like I intended it to be.

Thanks,
Michael


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

Date: Mon, 12 Feb 2007 21:48:18 -0500
From: David Fass <dafass@ix.netcom.com>
Subject: Hashes in subroutines?
Message-Id: <120220072148180336%dafass@ix.netcom.com>


Ok, stupid question...probably has a really stupid answer that    I
can't see..
Here's the scenerio I'm pulling data from a database for different time
periods...so I set up a series of hashes in a subrutine...

Sorta like this ....

sub foo($$$$){
   my %hash1 = {};
   my %hash2 = {};
   my %hash3 = {};
#...pull out data..populate hash1 and hash2 ....#
# e.g if ($sx eq "M"){ $hash2{$age}++;}
foreach $key ( sort keys %hash1){
   $hash3->{$key}++;
}
foreach $key (sort keys %hash2){
   $hash3->{$key}++;
}
foreach $x (sort keys %{$hash3}){
   print "$x\t$hash1{$x}\t$hash2{$x}\n";
}

Now the bugger is that I get phantom keys and wierd 0's....
e.g hypothetically if hash1 is supposed to contain undef for iteration
1, 22 and 38 for iteration 2, and 46 and 78 for iteration 3...
I'd get output for iteration 3
22 0 0
38 0 0
46 1 0
78 0 1
0 0 0
0 0 0
0 0 0

dumping the hash1 and hash2 using Data:::dump I'd get
hash1 (46,1,HASH(XXXX),undef);
hash2(78,1,HASH(XXXX),undef);

Now how do I zero the hash, including the keys...
since I keep getting the old keys from previous iterations.

In a test file I tried using undef(%hash) and %hash=() with similar
results.

}


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

Date: Mon, 12 Feb 2007 22:39:09 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Hashes in subroutines?
Message-Id: <x7wt2msp41.fsf@mail.sysarch.com>


< removed comp.lang.perl which is a VERY dead group no matter what your
server says.>

>>>>> "DF" == David Fass <dafass@ix.netcom.com> writes:

  DF> Ok, stupid question...probably has a really stupid answer that    I
  DF> can't see..
  DF> Here's the scenerio I'm pulling data from a database for different time
  DF> periods...so I set up a series of hashes in a subrutine...

  DF> Sorta like this ....

  DF> sub foo($$$$){

don't use prototypes. they don't do what you think they do. 


  DF>    my %hash1 = {};
  DF>    my %hash2 = {};
  DF>    my %hash3 = {};

{} is wrong and not even needed. if you had warnings enabled (use
warnings) perl would have told you something about those lines.

  DF> #...pull out data..populate hash1 and hash2 ....#
  DF> # e.g if ($sx eq "M"){ $hash2{$age}++;}
  DF> foreach $key ( sort keys %hash1){
  DF>    $hash3->{$key}++;
  DF> }

that is the scalar $hash3 and NOT the hash %hash3. please read
perlreftut and learn about the differences. you declared a hash but are
using a hash reference.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 12 Feb 2007 19:44:44 -0800
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Hashes in subroutines?
Message-Id: <1171338284.520412.75930@j27g2000cwj.googlegroups.com>

On Feb 12, 7:48 pm, David Fass <daf...@ix.netcom.com> wrote:
> Ok, stupid question...probably has a really stupid answer that    I
> can't see..
> Here's the scenerio I'm pulling data from a database for different time
> periods...so I set up a series of hashes in a subrutine...
>
> Sorta like this ....
>
> sub foo($$$$){
>    my %hash1 = {};
>    my %hash2 = {};
>    my %hash3 = {};
> #...pull out data..populate hash1 and hash2 ....#
> # e.g if ($sx eq "M"){ $hash2{$age}++;}
> foreach $key ( sort keys %hash1){
>    $hash3->{$key}++;}
>
> foreach $key (sort keys %hash2){
>    $hash3->{$key}++;}
>
> foreach $x (sort keys %{$hash3}){
>    print "$x\t$hash1{$x}\t$hash2{$x}\n";
>
> }
>
> Now the bugger is that I get phantom keys and wierd 0's....
> e.g hypothetically if hash1 is supposed to contain undef for iteration
> 1, 22 and 38 for iteration 2, and 46 and 78 for iteration 3...
> I'd get output for iteration 3
> 22 0 0
> 38 0 0
> 46 1 0
> 78 0 1
> 0 0 0
> 0 0 0
> 0 0 0
>
> dumping the hash1 and hash2 using Data:::dump I'd get
> hash1 (46,1,HASH(XXXX),undef);
> hash2(78,1,HASH(XXXX),undef);
>
> Now how do I zero the hash, including the keys...
> since I keep getting the old keys from previous iterations.
>
> In a test file I tried using undef(%hash) and %hash=() with similar
> results.
>
> }

you have an error on line 42.

-jp



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

Date: Tue, 13 Feb 2007 02:39:11 -0000
From: "Richard S. Smith" <rss@idiom.com>
Subject: Win32: Need the intact ARGV string
Message-Id: <1171334350.524954@smirk>

I am debugging an application under Windows 2003 that calls a Perl script
for logging purposes.  The log string looks something like this:

call_type: I alert_id: "29 " data_center: "LA "

I am using a Perl script as the target of this execution, but the trick is
that I need to see the *intact* string that is being passed.  By the time
Perl has turned that line into @ARGV the double quotes are gone.

I need to know if there is a way to make perl show me what the OS is
passing it, before the ARGV processing takes place.  Using join and @ARGV
to reconstruct the sting is not an acceptable solution for this particular
problem.

Before anyone tells me the OS is removing the double quotes before Perl can
see them, know that if I use a windows .bat and echo the %* variable, I get
the whole line.  I need to know if Perl can do that same thing, or not.

If it turns out that NT batch language can do something Perl can't, I'm
going to get some ribbing from my co-workers, so I hope someone can help
me out here.

Thanks, as always.


-- 
 Richard S. Smith / Email: rss@idiom.com / Web: http://www.rssnet.org/
--


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

Date: Mon, 12 Feb 2007 22:35:39 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Win32: Need the intact ARGV string
Message-Id: <x73b5au3uc.fsf@mail.sysarch.com>

>>>>> "RSS" == Richard S Smith <rss@idiom.com> writes:

  RSS> I am debugging an application under Windows 2003 that calls a Perl script
  RSS> for logging purposes.  The log string looks something like this:

  RSS> call_type: I alert_id: "29 " data_center: "LA "

  RSS> I am using a Perl script as the target of this execution, but the
  RSS> trick is that I need to see the *intact* string that is being
  RSS> passed.  By the time Perl has turned that line into @ARGV the
  RSS> double quotes are gone.

perl does not do any processing of @ARGV. i don't know where you got
that idea. shells often do such parsing and their interaction with perl
can be slightly tricky regarding quotes and words.

  RSS> I need to know if there is a way to make perl show me what the OS
  RSS> is passing it, before the ARGV processing takes place.  Using
  RSS> join and @ARGV to reconstruct the sting is not an acceptable
  RSS> solution for this particular problem.

this is not a perl problem. 

  RSS> Before anyone tells me the OS is removing the double quotes
  RSS> before Perl can see them, know that if I use a windows .bat and
  RSS> echo the %* variable, I get the whole line.  I need to know if
  RSS> Perl can do that same thing, or not.

that is definitely not a perl problem. repeat until blue in the face.

  RSS> If it turns out that NT batch language can do something Perl can't, I'm
  RSS> going to get some ribbing from my co-workers, so I hope someone can help
  RSS> me out here.

prepare thyself for ribbing. this is not a perl problem. you have
different environments/shells calling the perl program and they handle
quoting differently.

one more time. perl never mungs the contents of @ARGV. it contains what
the OS passes to it. how the perl program gets called can affect what
gets passed to it. it is not a perl problem.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Tue, 13 Feb 2007 00:23:24 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: works now ! was: bypass shell - pipe into child pid and receive otput
Message-Id: <eqqt7c$n9n$1@mlucom4.urz.uni-halle.de>

Sherm Pendley wrote:
> xhoster@gmail.com writes:
>> Mirco Wahab <wahab-mail@gmx.de> wrote:
>>
>>>         print $chld_in $ht;
>>>         close $chld_in;
>>>         my $pdf; do { local $/; $pdf = <$chld_out> };
>> You may have a buffering/deadlock problem here, assuming $prog starts
>> producing output before it completely reads its input.
> 
> I'm not certain that's a valid assumption in this case. The job of this
> program is to take HTML input and produce PDF output. I don't think it
> could do that without first reading all of its input. One can, for example,
> include an inline style attribute on the very last p element in the HTML
> body, that positions it at the top of the rendered page.

Thank you all for your valuable help. I stripped down the program
to the problem and solved it somehow with the help and input from
this group.

1) the program used is the 'open source' htmldoc 1.9
    (http://www.htmldoc.org/software.php)
2) it works(!) as intended (IPC::open2, no shell) via '-'
    in old fashioned 'cgi-Mode' but *NOT* under mod-perl!
    (I didn't consider this one)

The following is now a perfectly working program:
<cat /cgi-bin/convert.pl>

#!/usr/bin/perl
  use strict;
  use warnings;
  use IPC::Open2;

  my $html = q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml">
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
   <title>Untitled Document</title>
   </head><body><h1>PDF it is!</h1>
   <p style="height:400px;width:400px;border:blue 1px solid;overflow:hidden;">
   Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam sodales, mauris
   et consequat condimentum, nisi enim rhoncus nulla, a vulputate arcu ligula non
   tortor. Praesent sem. </p></body></html>
  };

  print "Content-type: application/pdf\n\n"; # print "Content-type: text/html\n\n";
  select(STDOUT);  $| = 1;   # don't buffer
  $ENV{HTMLDOC_NOCGI} = 1;   # used _as_a_program_ *from* a cgi

  my $prog = '/usr/bin/htmldoc';
  my @args = qw'--webpage --quiet -t pdf14 -';

  my ($chld_out, $chld_in, $childpid);
  $childpid  = open2($chld_out, $chld_in, $prog, @args)
               or die "can't open pipe to $prog: $!";
  print $chld_in $html;
  close $chld_in;
  my $pdf; do { local $/; $pdf = <$chld_out> };
  close $chld_out;
  waitpid $childpid, 0;
  print $pdf;

</>

In my trials before - it bailed because of the mod_perl
environment (I guess), something the program didn't like
(don't really know what).

In the end, the program is a nice solution for
on-the-fly generation of pdf.

Thanks to all people involved (Anno, Ilya, Uri, Xho)

Regards

Mirco


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

Date: Tue, 13 Feb 2007 04:51:59 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: works now ! was: bypass shell - pipe into child pid and receive otput
Message-Id: <eqrg6h.190.1@news.isolution.nl>

Uri Guttman schreef:
> Mirco Wahab:

>>   my $pdf; do { local $/; $pdf = <$chld_out> };
>
> the do can be simpler if you want that slurp style:
>
> my $pdf = do { local $/; <$chld_out> };
>
> do blocks return their last evaluated expression so you can remove the
> extra mention of $pdf.

But know that it uses more memory. Example:

#!/usr/bin/perl
  use strict;
  use warnings;

  our $VERSION = q$Id: 0.00 $ =~ /[\d.]+/msx;

  print_mem();

  my $data = q{x} x (100 * 1024 * 1024); # 100 MB
  print_mem();

  open my $fh, '<', \$data;

  if (@ARGV) {
    my $pdf1; do { $pdf1 = <$fh> };
  }
  else {
    my $pdf2 = do { <$fh> };
  }

  print_mem();
  exit 0;

sub print_mem { # BSD specific?
  my (undef, $file, $line) = caller;
  $file =~ s~ .*/ ~~msx;

  if (open my $fh, q{<}, q{/proc/curproc/map}) {
    while (<$fh>) {
      (split)[2] > 100 and print qq{$file:$line $_};
    }
  }
  print qq{===\n};
  return;
}

-- 
Affijn, Ruud

"Gewoon is een tijger."



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

Date: Mon, 12 Feb 2007 18:57:06 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: works now ! was: bypass shell - pipe into child pid and receive otput
Message-Id: <x7tzxrsze5.fsf@mail.sysarch.com>

>>>>> "MW" == Mirco Wahab <wahab-mail@gmx.de> writes:

  MW>   my $prog = '/usr/bin/htmldoc';
  MW>   my @args = qw'--webpage --quiet -t pdf14 -';

this time you put the - in @args which you didn't before. i think it was
your primary bug.

  MW>   my ($chld_out, $chld_in, $childpid);
  MW>   $childpid  = open2($chld_out, $chld_in, $prog, @args)
  MW>                or die "can't open pipe to $prog: $!";
  MW>   print $chld_in $html;
  MW>   close $chld_in;
  MW>   my $pdf; do { local $/; $pdf = <$chld_out> };

see my notes on this code. you can declare the handles inside the open2
call. use syswrite for speed. and the do can be simpler if you want that
slurp style:

	my $pdf = do { local $/; <$chld_out> };

do blocks return their last evaluated expression so you can remove the
extra mention of $pdf.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: Mon, 12 Feb 2007 23:40:54 -0500
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: works now ! was: bypass shell - pipe into child pid and receive otput
Message-Id: <x7sldasm95.fsf@mail.sysarch.com>

>>>>> "R" == Ruud  <rvtol+news@isolution.nl> writes:

  R> Uri Guttman schreef:
  >> 
  >> the do can be simpler if you want that slurp style:
  >> 
  >> my $pdf = do { local $/; <$chld_out> };

  R> But know that it uses more memory. Example:

but i would use file::slurp anyhow. and speed is usually more important
than ram these days. :)

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

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


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