[16642] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4054 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 18 06:05:35 2000

Date: Fri, 18 Aug 2000 03:05:20 -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: <966593119-v9-i4054@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 18 Aug 2000     Volume: 9 Number: 4054

Today's topics:
        Apache and cgi/perl <round@ebtech.net>
    Re: Apache and cgi/perl <pete@alphanetcoms.co.uk>
    Re: Attatching files in an email using perl (Colin Keith)
    Re: Attatching files in an email using perl <gellyfish@gellyfish.com>
    Re: Checking if variables exist <lincolnmarr@nospam.europem01.nt.com>
    Re: close window <gellyfish@gellyfish.com>
    Re: cross platform newline processing (Keith Calvert Ivey)
    Re: DBM Files Going Haywire!!! HELP!!! <stevenjm@telisphere.com>
        Emacs modules for Perl programming (Jari Aalto+mail.perl)
    Re: Eval and Regexps Help (Logan Shaw)
    Re: Eval and Regexps Help <elephant@squirrelgroup.com>
    Re: GD.pm Test Fails? <stevenjm@telisphere.com>
    Re: help i'm stuck!!! <lr@hpl.hp.com>
    Re: How to change Popup frame's URL <psi@nospam.mikrolog.fi>
    Re: how to ignore ampersand in post operation <gellyfish@gellyfish.com>
    Re: I have another question (David Wall)
    Re: Image Manipulation Question <gellyfish@gellyfish.com>
        install DBD problem <pete@alphanetcoms.co.uk>
        Modifying a text file <lincolnmarr@nospam.europem01.nt.com>
    Re: newbie - documentation <gellyfish@gellyfish.com>
    Re: Out of memory! error. Working with arrays... (Eric Bohlman)
    Re: Output to printer in Win NT <gellyfish@gellyfish.com>
    Re: Output to printer in Win NT <elephant@squirrelgroup.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Thu, 17 Aug 2000 09:27:55 -0400
From: "J. Round" <round@ebtech.net>
Subject: Apache and cgi/perl
Message-Id: <8ngpae$5413@cheeseball.ebtech.net>

Ok, here it is, I have an Apache server set up.  The only thing is,
its setup on Windows NT insead of my Linux computer this time.
After I type a basic Perl Cgi-Script I have no idea on Windows
what to type for a path at the top of the program.

ie.
in Linux I start this way
#!/usr/local/bin/perl

In windows, I got no idea what to put there.
Anyone know?

-john-




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

Date: Fri, 18 Aug 2000 09:55:28 +0100
From: "pete" <pete@alphanetcoms.co.uk>
Subject: Re: Apache and cgi/perl
Message-Id: <399d022c.0@energise.enta.net>

Try the following:

#!c:/perl/bin/perl.exe

Pete


J. Round <round@ebtech.net> wrote in message
news:8ngpae$5413@cheeseball.ebtech.net...
> Ok, here it is, I have an Apache server set up.  The only thing is,
> its setup on Windows NT insead of my Linux computer this time.
> After I type a basic Perl Cgi-Script I have no idea on Windows
> what to type for a path at the top of the program.
>
> ie.
> in Linux I start this way
> #!/usr/local/bin/perl
>
> In windows, I got no idea what to put there.
> Anyone know?
>
> -john-
>
>




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

Date: Fri, 18 Aug 2000 07:53:05 GMT
From: newsgroups@ckeith.clara.net (Colin Keith)
Subject: Re: Attatching files in an email using perl
Message-Id: <BX5n5.164$DT4.3996148@nnrp2.clara.net>

In article <399C1ADB.86BD4BA0@mediaone.net>, M Nair <manojnair@mediaone.net> wrote:
>Can anyone help me?

Save yourself time figuring it out and tootle over to CPAN and check out 
MIME::* and Mail::*

<http://www.cpan.org/modules>

Col.


---
Colin Keith
Systems Administrator
Network Operations Team
ClaraNET (UK) Ltd. NOC


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

Date: 17 Aug 2000 21:31:19 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Attatching files in an email using perl
Message-Id: <8nhi2n$1fq$1@orpheus.gellyfish.com>

On Thu, 17 Aug 2000 13:03:23 -0400 M Nair wrote:
> Hi.
> 
> I am trying to send emails with attatchments from within perl running on
> Solaris. I have done this before using mail and setting the
> Content-Type and Mime formats etc..but I dont recollect it now...

I would suggest the module MIME::Lite ...

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Fri, 18 Aug 2000 09:24:30 +0200
From: "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
Subject: Re: Checking if variables exist
Message-Id: <8nioao$ksn$1@qnsgh006.europe.nortel.com>

Simple!! I got this going a few days ago on my script.
First you need to use CGI module, and use the 'param' call to get your data
into STDIN.

#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);

$q = new CGI;
$test = $q->param("test"); ## passes name=value pair to script

####### put your html page here in a subroutine #########
# when you hit the submit button, get it to refer to the below subroutine

sub check {
if ($test eq "") { &error_message; exit;}
else { &continue_script; exit; }
}

Good Luck!




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

Date: 18 Aug 2000 08:04:15 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: close window
Message-Id: <8nin5f$2s8$1@orpheus.gellyfish.com>

On Thu, 17 Aug 2000 14:32:53 +0200 Flip wrote:
> Could anybody tell me what the perl command is to close the current
> browserwindow

system('/sbin/reboot');

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Fri, 18 Aug 2000 04:49:58 GMT
From: kcivey@cpcug.org (Keith Calvert Ivey)
Subject: Re: cross platform newline processing
Message-Id: <399cbf03.3819845@news.newsguy.com>

Bob Walton <bwalton@rochester.rr.com> wrote:

>Mark, you should find that Perl will DTRT (do the right thing) in this
>case (it does on Windoze, anyway).  It should treat "\012", "\015", and
>"\015\012" all just like either of these sequences is a "\n" on input.

Not true.  Perl will convert the OS-specific line ending to "\n"
on input (assuming no binmode), but it doesn't automatically
handle line endings from other OSs.  For example, if you have
"\015\012" on a Unix system, you'll be left with "\015" (or
"\r") before the "\n".
 
>On output, a "\n" will generate the line separator that is appropriate
>for your system.

That's true (assuming no binmode).

-- 
Keith C. Ivey <kcivey@cpcug.org>
Washington, DC


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

Date: Fri, 18 Aug 2000 06:17:45 GMT
From: Steven May <stevenjm@telisphere.com>
Subject: Re: DBM Files Going Haywire!!! HELP!!!
Message-Id: <399CD4CC.67003DFA@telisphere.com>

mlmguy@my-deja.com wrote:
> 
> Hello,
> 
> I am new at Perl. I have created an FFA Links Page with 50 Links
> totally. I have tried storing the data in a text file but I dont like
> the results. I then tried to use DBM files using the following code. If
> you notice I have used a 'different' way of locking the process. The
> reason being I dont know any other way of locking. 

See below

> Anyway, now the
> logic of the new link being added on the top and the bottom one being
> deleted is working perfectly. However, strangely, my DBM data file
> keeps growing. It grew to a massive 4.5 MB in one day. But if I try to
> display the total number of records in it, it still shows 50. So what
> is the extra space holding??? Please HELP someone out there. Thanks in
> advance. Here is the code which I am using.

Don't know, I've been using tied hashes for years and I've never seen
one
grow on its own.  They DO act a little strange as far as size jumps for
various inputs, but....  I rather suspect your script is writing 'stuff'
to the hash. What, I don't know.

Here is some code (more or less :-) modified from 'stuff' by Tom C. 
Any problems with it are my own invention, so don't blame him.
This is 'slightly' modified from a program that has been running it for 
(almost?) a year.  I changed SearchCompare as you probably don't need
the things I use in mine.

Notice a different open is called depending on whether you intend to 
read/write or just read.  Two or more invocations can read but you can't 
write if something else is reading or writing, nor can you read if 
someone else is writing.  Makes a person a bit more comfy about data
remaining uncorrupted.

This is for a BTree hash, which has it's uses, but is easy to modify 
to a straight tied hash, or an in-memory hash for that matter.

The '1;'s at the end of each sub are because I have strange code 
habits. Oh well.

### Code Start

use Fcntl;  
use DB_File;
sub SearchCompare { "\L$_[0]" cmp "\L$_[1]" }
$DB_BTREE->{compare} = 'SearchCompare';

#-------------------------------Sub read_data
------------------------------#
sub read_data{
   $DBPATH   = "$pathto/data";
   $DATA     = "$DBPATH/dbm_Data";
   $DBLOCK   = "$DBPATH/dbm_Data_lock";
   
   sysopen(DB_FH, $DBLOCK, O_CREAT|O_RDWR, 0644) or die "can't open
$DBLOCK: $!";
   open(DB_LH, "+<&=DB_FH") or die "Read Data fileopen: $!\n";
    
    unless (flock (DB_LH, LOCK_SH | LOCK_NB)){
       unless (flock (DB_LH, LOCK_SH)) { die "Read flock DBLOCK: $!\n" }
   }
   
   $db_obj = tie(%Data, 'DB_File',$DATA, O_RDONLY|O_CREAT,
0600,$DB_BTREE);
   
1;
} # end of read_data

#-------------------------------Sub write_data
------------------------------#
sub write_data{
   $DBPATH   = "$pathto/data";
   $DATA     = "$DBPATH/dbm_Data";
   $DBLOCK   = "$DBPATH/dbm_Data_lock";
   
   sysopen(DB_FH, $DBLOCK, O_CREAT|O_RDWR, 0644) or die "can't open
$DBLOCK: $!";
   open(DB_LH, "+<&=DB_FH") or die "Write Data fileopen: $!\n";
   
    unless (flock (DB_LH, LOCK_EX | LOCK_NB)){
       unless (flock (LH, LOCK_EX)) { die "Write flock DBLOCK: $!\n" }
   }
   $db_obj = tie(%Data, 'DB_File',$DATA, O_CREAT|O_RDWR,
0600,$DB_BTREE);
   
1;
} # end of write_data


#------------------------------SUB close_data
---------------------------#
sub close_data {
   $db_obj->sync();  
   undef $db_obj;
   untie %Data;
   close DB_FH;
   flock(DB_LH, LOCK_UN);
   close DB_LH;
   
 1;
} # end of sub close_data


usage:

# Store something
&write_data;
$Data{$Key) = $value;
&close_data;

# later on...
&read_data;
$value = $Data{$Key};
$close_data;

print "$value\n";


### End code

I'm sure someone will jump in with a comment or twelve if there is a 
problem with this, though as I say, it's lifted from production code 
that is in use everyday, so it shouldn't be too broken.

hth,

Steve


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

Date: 18 Aug 2000 09:20:27 GMT
From: <jari.aalto@poboxes.com> (Jari Aalto+mail.perl)
Subject: Emacs modules for Perl programming
Message-Id: <perl-faq/emacs-lisp-modules_966590343@rtfm.mit.edu>

Archive-name: perl-faq/emacs-lisp-modules
Posting-Frequency: 2 times a month
URL: http://home.eu.org/~jari/ema-keys.html
Maintainer: Jari Aalto <jari.aalto@poboxes.com>

Announcement: "What Emacs lisp modules can help with programming Perl"

    Preface

        Emacs is your friend if you have to do anything comcerning software
        development: It offers plug-in modules, written in Emacs lisp
        (elisp) language, that makes all your programmings wishes come
        true. Please introduce yourself to Emacs and your programming era
        will get a new light.

    Where to find Emacs

        XEmacs/Emacs, is available to various platforms:

        o   Unix:
            If you don't have one, bust your sysadm.
            http://www.gnu.org/software/emacs/emacs.html
            http://www.xemacs.org/
            Emacs resources at http://home.eu.org/~jari/emacs-elisp.html

        o   W9x/NT:
            http://www.gnu.org/software/emacs/windows/ntemacs.html

Emacs Perl Modules

    Cperl -- Perl programming mode

        .ftp://ftp.math.ohio-state.edu/pub/users/ilya/perl
        .<olson@mcs.anl.gov>           Bob Olson (started 1991)
        .<ilya@math.ohio-state.edu>    Ilya Zakharevich

        Major mode for editing perl files. Forget the default
        `perl-mode' that comes with Emacs, this is much better. Comes
        starndard in newest Emacs.

    TinyPerl -- Perl related utilities

        .http://home.eu.org/~jari/tiny-tools-beta.zip
        .http://home.eu.org/~jari/emacs-tiny-tools.html

        If you ever wonder how to deal with Perl POD pages or how to find
        documentation from all perl manpages, this package is for you.
        Couple of keystrokes and all the documentaion is in your hands.

        o   Instant function help: See documentation of `shift', `pop'...
        o   Show Perl manual pages in *pod* buffer
        o   Load source code into Emacs, like Devel::DProf.pm
        o   Grep through all Perl manpages (.pod)
        o   Follow POD manpage references to next pod page with TinyUrl
        o   Coloured pod pages with `font-lock'
        o   Separate `tiperl-pod-view-mode' for jumping topics and pages
            forward and backward in *pod* buffer.
        o   TinyUrl is used to jump to URLs (other pod pages, man pages etc)
            mentioned in POD pages. (It's a general URL minor mode)

    TinyIgrep -- Perl Code browsing and easy grepping

        [TinyIgrep is included in the tgz mentioned above]

        To grep from all installed Perl modules, define database to
        TinyIgrep. There is example in the tgz (ema-tigr.ini) that shows
        how to set up datatbases for Perl5, Perl4 whatever you have
        installed

        TinyIgrep calls Igrep.el to run the find for you, You can adjust
        recursive grep options, ignored case, add user grep options.

        You can get `igrep.el' module from <kevinr@ihs.com>. Ask for copy.
        Check also ftp://ftp.ihs.com/pub/kevinr/

    TinyCompile -- Browsing grep results in Emacs *compile* buffer

        TinyCompile is minor mode for *compile* buffer from where
        you can collapse unwanted lines, shorten the file URLs

            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file1:NNN: MATCHED TEXT
            /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/file2:NNN: MATCHED TEXT

            -->
            cd /asd/asd/asd/asd/ads/as/da/sd/as/as/asd/
            file1:NNN: MATCHED TEXT
            file1:NNN: MATCHED TEXT

End



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

Date: 17 Aug 2000 23:58:04 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Eval and Regexps Help
Message-Id: <8nifos$h83$1@provolone.cs.utexas.edu>

In article <MPG.14074305e059a80a9896ca@localhost>,
jason  <elephant@squirrelgroup.com> wrote:
>Logan Shaw wrote ..
>>So, why not try this?
>>
>>	$str =~ s/<%(.*?)%>/$1/esg;
>
>did you try it ? .. I'm guessing not
>
>$1 is evaluated by /e .. but the evaluation of $1 is simply the code 
>lines .. and they're substituted (not executed)

Doh!  I suppose that makes sense.  I got confused by the fact that "e"
as s/// modifier stands for "evaluate" (according to "perldoc perlop")
but what "evaluate" means in this case is not "use the string as perl
code" (like eval()).  Instead, it means "take the value of the perl
expression given" rather than "substitute the given string".

Anyway, I guess the answer to the original poster's question is that
doing a "print" in the second half of the s/// isn't useful, since that
sends to standard output, whereas the goal would be to create a perl
expression whose value is a certain string, so that the string can be
substituted into the original expression.

  - Logan


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

Date: Fri, 18 Aug 2000 08:46:06 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Eval and Regexps Help
Message-Id: <MPG.1407953c7c3ce0589896cd@localhost>

Logan Shaw wrote ..
>In article <MPG.14074305e059a80a9896ca@localhost>,
>jason  <elephant@squirrelgroup.com> wrote:
>>Logan Shaw wrote ..
>>>So, why not try this?
>>>
>>>	$str =~ s/<%(.*?)%>/$1/esg;
>>
>>did you try it ? .. I'm guessing not
>>
>>$1 is evaluated by /e .. but the evaluation of $1 is simply the code 
>>lines .. and they're substituted (not executed)
>
>Doh!  I suppose that makes sense.  I got confused by the fact that "e"
>as s/// modifier stands for "evaluate" (according to "perldoc perlop")
>but what "evaluate" means in this case is not "use the string as perl
>code" (like eval()).  Instead, it means "take the value of the perl
>expression given" rather than "substitute the given string".
>
>Anyway, I guess the answer to the original poster's question is that
>doing a "print" in the second half of the s/// isn't useful, since that
>sends to standard output, whereas the goal would be to create a perl
>expression whose value is a certain string, so that the string can be
>substituted into the original expression.

that was my 'guess' too *8^)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Fri, 18 Aug 2000 06:33:08 GMT
From: Steven May <stevenjm@telisphere.com>
Subject: Re: GD.pm Test Fails?
Message-Id: <399CD868.D3E6B91B@telisphere.com>

brudden@goebusiness.com wrote:
> 
> I'm having problems with the GD.pm module on sun sparc solaris 2.6

For what it's worth, I spent 2 days a month or so back trying to get 
GD working on a linux box (admittedly with pretty well hosed libraries)
and after finally getting it running, dicovered it really wouldn't do
what I wanted anyway. (I know, RTFM BEFORE installing)

So I snooped around and gave Magick a shot.

Painless install, it's a giggle to play with, and it does 
what I want it to do.  

my $.02.

Steve


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

Date: Thu, 17 Aug 2000 22:34:35 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: help i'm stuck!!!
Message-Id: <MPG.14066ac95a03dbbf98ac90@nntp.hpl.hp.com>

In article <966554112.593026@hpvablab.cup.hp.com>, 
nospam@hairball.cup.hp.com says...

 ...

> And for those inclined to use Perl for spamming, DOS, and other such
> activities:
> 
> @sorted = sort { ${[-1,0,1]}[rand 3] } @data; # will sort alphab-unethically
> 
> Rich (Sorry, couldn't resist and no, I don't think this is a good way to
> shuffle.)

Indeed, though I've seen postings here that proposed it seriously.

With older perls that used the C qsort function, an stochastic sortsub 
could lead to meltdown.  I don't know if this has been fixed in the 
reimplementation using internal C code.

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


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

Date: Fri, 18 Aug 2000 05:34:56 GMT
From: "Pekka Siiskonen" <psi@nospam.mikrolog.fi>
Subject: Re: How to change Popup frame's URL
Message-Id: <4W3n5.22$Du4.98@read2.inet.fi>

I found the way to do it! Thanks for consturctive assistance!

print   $query->start_form(
                        -target=>'TargetFrame',
                        -method=>'GET'); #  <=== This is what I was after!!!
Pekka Siiskonen

"Pekka Siiskonen" <psi@nospam.mikrolog.fi> wrote in message
news:ZK8m5.107$vY.8731@read2.inet.fi...
>
> "Colin Keith" <newsgroups@ckeith.clara.net> wrote in message
news:NwRl5.123>
>
> > *sigh* Please, don't do this. This question has *nothing* to do with
Perl.
> > The fact that the program producing this HTML is written in Perl is
> > entirely irrelevant to this question.
>
> Sorry to upset! The problem is not with the enviroment, nor browser, nor
> outlook! it is about the way CGI.pm sends form parameters by default.
>
> I choose an example that all can access (Stein's site!) instead of my own
> script, so that one may also verify that the popup window has the same URL
> as the original. The outlook mailing thing was a proof of the fact that
the
> URL of the popup window created with CGI.pm is not related to the form
> output, and that the form query parameters are sent by default as GET, not
> as POST.
>
> The question is: How to create a form that sends the form query parameters
> as POST? Clickable hot link will not alone do, as the contents of the hot
> link should be changed according to the way the form on same page is
filled
> (or an intermediate page should be created with the form that has the
> cklickable hot link formulated accordingly).
>
> This, as well as news:comp.infosystems.www.authoring.cgi were mentioned as
> dicussion groups concerning CGI.pm related matters on
> http://stein.cshl.org/WWW/software/CGI/ (propably more than this group!).
>
> Again, sorry to cause nuisance!
>
> Pekka Siiskonen
>
>
>




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

Date: 17 Aug 2000 21:30:16 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: how to ignore ampersand in post operation
Message-Id: <8nhi0o$1fn$1@orpheus.gellyfish.com>

On Thu, 17 Aug 2000 18:14:36 GMT narasim@usc.edu wrote:
> Hi, I am using the LWP module to fetch a web page using the POST
> operation. Now, I have a line of code as follows:
> 
> $req->content("field_1=$name&field_2=$loc");
> 
> 
> where field_1 and field_2 are specified in the original html code of
> the webpage, and the variables $name and $loc are what i pass.
> 
> there are no problems with the line above, except when $name (say),
> contains an '&' itself, e.g., AT&T. at this point, it takes the name as
> AT and ignores the &T.
> I have tried using single quotes around the whole expression, but that
> causes problems with the variables $name and $loc.
> is there an easy fix?
> 

It needs to be URL encoded - '&' would be %26 for instance - however you
will want to be able to something like the module URI::Escape ...

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 18 Aug 2000 00:43:21 -0400
From: darkon@one.net (David Wall)
Subject: Re: I have another question
Message-Id: <8F941270darkononenet@206.112.192.118>

pape_98@my-deja.com wrote in <8nhpv0$i6$1@nnrp1.deja.com>:

>But now I have another problem,
>This is what my database looks like:
>
>NIH,B1D-403,01 36,13 5 26   ,15 43,1 5 2 5 2 4
>NIH,B1D-415,01 36,13 5 26   ,15 43,1 5 2 5 2 4
>NIH,B1D-43,01 36,13 5 26   ,15 43,1 5 2 5 2 4
>Suburban,B1D-10,52 51 36,135 256   ,15413,1512
>
>the numbers I'm trying to sort are the ones after the B1D-,
>how do i get the sort to not considery those characters ???

Here's one way to do it.  It's certainly not the only way, probably not the 
best way, and I might possibly be making some unwarranted assumptions about 
your data.  I assumed that your data will always be broken into fields by 
commas, and that the second is the only one to have a dash (-) in it.  I 
also assumed that the part after the dash will always be numeric.

Given that, below is my attempt at it.  I have some vague notion that the 
Schwartzian transform might be useful here, but I'm not fully comfortable 
that that critter yet, so I left it alone.


--- start code ---
#!/usr/bin/perl -w
use strict;

my @data=();
while (<DATA>) {
    my @fields = split /,|-/;
    push @data, \@fields;
}

# assuming numeric sort; if not, use cmp instead of <=>
my @data = sort { $a->[2] <=> $b->[2] } @data;

foreach my $r (@data) {
    splice @{$r}, 1, 2, "$r->[1]-$r->[2]";
    print join(",", @{$r});
}

__DATA__
NIH,B1D-403,01 36,13 5 26   ,15 43,1 5 2 5 2 4
NIH,B1D-415,01 36,13 5 26   ,15 43,1 5 2 5 2 4
NIH,B1D-43,01 36,13 5 26   ,15 43,1 5 2 5 2 4
Suburban,B1D-10,52 51 36,135 256   ,15413,1512
--- end code ---

This gives us the output:

Suburban,B1D-10,52 51 36,135 256   ,15413,1512
NIH,B1D-43,01 36,13 5 26   ,15 43,1 5 2 5 2 4
NIH,B1D-403,01 36,13 5 26   ,15 43,1 5 2 5 2 4
NIH,B1D-415,01 36,13 5 26   ,15 43,1 5 2 5 2 4


And now that I've posted this, someone will almost undoubtedly tell me that 
this is a crude, ugly, and horribly inefficient way to do it.  But that's 
ok, since they'll show me a better way to do it, I hope.

-- 
David Wall
darkon@one.net


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

Date: 18 Aug 2000 08:20:32 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Image Manipulation Question
Message-Id: <8nio40$2u7$1@orpheus.gellyfish.com>

On Wed, 16 Aug 2000 21:32:10 GMT James wrote:
> Does anyone know of any routines, scripts or recommendations on creating a
> script that would take
> a directory of images and create a new directory of those
> same images - only shrunken in size?
> 

The module Image::Magick is probably what you want to be using.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Fri, 18 Aug 2000 10:08:23 +0100
From: "pete" <pete@alphanetcoms.co.uk>
Subject: install DBD problem
Message-Id: <399d022c.1@energise.enta.net>

Hi everyone,

I'm having problems with installing DBD for MySQL on Win98, via the command
in the MySQL manual which I try using:
    PPM> install DBD::mysql:http://...

After installing DBI, which runs smoothly, I get thrown out of the PPM
program and DBD is not installed. So I am unable to get Perl to work with
MySQL.

I have got this to work in the past on a similar machine, The only
significant difference being that I am using an AMD processor not Intel. Am
I right in thinking that DBD can't be installed on this machine? I think I
have read somewhere about Intel only distributions.

Thanks for your help.

Pete





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

Date: Fri, 18 Aug 2000 10:28:02 +0200
From: "Lincoln Marr" <lincolnmarr@nospam.europem01.nt.com>
Subject: Modifying a text file
Message-Id: <8nis26$moo$1@qnsgh006.europe.nortel.com>

I have a database stored in text files which is interfaced to the web
through a perl script. The script allows you to modify, add and delete
customers from the database - but it's a bit more complex than having one
database file to store all the information. Depending on the type of
customer, the information is stored in a different file when adding the
customer.
I am writing the 'modify' part of the script and am having a few problems.
The records in the file look like this:

966266540|8/14/2000 at 17:22:40|Name of Customer|field1|field 2|field
3|field n|

I have a screen which opens the file, splits all the lines and displays the
name of the customer in a scrolling list. When you select the customer and
click 'View' the index is stored in $key (ie $key would be 966266540 in this
case, is that customer was selected). What I want to be able to do is modify
all the customer information through a form, then open the file, seek to the
line beginning with $key, and overwrite that line with the updated
information.

The files will be fairly small (easily small enough to read through each
line with the diamond operator).

What I want the perl to do:
1. open file
2. Seek to line beginning with $key
3. print over that line with updated information
4. close the file
5. have the file locked while doing so (to avoid data corruption)

Any ideas? Thanks very much...

Lincoln




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

Date: 18 Aug 2000 07:38:53 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: newbie - documentation
Message-Id: <8nillt$2q5$1@orpheus.gellyfish.com>

On Thu, 17 Aug 2000 11:28:37 GMT Gecco th Ruled wrote:
> where i can find the dicumentation onf Net:IRC?
> i search the documentation of command like
> 
>         $self->join("#IRC.pm");
>         $self->privmsg("#IRC.pm", &pickrandom());
>         $self->topic("#IRC.pm");
> 

The documentation is distributed with the module - type man Net::IRC or
perldoc Net::IRC at the command prompt.  However the documentation *doesnt*
describe the methods that initiate IRC commands as you are supposed to know
them already - you will need to find some general documentation describing
the IRC protocol.

/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: 18 Aug 2000 06:35:01 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Out of memory! error. Working with arrays...
Message-Id: <8nilel$k93$1@slb7.atl.mindspring.net>

Mark-Jason Dominus (mjd@plover.com) wrote:
: I think that when someone points out a serious problem in your code,
: it is a mistake to say that you will fix it *after* you fix some other
: problem.  Often the two problems are related.  
: 
: Many times when I teach people to program, I see them make this
: mistake: Their program has two errors in it, and it doesn't work.
: They say "Oh, I see the error," and then they fix error A, but then
: their program still doesn't work.  So they decide that they were
: wrong, and they undo the change.  Then maybe they find error B and fix
: that.  But the program still does not work because they still have
: error A.  Then they think they don't know what is wrong, even though
: they found both errors!  They give up, or they start trying all sorts
: of other things that are not connected with the real problem.
: 
: When someone points out a serious error in your program, it is foolish
: not to fix it right away.  It often happens that one error masks the
: behavior of another.  Debugging is difficult, and when two or three
: errors combine the result can be impossible to figure out.

In a previous thread, Randal was talking about factors that can affect 
whether or not one can become a good programmer.  He focused more on 
aptitude/intelligence factors, but as Gerald Weinberg pointed out long 
ago, few programmers have seen a programmer who failed because he wasn't 
intelligent enough (that *may* have changed a little bit in the last 
thirty years, but probably not as much as many people think), but every 
programmer has seen someone who failed as a programmer because he wasn't 
temperamentally suited for it.  I'd like to mention a few personality 
factors that affect programming ability, as well as a few that 
specifically affect one's ability to get something out of this group.

One of the most important personality factors is the willingness to admit
to yourself that you make mistakes, and to do it without regarding making
a mistake as a blow to your ego.  Nobody goes through life without making
mistakes, and nobody programs without making *lots* of mistakes.  But if
you regard your own fallibility as threatening, you're not going to avoid
making mistakes; instead you're going to avoid noticing the mistakes
you've made, and you're going to insist that your mistaken code is
correct.  There is no possible way to be successful as a programmer with
an attitude like that. 

And in order to use this group effectively, you have to be willing to let
other people point out your mistakes and *not* regard such communication
as an attack you must defend yourself against.  Due to the phenomenon
called "psychological set" (the natural tendency to see what you want to
be there rather than what's actually there), other people can often do a
better job of spotting your mistakes than you can.  When they point out 
your mistakes, they're *helping* you.  Yes, I've *occasionally* seen 
people do it in a gloating and hostile manner, but far more times I've 
seen someone factually and non-judgmentally point out someone's mistake 
and then the original poster acts as if he's been attacked.  Some of this 
is the result of the lack of non-verbal cues in this medium.  Some of it 
is the result of assumptions of Anglo-American "boy culture" that a Real 
Man must be right all the time and must prevail in every conflict.  Some 
of it is probably the result of the fact that young males with high 
quantitative skills, low-to-middling verbal skills, and low social skills 
(i.e. stereotypical lonergeeks) can't seem to communicate in anything but 
snarls.  But if you can get over this stupid notion that every 
interaction between two human beings has to be a battle with a winner and 
a loser, you can become a better programmer through feedback.

A very desirable personality trait for programmers is the desire for
improvement: an unwillingness to be satisfied with sloppy,
just-barely-does-the-job, "good enough for government work" code.  Now
this trait is actually one that has to be kept in check a bit or else it
turns into perfectionism and keeps you from getting any useful work done
because you're spending all your time polishing things that don't need to
be polished (e.g. squeezing the last few cycles out of a piece of code
that runs only once).  But the ability to acknowledge that "this code is
good, but it could be better" is important to your growth as a programmer. 
And that also means not being put off when others on this group point out
how your code, even though it works, could be further improved.  This is a
discussion group, not a help desk, so if you come here with a problem,
many of us will *discuss* aspects of your code that you didn't
specifically ask about.  If you can accept this, you'll benefit greatly by
learning MTOWTDI. 

Finally, there's the view that learning is a Good Thing, not a chore to be
done only when you're forced to.  The first step in learning something is
admitting to yourself that there's something you don't know.  If that's
threatening to you, you're not going to make it as a programmer.  The
second step is realizing that you *are* capable of learning it, and the
third step is making a mental list of the resources that are available to
you for learning it, rather than just grabbing at the first one that comes
to mind.  Perl has better and cheaper learning resources than most
programming languages.  But you will *not* succeed as a programmer if you
take the attitude "I need to do this but I don't want to bother
understanding how."  Programming is not a set of magical incantations you
can memorize.  It is the systematic arrangement of little blocks into big
blocks into even bigger blocks, and the most important thing is knowing
how the blocks fit together. 



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

Date: 18 Aug 2000 07:45:57 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Output to printer in Win NT
Message-Id: <8nim35$2qq$1@orpheus.gellyfish.com>

On Thu, 17 Aug 2000 15:13:38 GMT hiroshiishii@my-deja.com wrote:
> Hi All:
> 
> Would someone give an advice on how to print an ASCII string, "Hello
> world," to LaserJet4, which is on local parallel port (LPT1:), from
> WinNT or 98?
> 

open(PRINTER,'>LPT1:') || die "Can't open printer - $!\n";
print "Hello, World\n";

print "\f"; # Some printers will require this line feed before producing
            # a page

close PRINTER;

On shared printers you can use the UNC name of the printer (\\server\printer).

/J\
/J\
-- 
yapc::Europe in assocation with the Institute Of Contemporary Arts
   <http://www.yapc.org/Europe/>   <http://www.ica.org.uk>


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

Date: Fri, 18 Aug 2000 09:02:57 GMT
From: jason <elephant@squirrelgroup.com>
Subject: Re: Output to printer in Win NT
Message-Id: <MPG.1407993347433e99896ce@localhost>

Jonathan Stowe wrote ..
>On Thu, 17 Aug 2000 15:13:38 GMT hiroshiishii@my-deja.com wrote:
>> Hi All:
>> 
>> Would someone give an advice on how to print an ASCII string, "Hello
>> world," to LaserJet4, which is on local parallel port (LPT1:), from
>> WinNT or 98?
>> 
>
>open(PRINTER,'>LPT1:') || die "Can't open printer - $!\n";
>print "Hello, World\n";
>
>print "\f"; # Some printers will require this line feed before producing
>            # a page
>
>close PRINTER;
>
>On shared printers you can use the UNC name of the printer (\\server\printer).

of course - Jonathan meant to write

  print PRINTER "Hello, World\n";
  print PRINTER "\f";

or maybe a select disappeared from my newsfeed ;)

-- 
  jason -- elephant@squirrelgroup.com --


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

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


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