[17306] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4728 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 26 06:05:33 2000

Date: Thu, 26 Oct 2000 03:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <972554711-v9-i4728@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Thu, 26 Oct 2000     Volume: 9 Number: 4728

Today's topics:
    Re: [Newbie]: Perl and Cron <sferrandez@wineandco.com>
    Re: aboutSound..just curious :) <martin.quensel@lmf.ericsson.se>
        another perl syntax question. <hugo@fractalgraphics.com.au>
    Re: another perl syntax question. (Bernard El-Hagin)
    Re: another perl syntax question. <xerxes_2k@my-deja.com>
        bidirectional communication <AndreasKleiner@compuserve.de>
    Re: CGI.pm form parameters initialization question (pro (Ulrich G. Wortmann)
        complex (for me anyway) rexexp <brondsem@my-deja.com>
    Re: complex (for me anyway) rexexp (Chris Fedde)
    Re: complex (for me anyway) rexexp <brondsem@my-deja.com>
    Re: complex (for me anyway) rexexp <stephenk@cc.gatech.edu>
    Re: complex (for me anyway) rexexp (Tad McClellan)
    Re: complex (for me anyway) rexexp <ianb@ot.com.au>
    Re: Confused about behavior of sort command with functi <lincmad001@telecom-digest.zzn.com>
    Re: File locking <mikecook@cigarpool.com>
        get the second line out of a file ?????? (Christopher James)
    Re: get the second line out of a file ?????? (Bernard El-Hagin)
    Re: Grep and cut associated data ? New at this ! HELP msalerno@my-deja.com
    Re: Grep and cut associated data ? New at this ! HELP <ianb@ot.com.au>
    Re: Grep and cut associated data ? New at this ! HELP (Tad McClellan)
    Re: How to open and read PDF file <tward10@jaguar.com>
        How to output to printer <ra_jones@my-deja.com>
    Re: How to output to printer <josef.moellers@fujitsu-siemens.com>
    Re: htacces <hermann@webfuersorge.de>
    Re: IO::Socket, HTTP POST vs. GET <uri@sysarch.com>
    Re: Legal email addresses... <gellyfish@gellyfish.com>
    Re: Linux: Perl readline... (Martien Verbruggen)
    Re: MS Access via Perl under Linux <gellyfish@gellyfish.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 26 Oct 2000 11:00:11 +0200
From: =?iso-8859-1?Q?S=E9bastien?= Ferrandez <sferrandez@wineandco.com>
Subject: Re: [Newbie]: Perl and Cron
Message-Id: <39F7F29B.59AEB2F1@wineandco.com>



Ian Boreham wrote:

> Sébastien Ferrandez wrote:
>
> Is there more in the error message?

Well the line indicated as wrong is that of the "use"s...But I guess the problem
comes from somewhere else.

> Is the cron job being run as the same user?

Yes it is.




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

Date: Thu, 26 Oct 2000 10:06:58 +0300
From: Martin Quensel <martin.quensel@lmf.ericsson.se>
Subject: Re: aboutSound..just curious :)
Message-Id: <39F7D812.E2CDDCA5@lmf.ericsson.se>



Onegin wrote:

> Hello comp. geeks and guys, I just want to ask something thats not
> technical, when you in front of your computer for hours, do you often listen
> music or radio? if not, why? if is, what music? loud, piano, newage,
> instrumental, hotmetal, classic, etc.?
>
> rgd. Onegin
>
> ... remember to sleep X-)

No, i do not listen to radio...
Why listen to radio when i can send my scripts to /dev/audio ?
Beautiful music ..... But the songs usually tend to be quite short...




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

Date: Thu, 26 Oct 2000 17:26:57 +0800
From: Hugo Bouckaert <hugo@fractalgraphics.com.au>
Subject: another perl syntax question.
Message-Id: <39F7F8E1.FA8B3799@fractalgraphics.com.au>

Hi All

What does .= refer to? I have lines in a perl script like: 

$query .= "\t$lead $field = $emailid\n";

where I think $query is a query to a mysql database. 

The most important thing I would like to know is what ".=" stands for. 
None of my reference books list it as an operator or as anything else. 

Thanks

Hugo 

-- 
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics 
39 Fairway, Nedlands Western Australia 6009
Tel: +618 9386 7917
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au


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

Date: 26 Oct 2000 09:34:35 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: another perl syntax question.
Message-Id: <slrn8vfuoe.28m.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 26 Oct 2000 17:26:57 +0800, Hugo Bouckaert
<hugo@fractalgraphics.com.au> wrote:
>Hi All
>
>What does .= refer to? I have lines in a perl script like: 
>
>$query .= "\t$lead $field = $emailid\n";
>
>where I think $query is a query to a mysql database. 
>
>The most important thing I would like to know is what ".=" stands for. 
>None of my reference books list it as an operator or as anything else. 

It's the equivalent to:

$query = $query . "\t$lead $field = $emailid\n";

In effect the text in between "'s is appended to whatever was in $query.

For more:

perldoc perlop

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: Thu, 26 Oct 2000 09:52:25 GMT
From: arse <xerxes_2k@my-deja.com>
Subject: Re: another perl syntax question.
Message-Id: <8t8uso$42v$1@nnrp1.deja.com>



$string1.=$string2   means do a string join on $string1 and $string2 and
store it in $string1


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 09:30:04 +0000
From: AndreasKleiner <AndreasKleiner@compuserve.de>
Subject: bidirectional communication
Message-Id: <39F7F99C.4D1F347F@compuserve.de>

Hello all,

I have a C-program which takes multi-line input and produces multi-line
output. I have to run it in the background - as it compiles some info
into the memory which takes some seconds - and now and then feed it with
input and read and interpret the output - with some perl-skript of
course.

Under which headwords do I have to look for a solution:

IPC::Open2

Pipes

fork

other ?

Thanks for your help,

Andreas


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

Date: 26 Oct 2000 10:26:12 +0200
From: uliw@erdw.ethz.ch (Ulrich G. Wortmann)
Subject: Re: CGI.pm form parameters initialization question (probably silly)
Message-Id: <m3wvewqa8r.fsf@bonk.ethz.ch>

Hey Jay,

> > routine), and check the contents of $q->param() none of the data I
> > entered is found on the parameter list, only the default values.
> 
> CGI.pm form fields have "sticky" behaviour. Try using the -force=>1
> property. i.e.
> print textfield(-name=>$name, -value=>$value, -force=>1);

thanks, but that doesn't help either.. I'm going to repost the problem
in the cgi authoring group.

        Cheers
        
                Uli

-- 
	Uli Wortmann
	Dept. of Geology       Fax (Switzerland) (1) 632  1030
	ETH-Zuerich            Fon                        3694
        Visit the SPOC-team at http://www.spoc.ethz.ch


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

Date: Thu, 26 Oct 2000 04:19:39 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: complex (for me anyway) rexexp
Message-Id: <8t8bcm$lfb$1@nnrp1.deja.com>




I have a string and I want to change every ", " to " . " if the ", " is
between "print" and ";".  I have some experience with regexps, but I
haven't done anything like this before.

The closest I have so far is:
$content =~ s/print([.]*?);/print ;/gomi;

but I obviously need a ", " somewhere on the left and " . " on the
right but I don't know where to put it.


Here's an example of input/output:

__INPUT__
$x = 2;
print "hello", $x, "goodbye";

__OUTPUT__
$x=2
print "hello" . $x . "goodbye";



--
Dave Brondsema


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 04:42:37 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: complex (for me anyway) rexexp
Message-Id: <1DOJ5.163$7rc.170631168@news.frii.net>

In article <8t8bcm$lfb$1@nnrp1.deja.com>,
Dave Brondsema  <brondsem@my-deja.com> wrote:
>
>
>
>I have a string and I want to change every ", " to " . " if the ", " is
>between "print" and ";".  I have some experience with regexps, but I
>haven't done anything like this before.
>
>The closest I have so far is:
>$content =~ s/print([.]*?);/print ;/gomi;
>
>but I obviously need a ", " somewhere on the left and " . " on the
>right but I don't know where to put it.
>
>
>Here's an example of input/output:
>
>__INPUT__
>$x = 2;
>print "hello", $x, "goodbye";
>
>__OUTPUT__
>$x=2
>print "hello" . $x . "goodbye";
>

Maybe I'm missing something but...

while(<DATA>)
{
    /print/ and s/,/./g;
    print;
}
__END__
$x = 2;
print "hello", $x, "goodbye";

-- 
    This space intentionally left blank


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

Date: Thu, 26 Oct 2000 05:16:38 GMT
From: Dave Brondsema <brondsem@my-deja.com>
Subject: Re: complex (for me anyway) rexexp
Message-Id: <8t8enj$nt6$1@nnrp1.deja.com>

In article <1DOJ5.163$7rc.170631168@news.frii.net>,
  cfedde@fedde.littleton.co.us (Chris Fedde) wrote:
> In article <8t8bcm$lfb$1@nnrp1.deja.com>,
> Dave Brondsema  <brondsem@my-deja.com> wrote:
> >
> >
> >
> >I have a string and I want to change every ", " to " . " if the ", "
is
> >between "print" and ";".  I have some experience with regexps, but I
> >haven't done anything like this before.
> >
> >The closest I have so far is:
> >$content =~ s/print([.]*?);/print ;/gomi;
> >
> >but I obviously need a ", " somewhere on the left and " . " on the
> >right but I don't know where to put it.
> >
> >
> >Here's an example of input/output:
> >
> >__INPUT__
> >$x = 2;
> >print "hello", $x, "goodbye";
> >
> >__OUTPUT__
> >$x=2
> >print "hello" . $x . "goodbye";
> >
>
> Maybe I'm missing something but...
>
> while(<DATA>)
> {
>     /print/ and s/,/./g;
>     print;
> }
> __END__
> $x = 2;
> print "hello", $x, "goodbye";

I also want it to work for something like:

print myfunc($test),
"hello",
$x,
"\n";


> --
>     This space intentionally left blank
>

--
Dave Brondsema


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 01:36:28 -0400
From: Stephen Kloder <stephenk@cc.gatech.edu>
Subject: Re: complex (for me anyway) rexexp
Message-Id: <39F7C2DB.BD4AF12F@cc.gatech.edu>

Dave Brondsema wrote:

> I have a string and I want to change every ", " to " . " if the ", " is
> between "print" and ";".  I have some experience with regexps, but I
> haven't done anything like this before.
>
> The closest I have so far is:
> $content =~ s/print([.]*?);/print ;/gomi;
>
> but I obviously need a ", " somewhere on the left and " . " on the
> right but I don't know where to put it.
>
> Here's an example of input/output:
>
> __INPUT__
> $x = 2;
> print "hello", $x, "goodbye";
>
> __OUTPUT__
> $x=2
> print "hello" . $x . "goodbye";
>

1 while $content =~ s/(print.*),(.*;)/$1.$2/i;

perldoc perlre
perldoc perlop
--
Stephen Kloder               |   "I say what it occurs to me to say.
stephenk@cc.gatech.edu       |      More I cannot say."
Phone 404-874-6584           |   -- The Man in the Shack
ICQ #65153895                |            be :- think.




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

Date: Thu, 26 Oct 2000 01:09:33 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: complex (for me anyway) rexexp
Message-Id: <slrn8vff4d.e43.tadmc@magna.metronet.com>

On Thu, 26 Oct 2000 04:19:39 GMT, Dave Brondsema <brondsem@my-deja.com> wrote:
>
>
>I have a string and I want to change every ", " to " . " if the ", " is
>between "print" and ";".  I have some experience with regexps, 


And you still throw options on whilly nilly?

You should only use options when you _need_ to use options.


>$content =~ s/print([.]*?);/print ;/gomi;

'g' is good, probably

'o' is worthless, since there are no variables in your pattern

'm' is worthless, since there are no anchors in your pattern

'i' is probably not needed, unless you also want to find
    stuff between "PRINT" and a semicolon.


Why are you trying to match zero or more dot characters
following "print"?


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 26 Oct 2000 17:20:49 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: complex (for me anyway) rexexp
Message-Id: <39F7CD40.F9576C1D@ot.com.au>

Dave Brondsema wrote:

> In article <1DOJ5.163$7rc.170631168@news.frii.net>,
> > >I have a string and I want to change every ", " to " . " if the ", "
> is
> > >between "print" and ";".  I have some experience with regexps, but I
> > >haven't done anything like this before.
> > >
> > >The closest I have so far is:
> > >$content =~ s/print([.]*?);/print ;/gomi;

This is a problem that crops up in many guises. Depending on what sort of
approximations you want to make, your solution can be either a simple
substitution in a loop, or an equivalent of the perl interpreter.

Your version, by the way, is not going to work .(Incidentally, did you
know "gomi" is Japanese for garbage? Just thought you might like to know.)
The /g is only going to match each "print" once, so in order to match
several commas in a single print statement, you'll need to loop or find a
way of expressing the idea differently.

> I also want it to work for something like:
>
> print myfunc($test),
> "hello",
> $x,
> "\n";

But what about cases like:

  print STDERR "Big problem; errcode = ", $err, "; Unable to print
value\n";

or

  print join(", ", ($a, $b, $c)) . "\n";

etc?

You were right to classify it as a complex regex problem, and you will
need to decide how detailed you want the solution to be. If you assume
that all print statements are going to contain no semicolons or "print"
words, and the commas will only be those of the print statement itself,
you will have a relatively easy task:

#!/usr/bin/perl

undef $/;

$data = <DATA>;
print "DATA: $data";

$data =~ s/(print[^;]*;)/$rep = $1;$rep =~ s%,% .%g;$rep/eg;
print "RESULTS:\n$data\n";

__END__
$x = 2;
print "hello", $x, "goodbye";
#random unaffected comment line

print myfunc($test),
"hello",
$x,
"\n";

sort (@blah, $a, $b);

print "hi ",$a,

    "\n";


I'll leave the exact fiddling of whitespace around the "."s to you.

Regards,


Ian




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

Date: Wed, 25 Oct 2000 22:04:17 -0700
From: Linc Madison <lincmad001@telecom-digest.zzn.com>
Subject: Re: Confused about behavior of sort command with function returning list
Message-Id: <251020002204173510%lincmad001@telecom-digest.zzn.com>

In article <8t7qp3$j1t@bofh.physics.umd.edu>, Thomas M. Payerle
<payerle@Glue.umd.edu> wrote:

> I encountered some rather unexpected behavior from Perl's sort
> command when trying to sort the return values of a subroutine
> returning a list.  Since the perl language interface is usually quite
> intuitive, I was wondering if someone could enlighten me as to perl
> is not behaving as I would have expected (or alternatively, why I
> should have been expecting what it did:)

Well, start by reducing the problem to the barest elements:

-------------
#! perl -w

sub foo { return ( "c", "a", "d", "b" ) }

print sort( foo() );
print "\n\n";
-------------

I think that will give you a pretty good clue.


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

Date: Wed, 25 Oct 2000 23:43:31 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: File locking
Message-Id: <MoQJ5.3210$EA3.438931@news.uswest.net>

Because other programs (vi, etc.) do not honor file locking.
    Michael
--
== CigarPool ==
http://www.cigarpool.com

"Alan Barclay" <gorilla@elaine.furryape.com> wrote in message
news:972527319.948906@elaine.furryape.com...
> In article <8t0ugq$sb2$1@provolone.cs.utexas.edu>,
> Logan Shaw <logan@cs.utexas.edu> wrote:
> >There's yet another way of doing it.
> >
> >When writing, lock the file.
> >
> >When reading, don't lock the file.  Instead, check the modification
> >time on the file and make sure it's in the past.  Then, read the file.
> >Then, check the modification time again.  If it hasn't changed, great.
> >
> >If it has, then discard everything you've read from it.  Then, wait for
> >an appropriate period of time, and start the whole process over again.
> >How do you know how long to wait?  You can either sleep for a random
> >length of time, or (better) put a blocking shared lock on the file and
> >then immediately unlock it when you succeed in locking it.
>
>
> This seems like a lot of hassle to avoid locking, and not gauranteed
> to ever complete. Why not just lock the file and be done with it?
>




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

Date: Thu, 26 Oct 2000 20:10:01 GMT
From: chris@hitsquad.com (Christopher James)
Subject: get the second line out of a file ??????
Message-Id: <39f88e92.14943903@news.one.net.au>

Hi all ,
How do you get the second line out of a file using  $_ by NOT using a
loop ????

I want to throw the first line into an array , split this array in to
fields... then grab the second line and put that into another array..
and split this one into fields as well then i want to compare certain
fields....

i need to like force $_ to grab the next line for the second array....
becaue all i am getting the first line in the second array all the
time.
Any Idea's ???

Thanx in advance



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

Date: 26 Oct 2000 09:00:22 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: get the second line out of a file ??????
Message-Id: <slrn8vfso8.28m.bernard.el-hagin@gdndev25.lido-tech>

On Thu, 26 Oct 2000 20:10:01 GMT, Christopher James <chris@hitsquad.com>
wrote:
>Hi all ,
>How do you get the second line out of a file using  $_ by NOT using a
>loop ????
>
>I want to throw the first line into an array , split this array in to
>fields... then grab the second line and put that into another array..
>and split this one into fields as well then i want to compare certain
>fields....
>
>i need to like force $_ to grab the next line for the second array....
>becaue all i am getting the first line in the second array all the
>time.

my $first_line  = <FILE>;

#do whatever with that line

my $second_line = <FILE>;

Cheers,
Bernard
--
perl -le'
($B,$e,$r,$n,$a,$r,$d)=q=$B$e$r$n$a$r$d==~m;
\$(.);xg;print$B.$e.$r.$n.$a.$r.$d;'


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

Date: Thu, 26 Oct 2000 04:18:57 GMT
From: msalerno@my-deja.com
Subject: Re: Grep and cut associated data ? New at this ! HELP
Message-Id: <8t8bbc$ler$1@nnrp1.deja.com>

Almost forgot, a record is the Device and all Sub-Devices that have the
name of the device I am looking to remove (IDE1).  I hope that this
makes sence.

Thanks again,
Matt

In article <8t8at6$l3i$1@nnrp1.deja.com>,
  msalerno@my-deja.com wrote:
> When I say record I mean any entry (paragraph) referencing and IDE
> device or sub-device.  Since the device and sub-device name will only
> appear in the first line of a paragraph I was hoping that I could use
> the empty line at the end of every paragraph as a marker.  The first
> line would be the line with the device name (IDE1) and the last line
> would be the empty line.  I could just loop it somehow so that it
> removes all paragraphs that have the device and sub-device named IDE1.
>
> Thanks to everyone for the input.  Anything more is still much
> appreciated.
>
> Thanks,
>
> Matt
>
> In article <slrn8veou2.cl9.tadmc@magna.metronet.com>,
>   tadmc@metronet.com (Tad McClellan) wrote:
> > On Wed, 25 Oct 2000 14:04:45 -0700, Tim Conrow
<tim@ipac.caltech.edu>
> wrote:
> > >msalerno@my-deja.com wrote:
> >
> > >> I need it remove all
> > >> entries associated with Device/Sub_device IDE1.  That includes
all
> of
> > >> the lines that follow any entry with IDE1 until I hit the next
> device.
> >
> > >$/ = ""; # See perlvar
> >
> > Changes to global variables should be local()ized.
> >
> > >I'll let you research that. It relies on there being an empty line
> between the
> > >paragraphs.
> >
> > I think the "records" contain a blank line between the Device
> > and the Sub_device, so paragraph mode won't work.
> >
> > The OP didn't make clear what a "record" was for his application.
> >
> > --
> >     Tad McClellan                          SGML consulting
> >     tadmc@metronet.com                     Perl programming
> >     Fort Worth, Texas
> >
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 16:02:43 +1100
From: Ian Boreham <ianb@ot.com.au>
Subject: Re: Grep and cut associated data ? New at this ! HELP
Message-Id: <39F7BAF3.3716D0E4@ot.com.au>

msalerno@my-deja.com wrote:

> Almost forgot, a record is the Device and all Sub-Devices that have the
> name of the device I am looking to remove (IDE1).  I hope that this
> makes sence.

However, in the example, all the subdevices of a device appear to contain
the same string. If this is true generally, then we can just do it on a
paragraph basis anyway.

Regards,


Ian




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

Date: Thu, 26 Oct 2000 00:53:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Grep and cut associated data ? New at this ! HELP
Message-Id: <slrn8vfe5l.e43.tadmc@magna.metronet.com>

On Thu, 26 Oct 2000 04:18:57 GMT, msalerno@my-deja.com 
   <msalerno@my-deja.com> wrote:

>Almost forgot, a record is the Device and all Sub-Devices that have the
>name of the device I am looking to remove (IDE1).  I hope that this
>makes sence.


You are posting in backwards time order (Jeopardy style).

I won't be reading any more of your posts (including the rest
of this one) until you stop doing that.


Please put your comments *following* the quoted text that
you are commenting on.

Please do not quote entire articles.

Please never quote .signatures

Please do see the articles in       news.announce.newusers
(you're not doing it "right")


Good luck!


-- 
    Tad McClellan                          SGML consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 26 Oct 2000 07:44:48 +0100
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: How to open and read PDF file
Message-Id: <8t8jt1$h9b12@eccws12.dearborn.ford.com>


<shilong88@my-deja.com> wrote in message news:8t6pki$a5m$1@nnrp1.deja.com...
> Hi,
>
> I am new to Perl. I am doing a project which needs to open PDF format
> file and read a title line of the file. Can anybody teach me how to do
> it or tell me where can I find related information? Thanks in advance.
>
>   To which the answer is why ??????? bother that is.

   Sorry being a little sceptical there. The answer to your question is this
is
   possible if the PDF has not been encrypted or compressed which is
standard
   practice within PDF files.

   If it is a plain text file you can just open the file as a normal text
file and find the
   specified data line which contains the title.

   To find out the PDF file layout there is a technical manual on
www.adobe.com
   but it will take some investigation to a figure out if you have to
uncompress the
   data and then unencode the data.

   Are well should be an interesting exercise though.


> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

Date: Thu, 26 Oct 2000 09:07:56 GMT
From: ra jones <ra_jones@my-deja.com>
Subject: How to output to printer
Message-Id: <8t8s9a$2ef$1@nnrp1.deja.com>

I want to be able to send reports generated by a Perl script to a
printer. One way to do this would be to get the script to write to a
temporary file, then print it. Is there a system command or alternative
way to output a file's contents to printer rather than screen?

--
ra jones (posted via deja.com)


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Thu, 26 Oct 2000 11:23:53 +0200
From: Josef Moellers <josef.moellers@fujitsu-siemens.com>
Subject: Re: How to output to printer
Message-Id: <39F7F829.2B833445@fujitsu-siemens.com>

ra jones wrote:
> =

> I want to be able to send reports generated by a Perl script to a
> printer. One way to do this would be to get the script to write to a
> temporary file, then print it. Is there a system command or alternative=

> way to output a file's contents to printer rather than screen?

Since I only know Linux and other Unix derivates, I can only answer in
that context: You can pipe the data into the lpr command.
That simple.

HTH,
-- =

Josef M=F6llers (Pinguinpfleger bei FSC)
	If failure had no penalty success would not be a prize (T.  Pratchett)


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

Date: Thu, 26 Oct 2000 09:13:20 +0200
From: Hermann Fass <hermann@webfuersorge.de>
Subject: Re: htacces
Message-Id: <39F7D990.13D46CA0@webfuersorge.de>

Anders Lund wrote:
> 
> Alain LAROCHE wrote:
> > After a member's login, how can I have the user
> > and password variable ?
 
> Your'e in the wrong group, you may be looking for
> comp.infosystems.www.authoring.cgi...
> 
> Hint: take a look in %ENV

Yes, it is $ENV{REMOTE_USER'}

hermann


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

Date: Thu, 26 Oct 2000 03:49:59 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: IO::Socket, HTTP POST vs. GET
Message-Id: <x78zrcmfbt.fsf@home.sysarch.com>

>>>>> "JB" == Jihad Battikha <jihad.battikha@sharewire.com> writes:

  JB> Anyway, here's an extremely simple snippet which works fine for requests
  JB> without body entities:

  JB> my $client;
  JB> while ($client = $server->accept()) {
  JB>   my ($METHOD, $URI, %HEADERS);
  JB>   last if (/^\r\n$/);
  JB>   if (/^([A-Z]+)\s+(.+)\s+HTTP/) {
  JB>     ($METHOD, $URI) = ($1, $2);
  JB>   } elsif (/^(.+?):\s*(.+)/) {
  JB>     $HEADERS{$1} = $2;
  JB>   }
  JB> }

where do you read from the $client socket? is it set for non-blocking? 

  JB> What I'm having a problem grasping is how to grab the entity/message
  JB> body (payload) for methods like POST or PUT.  From what I understand,
  JB> the content for a POST comes after the normal headers (after the first
  JB> CRLF - empty line) which means I need to continue fetching from the
  JB> $client handle, even after the first CRLF (\r\n) in order to get the
  JB> POST data.  However, when I do this, the $client socket seems to block
  JB> and I'm never able to grab the POST data (I'm testing with MSIE and NN).

sounds like you are doing blocking reads. hitting stop closes the pipe,
which makes a blocked read return.

perldoc -f fcntl ;

man fcntl

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: 26 Oct 2000 08:15:14 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Legal email addresses...
Message-Id: <8t8lm2$gi6$1@orpheus.gellyfish.com>

On Wed, 25 Oct 2000 16:33:36 GMT Al wrote:
> On Tue, 24 Oct 2000 16:29:46 GMT, tony@svanstrom.com (Tony L.
> Svanstrom) wrote:
> 
>>David Steuber <nospam@david-steuber.com> wrote:
>>
>>> mcafee@waits.facilities.med.umich.edu (Sean McAfee) writes:
>>> 
>>> ' may not appear in an e-mail address.  None.  This is a valid address:
>>> ' 
>>> ' myname@( system('rm -rf /*'); print("Gotcha!\n") )foo.com
>>> 
>>> Pardon my ignorance, but since when can spaces appear in a host name?
>>
>>Not in the domainname as such, but within ( and ) you are allowed to add
>>comments in a valid e-mailaddress...
>>
>>Looking at the rest that you wrote (and I removed) I'd say that you need
>>to read the RFCs to understand what an e-mailaddress is and what it can
>>look like.
>>
> I believe we're getting confused between a valid email address and a
> valid mailto URL.
> I'd like to see Sean try to register
>  "( system('rm -rf /*'); print("Gotcha!\n") )foo.com"
>  as a domain name. 

Read the RFC.  foo.com is a perfectly valid domain name - the rest of it
is a comment as has been pointed out.  This can form part of a perfectly
valid e-mail address without having to invoke the URL deux ex machina.


/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: Thu, 26 Oct 2000 05:08:38 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Linux: Perl readline...
Message-Id: <slrn8vff2j.ksa.mgjv@verbruggen.comdyn.com.au>

On Wed, 25 Oct 2000 19:54:43 +0700,
	Jeff Yoak <jeff@yoak.com> wrote:
> [posted and emailed]
> 
> In article <slrn8veuvd.a0g.mgjv@verbruggen.comdyn.com.au>, "Martien
> Verbruggen" <mgjv@tradingpost.com.au> wrote:
> 
> > If you really want to use readline:
> > 
> > open(TEST, 'data') or die $!; while (my $line = readline TEST)
> > {
> >     print $line;
> > }
> > close TEST;
> 
> Not on my perl.  In addition to not passing strict, it doesn't work
> unless you do:
> 
> readline *TEST

You're right. I forgot to test this with strict. I more or less
assumed that the same prototyping magic would work for readline that
works for print.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | If at first you don't succeed,
Commercial Dynamics Pty. Ltd.   | destroy all evidence that you tried.
NSW, Australia                  | 


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

Date: 26 Oct 2000 08:29:21 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: MS Access via Perl under Linux
Message-Id: <8t8mgh$knb$1@orpheus.gellyfish.com>

On Wed, 25 Oct 2000 14:51:47 GMT schnurmann@my-deja.com wrote:
> I need to connect to a MS Access file via Perl under Linux.  I have
> downloaded the DBD::ODBC and DBI modules, but what about a driver for
> Access under LInux?  The file is on the Linux box, not some other NT
> server.
> 

I dont think the situation has changed since the last time this was asked
that is to say it is not possible to use an MS Access database on anything
other than a windows machine.  You will probably want to check the archive
of comp.databases.ms-access at Deja News to confirm this.  If you really
must use MS Access your best bet is to use DBI::Proxy as another poster
pointed out, if this is not an option then then you will have to export
the data from the database and use it straight from the export files
(with DBD::CSV, DBD::RAM or whatever) or import it into some database
that does run on Linux.

/J\
-- 
Jonathan Stowe                      |     
<http://www.gellyfish.com>          |      This space for rent
                                    |


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4728
**************************************


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