[16991] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4403 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 22 09:05:32 2000

Date: Fri, 22 Sep 2000 06:05:11 -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: <969627910-v9-i4403@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 22 Sep 2000     Volume: 9 Number: 4403

Today's topics:
    Re: "$line =~ s|; \$\$\$TEXT|\$\$\$TEXT|;" <tom@tomklinger.com>
    Re: binmode(): How is OS related with "\n"? <iltzu@sci.invalid>
    Re: Candidate for the top ten perl mistakes list <bart.lateur@skynet.be>
    Re: Candidate for the top ten perl mistakes list <bart.lateur@skynet.be>
    Re: converting binary string <Kai.Wipplinger@de.bosch.com>
        Editing a linked file <g.soper@soundhouse.co.uk>
        fonts problems <atpsyte@ath.forthnet.gr>
    Re: Gratuitous incompatibilities (Was: Re: Range operat <bart.lateur@skynet.be>
    Re: Hash creation idiom. <lr@hpl.hp.com>
        HELP: "$line =~ s|; \$\$\$TEXT|\$\$\$TEXT|;" <kmojar@bmjgroup.com>
    Re: How to detect Windows perl program is already  runn <whatever@hnv.com>
    Re: How To? Setting External Subroutine as Method of Pe <bart.lateur@skynet.be>
        Is possible to control a page feet ? <Bea@ci.ub.es>
    Re: null string <lr@hpl.hp.com>
    Re: perl/dbi/mysql problem <tward10@jaguar.com>
    Re: print, chop, \n grrr... (Villy Kruse)
    Re: Printing to a printer without "|lp" <iltzu@sci.invalid>
        Problems with eval in a BEGIN-block <tom@tomklinger.com>
    Re: Problems with eval in a BEGIN-block <rick.delaney@home.com>
    Re: Problems with eval in a BEGIN-block <tom@tomklinger.com>
    Re: Problems with eval in a BEGIN-block <rick.delaney@home.com>
    Re: Pure perl encrypt/decryption? <bart.lateur@skynet.be>
    Re: reading from a file <powlow@my-deja.com>
    Re: reading from a file <powlow@my-deja.com>
    Re: reading from a file mexicanmeatballs@my-deja.com
        sending attachment not in body of email <hugo@fractalgraphics.com.au>
        Setting remote values (Win32::TieRegistry) <Alessandro.Augusto@br.bosch.com>
    Re: statistics and anti-caching <ubl@schaffhausen.de>
        system() not working as expected. new to perl tjmurphy9677@my-deja.com
        system() not working as expected. new to perl tjmurphy9677@my-deja.com
        Warning message in Win32::ODBC module (Philip Lees)
    Re: Writing info into a file on server side <fb@geo-guide.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Sep 2000 14:25:34 +0200
From: "Tom Klinger" <tom@tomklinger.com>
Subject: Re: "$line =~ s|; \$\$\$TEXT|\$\$\$TEXT|;"
Message-Id: <8dIy5.132$%64.3336@nreader1.kpnqwest.net>


"Kourosh A Mojar" <kmojar@bmjgroup.com> schrieb im Newsbeitrag
news:39CB4301.B309E973@bmjgroup.com...
Hi,
> $line =~ s|; \$\$\$TEXT|\$\$\$TEXT|;
>
Looks like you want to strip of a beginning semicolon.
Try this <untested>:
$line =~ s|\;((\$){3}\w+)|$1|;

- tom




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

Date: 22 Sep 2000 12:24:54 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: binmode(): How is OS related with "\n"?
Message-Id: <969625052.21151@itz.pp.sci.fi>

In article <m3og1kujit.fsf@dhcp11-177.support.tivoli.com>, Ren Maddox wrote:
>Larry Rosler <lr@hpl.hp.com> writes:
>> 
>> It is perhaps clearer to say that a 'text file' is a file structured 
>> into 'lines'.  A 'binary file' is anything else.
>
>In the particular case of DOS/WINDOWS, I would use the following
>definition:
>
>A binary file is any file that might contain an embedded \C-z, \C-j or
>\C-m, other than the specific \C-m\C-j combination at line endings and
>the \C-z at the end of the file.

I can think of (admittedly contrived) examples of binary files that
don't fit your criteria, yet should be read with binmode.  Unless, of
course, you choose to emphasize the "at line endings" part of your
definition to the exclusion of everything else, in which case you end
up saying the same thing as Larry, just a bit more muddled.

I would define a text file just as Larry does.  Additionally, I would
define a "plain text file" as one containing only printable characters
and line breaks.  The distinction can be significant.

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: Fri, 22 Sep 2000 08:33:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <m96mss8m25a0o8bhm68dgccn7b6uve5so9@4ax.com>

Abigail wrote:

>$$    6: uses @array[$index] where $array[$index] should be used
>
>Nah. The latter seldomly leads to an error.

Only to a warning.

	map { dosomething } @hash{foo};

Now, why does this complain? There's nothing wrong with a hash slice of
one item in a list context, is there?

-- 
	Bart.


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

Date: Fri, 22 Sep 2000 08:39:31 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <0i6msskgq6068n4utkdp0dl5seprh1fuv4@4ax.com>

Tim wrote:

>Then please explain the mnemonic for push @array, $value :)

push only accepts a real array (actually, an array reference, behind the
scenes ... see what prototyping a sub can do to it), not just any list.

Now, what is a bit weird, is unshift():

	unshift @array, @items;

where @items are stuffed *in front of* the current items in @array. So
the syntax and the action are each other's opposite.

-- 
	Bart.


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

Date: Fri, 22 Sep 2000 12:48:22 +0200
From: Kai Wipplinger <Kai.Wipplinger@de.bosch.com>
Subject: Re: converting binary string
Message-Id: <39CB38F6.6C1FEFEE@de.bosch.com>

thanks,

pack works fine. Hopefully find next time the correct function.

Kai


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

Date: Fri, 22 Sep 2000 09:03:38 +0100
From: Geoff Soper <g.soper@soundhouse.co.uk>
Subject: Editing a linked file
Message-Id: <4a01ec9548g.soper@soundhouse.co.uk>

In the route of our web server (Apache) is a linked file which controls
our e-mail aliasing. As part of a Perl script to administer user details a
new alias file is written each time it is run. Unfortunately this seems to
break the link.

I don't really have and knoweldge of Unix or what this linking represents
but is there any way a Perl script can replace the file without loosing
the link. I know I can upload a new file manually via FTP and not affect
the linking so it must be possible to get a script to do it mustn't
it???????

Otherwise it makes my learning of Perl to create this admin script
slightly wasted!!

Thanks as always

-- 
Geoff Soper
g.soper@soundhouse.co.uk
Take a look at the Soundhouse page http://www.soundhouse.co.uk/


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

Date: Fri, 22 Sep 2000 13:34:02 +0300
From: "ty" <atpsyte@ath.forthnet.gr>
Subject: fonts problems
Message-Id: <969618780.846569@athnrd02.forthnet.gr>

HI,
I have installed apache in a suse-linux 6.4 server.i try to take data from
dbf file througth cgi script and display them into the explorer.Every thing
was perfect except dbf data,which was greek.But there was greek into into
the page but it was fine.some friend say that i need 437 fonts in internet
explorer or
convert them. how can i do that?

thank you for any help.

jim







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

Date: Fri, 22 Sep 2000 07:49:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Gratuitous incompatibilities (Was: Re: Range operator with "... /^$/")
Message-Id: <7l3msss8obt0qeshasfmor73iqqepcogic@4ax.com>

Christopher Biow wrote:

>But it leaves DOS-lineage systems with yet another kludge (under the bodge
>(beneath the jury-rig)) that adds internal and cross-platform complexity.

No; the kludge is in C that insists that "\n" looks and quacks like one
single character. Perl inherited that, and I admit, it's damn easy. On
other programming languages and environments, more aimed to DOS and
related, line ends AKA CRLF remain two characters, from a programmer
point of view.

-- 
	Bart.


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

Date: Fri, 22 Sep 2000 01:18:50 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Hash creation idiom.
Message-Id: <MPG.1434b5c8185d84a898adb0@nntp.hpl.hp.com>

In article <x7d7hxcexb.fsf@home.sysarch.com>, uri@sysarch.com says...
> >>>>> "ADD" == Arthur Darren Dunham <add@netcom.com> writes:
> 
>   ADD> # array and x
>   ADD> @items = qw ( red rose chair )
>   ADD> @items{@items} = ( 1 x scalar(@items));

Note that the above incorrectly assigns '111' to $items{red} and nothing 
to the other elements.

          @items{@items} = (1) x @items; # 'scalar' is redundant

 ...

> BTW choosing the same name for the array and hash looks cute but is very
> poor coding style. for hashes used to test things i would call it
> %is_an_item

Humbug.  @items is an array of items; %items is a hash whose keys are 
the same items.  Nothing wrong with that; in fact, it's nicely mnemonic.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 22 Sep 2000 12:31:13 +0100
From: Kourosh A Mojar <kmojar@bmjgroup.com>
Subject: HELP: "$line =~ s|; \$\$\$TEXT|\$\$\$TEXT|;"
Message-Id: <39CB4301.B309E973@bmjgroup.com>

dear all

ive been trying hard to do some find and replace on the following
expression (dollar signs are normal text): 

$line =~ s|; \$\$\$TEXT|\$\$\$TEXT|;

could anyone help me with this problem, im sure there is a simple
solution i have over looked.

thanking you in advance and for your kind attention,

kourosh a mojar


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

Date: Fri, 22 Sep 2000 09:31:40 +0200
From: P ten Bruggencate <whatever@hnv.com>
Subject: Re: How to detect Windows perl program is already  running??????????????????
Message-Id: <39CB0ADC.122A7A69@hnv.com>



Mohammad Khan wrote:
<Just the code.>

#!/perl/bin -w
use strict;
<Very, very good habit.>

> 
> $pfile = "cmsip.pid";
> 
>    if (open(FILE, $pfile) == 0)
>    {
>       printf("$pfile file doesn't exist.\n");
>       if (open(FILE, ">>$pfile") == 0)
>       {
>          printf("Unable to create $pfile file.\n");
>          exit(0);
>       }
> 
>    }
>    else
>    {
>       printf("$pfile filedoes exist.\n");

Before you can unlink a file you must close the file handle.
	close( FILE ) || warn "close failed: $!";

>       $l_chk = unlink("cmsip.pid");
> 

Why not just check the results of unlink? Unlink returns the amount of
files deleted. (0  means no files deleted.)

>       if ( -e $pfile)
> 
>            printf("$pfile couldn't be removed.\n");
>            exit(0);
>       }  # if (-e $pfile)
>       else
> 
>            printf("$pfile removed.\n");
>       }  # if (-e $pfile)
> 
>       printf("l_chk = $l_chk.\n");
> 
>    }
> 
> Thanks.
No problem.

But there must be a nicer way to check if a process is already
running or not. Maybee a CPAN module? Anybody?

Ps: Are you a C-programmer? Because you can use print, works nicer and
you
    do not seem to need the format's of printf.


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

Date: Fri, 22 Sep 2000 08:30:54 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: How To? Setting External Subroutine as Method of Perl Module and passing arguments
Message-Id: <716msssh84bua7ghqvgbqur5g5bvdg2s76@4ax.com>

RainCloud Studios wrote:

>Now.. in the script I call my module.
>
>use THINGY::MYTHING;
>my $newthingy = MYTHING->new();
>$newthingy->error_handler(\&error_handler);
>$newthingy->dosomething();
>
>Ok.. if an error occurs in &dosomething I would now like to send the error
>message to error_handler from within the module, thus revealing an error
>page and exiting the script.

I think you want to set $SIG{__DIE__} to \&error_handler. See the module
CGI::Carp for a practical example.

-- 
	Bart.


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

Date: Fri, 22 Sep 2000 13:22:37 +0200
From: Bea <Bea@ci.ub.es>
Subject: Is possible to control a page feet ?
Message-Id: <39CB40FD.8AC911F8@ci.ub.es>

Hi all;
Does anybody know how to force a page feet onto the printer from an html
page when printing from the browser ? Any html tag, javascript code ,
wonderful perl program would be ok ??

Thanx in advanced.

Bea@ci.ub.es



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

Date: Fri, 22 Sep 2000 01:25:49 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: null string
Message-Id: <MPG.1434b76cfea7e90998adb1@nntp.hpl.hp.com>

In article <8qeqs7$qr2$1@nnrp1.deja.com>, circuit_board@my-deja.com 
says...
> Finally got it. Trick is don't have a space in between the single quote.
> 
> If ($somestring eq '')  blah blah blah.

Another way:

   unless (length $something) { ... }

I'm too tired to benchmark that now, but IIRC it is faster (as if anyone 
cared :-).

A third way, probably slower:

   if ($something !~ /./s) { ... }

 ...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Fri, 22 Sep 2000 07:56:58 +0100
From: "Trevor Ward" <tward10@jaguar.com>
Subject: Re: perl/dbi/mysql problem
Message-Id: <8qevrr$4nk7@eccws12.dearborn.ford.com>


<jnk@kenobiz.com> wrote in message
news:39cb7669.67788508@news.acronet.net...
> #!/usr/local/bin/perl
>
> use DBI;
>
> $dbh = DBI->connect("DBI:mysql:db_kenobiz_com", 'kenobiz_com', '***');
> $dbh->do("CREATE TABLE testing (user VARCHAR(15), pass VARCHAR(10))");
> $dbh->do("INSERT INTO testing VALUES ('misener', '78dh9as4')");
> $dbh->disconnect;
>
> this code succesfully creates the table 'testing' but, it does not
> INSERT any data at all, i cant figure this out at all, thanks for any
> help you can offer

The basic create statement will work to make the table but using standard
sql the insert statement is invalid.

INSERT into testing   (user, pass) VALUES ('misener', '78dh9as4');

need to specify the fields as well.

Hope this helps




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

Date: 22 Sep 2000 07:57:57 GMT
From: vek@pharmnl.ohout.pharmapartners.nl (Villy Kruse)
Subject: Re: print, chop, \n grrr...
Message-Id: <slrn8sm484.nvt.vek@pharmnl.ohout.pharmapartners.nl>

On Thu, 21 Sep 2000 11:19:33 -0700, Tim Conrow <tim@ipac.caltech.edu> wrote:

>
>print +("$phrase " x $number) . "\n";
>
>(Quiz: Why is that '+' sign there?)
>

An alternative to putting all the arguments to print in parenteses.

print ( ("$phrase " x $number) . "\n");'



Villy


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

Date: 22 Sep 2000 12:50:11 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Printing to a printer without "|lp"
Message-Id: <969626099.22623@itz.pp.sci.fi>

In article <8q3a33$8jk$1@panix3.panix.com>, kj0 wrote:
>
>  open  BARCODE_PRINTER, "|/usr/bin/lp -d zebra" or PFFff_f_t(__LINE__);
>  print BARCODE_PRINTER $gobbledeyGook;
>  close BARCODE_PRINTER;
>
>But the above will crash my script if I turn on taint checking.  I
>understand the problem has to do with the implicit fork done by the
>open command.

How about just setting a known temporary environment:

  # Obligatory warning: untested code, may contain bugs or typos
  # Braces limit scope of local %ENV change:
  {
      local %ENV = (PATH => '/usr/bin:/bin', SHELL => '/bin/sh');
      open  BARCODE_PRINTER, '|lp -d zebra' or PFFff_f_t(__LINE__);
  }
  print BARCODE_PRINTER $gobbledeyGook;
  close BARCODE_PRINTER;

-- 
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla  | "By promoting postconditions to
and its pseudonyms -    |  preconditions, algorithms become
do not feed the troll.  |  remarkably simple."  -- Abigail



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

Date: Fri, 22 Sep 2000 11:33:32 +0200
From: "Tom Klinger" <tom@tomklinger.com>
Subject: Problems with eval in a BEGIN-block
Message-Id: <PHFy5.100$%64.2108@nreader1.kpnqwest.net>

Hi!

I've done a small script which uses a special module. To prevent a
compilation error I put in a BEGIN-block to test if the module exists or
not.
Following code is from the Perl Cookbook:

BEGIN {
               unless (eval "use mymodule") {
                       die "Cannot find/load module: $@\n";
               }
}

print "Module loaded ...\n"; # for testing if I'm through the block
exit;

mymodule exists in the @INC. I can use it if I only call it with the use
function.
As the article in the Cookbook says this routine in the BEGIN block should
trap any compilation error.
My only result is that the die is called every time!
I also tested it with the CGI.pm from Lincoln Stein, version 2.74.
It's totally equal if I try it with:
 ...
unless (eval "use CGI 30.00") {
 ...
or with
 ...
unless (eval "use CGI") {
 ...
The die will be called every time.
Can somebody tell me why?
How to handle such a stuff?
My perl is version 5.005 patchlevel 03 (5.005_03).
Thanks for every help in advance.

kr
- tom




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

Date: Fri, 22 Sep 2000 11:48:30 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Problems with eval in a BEGIN-block
Message-Id: <39CB49B5.F01E4BDB@home.com>

[posted & mailed]

Tom Klinger wrote:
> 
> Following code is from the Perl Cookbook:

This is an error.

> BEGIN {
>                unless (eval "use mymodule") {
>                        die "Cannot find/load module: $@\n";
>                }
> }

> ...
> The die will be called every time.
> Can somebody tell me why?

Because use doesn't return a value.  use is equivalent to

    BEGIN { require Module; import Module LIST; }

but the BEGIN doesn't return the value of the last expression.  Even if
it did, there would be no guarantee that the import would return a true
value.


> How to handle such a stuff?

    unless (eval "use mymodule;1") {
        die "Cannot find/load module: $@\n";
    }
or
    eval "use mymodule";
    if ($@) {
        die "Cannot find/load module: $@\n";
    }

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Fri, 22 Sep 2000 14:18:11 +0200
From: "Tom Klinger" <tom@tomklinger.com>
Subject: Re: Problems with eval in a BEGIN-block
Message-Id: <c6Iy5.131$%64.3316@nreader1.kpnqwest.net>


"Rick Delaney" <rick.delaney@home.com> schrieb im Newsbeitrag
news:39CB49B5.F01E4BDB@home.com...
Hi Rick,
first thanks for the reply ...

> > Following code is from the Perl Cookbook:
>
> This is an error.
Why? I always thought that this book is a good one ....

> but the BEGIN doesn't return the value of the last expression.  Even if
> it did, there would be no guarantee that the import would return a true
> value.
OK somthing new, thanks.

>     unless (eval "use mymodule;1") {
>         die "Cannot find/load module: $@\n";
>     }
> or
>     eval "use mymodule";
>     if ($@) {
>         die "Cannot find/load module: $@\n";
>     }
I'll take a look. But: sounds good and logical.

- tom




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

Date: Fri, 22 Sep 2000 12:28:25 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Problems with eval in a BEGIN-block
Message-Id: <39CB5310.E46984C5@home.com>


Tom Klinger wrote:
> 
> "Rick Delaney" <rick.delaney@home.com> schrieb im Newsbeitrag
> news:39CB49B5.F01E4BDB@home.com...
> 
> > > Following code is from the Perl Cookbook:
> >
> > This is an error.
> Why? I always thought that this book is a good one ....

I didn't mean to imply that it wasn't.  I like the Cookbook.  I meant
that that particular example was an error.  

Books have mistakes.  That one may even be listed at
http://www.oreilly.com/catalog/cookbook/errata/.  I haven't checked. 
You may want to submit it if it isn't.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Fri, 22 Sep 2000 07:37:53 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pure perl encrypt/decryption?
Message-Id: <lp2mssom4j93rmhfcn7r6a1p23eh3t33ps@4ax.com>

Abigail wrote:

>Bart Lateur (bart.lateur@skynet.be) wrote 

>&& It still runs as "nobody", so there's a limit to what you can do.
>
>Oh, really? In most (all?) Unices, the only special uid is 0, root.
>"nobody" isn't special in any way, it's just a convention.

No, what I ment was, that "nobody" can't do much with regards to your
files and directories. Setuid to you is practically a requirement.

>Of course, a properly configured host doesn't allow connections to ports
>other than necessary to perform its task, so it might very well be that
>any port other than 80 is firewalled out.

True. Tightly configured firewalls aren't rare nowadays.

>&& I don't think FTP even supports setting the SUID bit; and even then,
>&& some OSes are configured by default to ignore the SUID bit on scripts.
>&& The next choice is to use a cgi-wrap program, but: you need to compile
>&& it on your server. Full circle.
>
>Well, there's always the possibility to compile on your machine, and
>upload a binary. You don't even need to have the same kind of machine as
>your ISP has. If gcc runs on your platform, and gcc runs on your ISP's,
>you can always build a gcc that emits binaries suitable for your ISP's
>machine.

You still have to SUID that binary.

-- 
	Bart.


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

Date: Fri, 22 Sep 2000 10:02:42 GMT
From: Powlow <powlow@my-deja.com>
Subject: Re: reading from a file
Message-Id: <8qfanp$c99$1@nnrp1.deja.com>

yeah, i know, that was the advice i got.
but chomp didn't work on it.

In article <u9hf7bf1sw.fsf@wcl-l.bham.ac.uk>,
  nobull@mail.com wrote:
> toffer@fake.email.co.uk (Toffer) writes upsidedown:
>
> > I would use chop, thusly..
>
> Most people would use chomp.
>
> --
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\
>

--
___________________________
       http://powlow.com/
___________________________


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


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

Date: Fri, 22 Sep 2000 10:11:41 GMT
From: Powlow <powlow@my-deja.com>
Subject: Re: reading from a file
Message-Id: <8qfb8i$ct1$1@nnrp1.deja.com>

sorry about that. suppose i was a bit impatient.
anyway, now i know.
its sort of the first time i've used a newsgroup to solve a coding
problem so i thought i was being ignored cause it was such a simple
problem.

thanks people
onto setting evil cookies so i can customise my pages.
paulo

In article <m3bsxivobw.fsf@dhcp11-177.support.tivoli.com>,
  Ren Maddox <ren.maddox@tivoli.com> wrote:
> Powlow <powlow@my-deja.com> writes:
>
> > wooohh!
> > a response!
>
> A bit impatient are we?  While you can often get a response quicker
> than this, the vagaries of news feeds make expecting quick responses
> an unpleasant activity.
>
> > thanks. actually i found out how to do it.
> > it wasn't a newline character.
> > i used s/\s+$// to remove the trailing space which funnily enough
> > didn't work with s/ //g or something similar.
> > drove me nuts.
>
> Sounds like it probably was probably a carriage return, or perhaps a
> tab.  Maybe even a form feed.... :)
>
> --
> Ren Maddox
> ren@tivoli.com
>

--
___________________________
       http://powlow.com/
___________________________


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


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

Date: Fri, 22 Sep 2000 11:01:59 GMT
From: mexicanmeatballs@my-deja.com
Subject: Re: reading from a file
Message-Id: <8qfe6t$fvq$1@nnrp1.deja.com>

In article <8qfanp$c99$1@nnrp1.deja.com>,
  Powlow <powlow@my-deja.com> wrote:
> In article <u9hf7bf1sw.fsf@wcl-l.bham.ac.uk>,
>   nobull@mail.com wrote:
> > toffer@fake.email.co.uk (Toffer) writes upsidedown:
> >
> > > I would use chop, thusly..
> >
> > Most people would use chomp.
> yeah, i know, that was the advice i got.
> but chomp didn't work on it.
>

 Probably because chomp chomps off whatever is in $/, if you get
a file from windows onto a unix box then that operation results
in a trailing \r after a chomp.

 So, you either set $/="\r\n" if you know it's coming from win-dos
or use a sub. s/[\r\n]+$//; if you don't know from whence it came
(Removes more than one line end marker as well, s/[\r\n]{1,2}//;
gives more chomp-like behaviour). The sub. also catches Mac style \r
line ends and backward line ends(\n\r).

 Generally of course you do know where your files came from in which
case I believe chomp is faster.

--
Jon
perl -e 'print map {chr(ord($_)-3)} split //, "MrqEdunhuClqdph1frp";'


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


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

Date: Fri, 22 Sep 2000 17:47:04 +0800
From: Hugo Bouckaert <hugo@fractalgraphics.com.au>
Subject: sending attachment not in body of email
Message-Id: <39CB2A98.B5EEF44F@fractalgraphics.com.au>

Hi All

Anyway, as Gwyn's message states below, I tried the multipart/mixed,
both for Type in the message
body and attachment in order to have emails as attachments, not in the
body of the mail message:  

### Create a new multipart message:
        $msg = MIME::Lite->build(
                     From    =>'info@fractalgraphics.com.au',
                     To      =>'hugo@fractalgraphics.com.au',
                     Cc      =>'hugo@fractalgraphics.com.au',
                     Subject =>'File Upload procedure',
                     Type    =>'multipart/mixed',
                     Data    =>$body
                    );
$msg->attach(Type     =>'multipart/mixed',
                      Content-type =>'attachment',              
                      FH    =>$att
                     );

I also tried it when specifying the html form in the html page, but when
I do
the latter, the attachment is no longer there. 

Do you - or anyone alse who knows about this - mind being a bit more
specific 
- how do I alter the above code to have attachments not displayed in the
body of the email? Your help will
be greatly appreciated. 

There is so much trial and error involved in this, it is really
exasperating!

If anyone can help me out here, that would be great. 

Thanks very much. 

Hugo  

PS: (to Gwyn): What is the terrible thing I said?   

Gwyn Judd wrote:

I was shocked! How could Hugo Bouckaert <hugo@fractalgraphics.com.au>
say such a terrible thing:
>Hi 
>
>Thanks to several people on this list I eventually got email attachments
>to work, when sending data from a form and using a perl script to email
>these data. 
>
>One problem remains though: The attachments come up in the body of the
>email, not as attachments for which you can (on NT) right-click the
>mouse, using the "save this link as" option. 

Take a look at the MIME::Lite documentation where it talks about
creating multipart messages. The Type of the message will be
'multipart/mixed' and then you attach whichever bits of data you want.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
A tall, dark stranger will have more fun than you.
-- 
Dr Hugo Bouckaert
R&D Support Engineer, Fractal Graphics 
39 Fairway, Nedlands Western Australia 6009
Tel: 9284 8442
Email:hugo@fractalgraphics.com.au
Web: http://www.fractalgraphics.com.au


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

Date: Fri, 22 Sep 2000 09:56:44 -0300
From: Alessandro Augusto <Alessandro.Augusto@br.bosch.com>
Subject: Setting remote values (Win32::TieRegistry)
Message-Id: <39CB570B.17DEFC59@br.bosch.com>

I´m trying to set values to remote keys, but I am not having success.
Can anyone please help me with a little example.

For example, I logon as administrator on the Domain Controler (DC),
and I want to change some values on the workstations (ws). How can
I do that?

                             DC
                               |
             --------------------------
             |              |           |            |
          ws_a     ws_b    ws_c      ws_d

how from DC, can I change values on ws_a for example.
(please send some code as example).

Thanks,
Alessandro




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

Date: Fri, 22 Sep 2000 11:08:26 +0200
From: Malte Ubl <ubl@schaffhausen.de>
Subject: Re: statistics and anti-caching
Message-Id: <39CB218A.AE5545@schaffhausen.de>

As far as I know _Perl_ doesnt do any caching unless of course you
program it
to do caching, correct me if I'm wrong.

malte

Kevin schrieb:

> Hi All
>
> I am implementing some html emails for an organisation.
>
> What I need is a counter script of sorts, one that preferably can get
> arround any caching issues, that is, be as accurate as possible, does
> anyone have any ideas, points to free or paid scripts and services
> would be appreciated.
>
> Regards,
> Kevin



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

Date: Fri, 22 Sep 2000 08:15:56 GMT
From: tjmurphy9677@my-deja.com
Subject: system() not working as expected. new to perl
Message-Id: <8qf4fh$5g1$1@nnrp1.deja.com>

when i call
system("uuencode file1 file2 | mail -s summary
tony.murphy@start.de") i get a mail as expected
with a file - but there is no data in the file.

what should happen is file1 is uuencoded and the
encoded data is placed in file2, file2 is then
piped to mail and sent to my email address.

I have run the command outside of perl and it
works ok.

running perl script on reliant unix
mail::sender module isn't installed on the
machine - so trying to use unix utilities to the
work.

any help appreciated.


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


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

Date: Fri, 22 Sep 2000 08:15:55 GMT
From: tjmurphy9677@my-deja.com
Subject: system() not working as expected. new to perl
Message-Id: <8qf4fg$5fv$1@nnrp1.deja.com>

when i call
system("uuencode file1 file2 | mail -s summary
tony.murphy@start.de") i get a mail as expected
with a file - but there is no data in the file.

what should happen is file1 is uuencoded and the
encoded data is placed in file2, file2 is then
piped to mail and sent to my email address.

I have run the command outside of perl and it
works ok.

running perl script on reliant unix
mail::sender module isn't installed on the
machine - so trying to use unix utilities to the
work.

any help appreciated.


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


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

Date: Fri, 22 Sep 2000 08:57:25 GMT
From: pjlees@ics.forthcomingevents.gr (Philip Lees)
Subject: Warning message in Win32::ODBC module
Message-Id: <39cb1ae0.3751334@news.grnet.gr>

Hi. I'm using Win32::ODBC to read data from a database and insert it
into an html file for output. It's working fine, except that I get the
following warnings:

Use of uninitialized value at C:/Perl/site/lib/Win32/ODBC.pm line 261.
Use of uninitialized value at C:/Perl/site/lib/Win32/ODBC.pm line 261.
Use of uninitialized value at C:/Perl/site/lib/Win32/ODBC.pm line 260.
Use of uninitialized value at C:/Perl/site/lib/Win32/ODBC.pm line 260.
Use of uninitialized value at C:/Perl/site/lib/Win32/ODBC.pm line 260.

For what it's worth, lines 260 and 261 are the first two lines after
the foreach below:

    foreach (@Results){
        s/ +$//; # HACK
        $self->{'data'}->{ ${$self->{'fnames'}}[$num] } = $_;
        $num++;
    }

Why there should be two warnings for line 261 and three for 260 is
beyond me.

The following snippet from my code threw up similar warnings before I
added the defined() test:

while ( my( $key, $value ) = each %data ) {
	if ( defined( $value ) ) {
		$value =~ s/^(\d+)\.0+$/$1/;
		$value =~ s/^(\d{4})\-(\d{2})\-(\d{2})$/$3-$2-$1/;
		$cur_line =~ s/\*$key\*/$value/ig;
	}
}

%data is populated with a row retrieved from the database using
DataHash().

Could the ODBC warnings be the result of reading null values from the
database? Is this known behaviour for the Win32::ODBC module? Should I
be worried about it?

I can't find any reference to warnings in the Win32::ODBC
documentation and I don't feel competent to hack the ODBC.pm code.

All help appreciated.

Phil
--
Philip Lees
ICS-FORTH, Heraklion, Crete, Greece
Ignore coming events if you wish to send me e-mail
'The aim of high technology should be to simplify, not complicate' - Hans Christian von Baeyer


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

Date: Fri, 22 Sep 2000 14:38:08 +0200
From: "Frode Bjerkholt" <fb@geo-guide.com>
Subject: Re: Writing info into a file on server side
Message-Id: <MmIy5.6088$mq2.95499@news1.online.no>

If you use UNIX og Linux, the most probable reason to the error  is that the
Web Server doesn't have the rights to write files in the specified
directory. Give the proper rights with chmod and it hopefully works :-)

Frode Bjerkholt

<circuit_board@my-deja.com> wrote in message
news:8qetpg$ts1$1@nnrp1.deja.com...
> Here, I'm opening a file for appending. This is in a cgi script,
> uploaded to the server. When I run it, it gives an error message and
> nothing is written to the file.
> Hope you can help.
>
> open(FH, ">>info.dat");
> foreach $fieldname ($formdata->param) {
>
>                 print FH $formdata->param($fieldname) . ":";
>         }
>
> close(FH);
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.




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

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


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