[11118] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4718 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 22 05:06:22 1999

Date: Fri, 22 Jan 99 02:00:20 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 22 Jan 1999     Volume: 8 Number: 4718

Today's topics:
    Re: [Perlscript + WSH]: Can't get it to work <matthew.sergeant@eml.ericsson.se>
        Data Files without using text files. (Rob Hill)
    Re: Data Files without using text files. <ebohlman@netcom.com>
        European Characters again :Active State 509 (Owen Cook)
    Re: File Upload. <eugene@snailgem.org>
    Re: Filelisting of Dir & Subdir <ollie.spencer@lmco.com>
        gethostbyname troubles (Lee Brandson)
    Re: How do I define a scalar name with a scalar <dgris@moiraine.dimensional.com>
    Re: How long would the Unixes last without Perl? <address@web.page>
    Re: How long would the Unixes last without Perl? <dgris@moiraine.dimensional.com>
        installation of Perl on Digital Unix <david.ahrens@dnr.qld.gov.au>
        Memory management <partha@mihy.mot.com>
    Re: Newbie - Whats wrong with this script? <ebohlman@netcom.com>
    Re: Newbie - Whats wrong with this script? dave@mag-sol.com
    Re: perl script error (J|rgen P|nter)
    Re: Please help me to use sockets <ebohlman@netcom.com>
    Re: Random Invoice # (Larry Rosler)
    Re: Random Invoice # dave@mag-sol.com
        Safely editing /etc/passwd. <vertigan@iinet.net.au>
    Re: Specifying Location in Perl <jamesht@idt.net>
    Re: ssl. <jamesht@idt.net>
    Re: Trying to work with a text database <jamesht@idt.net>
    Re: URGENT Perl Programmer needed (Intervid)
        URGENTLY want some help leostar@mailcity.com
    Re: URGENTLY want some help <m_ching@hotmail.com>
        WIN32::OLE, Word Dir Info billdraper@my-dejanews.com
    Re: writing to files (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Fri, 22 Jan 1999 09:34:20 +0000
From: Matt Sergeant <matthew.sergeant@eml.ericsson.se>
Subject: Re: [Perlscript + WSH]: Can't get it to work
Message-Id: <36A8461C.BB53912E@eml.ericsson.se>

Harshal Chhaya wrote:
> 
> Hi
> 
> I am trying to use the example scriptlets from the "Scriptlets" article in the
> Perl Journal (issue #12).
> 
> On my Win95 box, I have the WSH engine, the DCOM95 stuff, AS Perl (build 507)
> and VB 6.0.
> 
> The sample VBScript and JScript scriplets run fine (showing that the WSH stuff
> works fine) but when I try to run the PerlScript file (via the Visual Basic
> interface), I get an error saying "Cannot create script engine: PerlScript".
> The debugger points to the "CreateObject" statement in the VB app.

I think this is a bug in either PerlScript, or the Scriplets Beta2. I
had trouble with scriptlets beta2 and so went back to beta1. I don't
think MS have beta1 available any more, so contact me directly and I'll
try and find it on my drive.

-- 
<Matt email="matt@teamamiga.org" />

| Fastnet Software Ltd              |   Perl in Active Server Pages   |
| Perl Consultancy, Web Development |   Database Design   |    XML    |
| http://come.to/fastnet            |    Information Consolidation    |


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

Date: Fri, 22 Jan 1999 07:35:38 GMT
From: rhill@thisbox.com (Rob Hill)
Subject: Data Files without using text files.
Message-Id: <36a82529.5998984@209.163.152.65>

	I am attempting to write a perl program that manipulates a
fair amount of data. Right now, all of my data is stored in ascii text
files that I read in one line at a time, but I am wanting to use
something a little for versatile. dbm will not work for me because I
am looking for more that key/value pairs.

I come from a C programming background and in the past I would merely
make a struct.

For those C programmers:

struct data1 {
	char val1[20];
	char val2[20];
	char val3[100];
	long val4;
} mydata1;

When I would save this to a file I would make the length sizeof(struct
data1) and if I needed to pull the 52nd record out of the file, I did
a seek for sizeof(struct data1) * 52 and read sizeof(struct data1)
bytes into my struct var (mydata1)...

Can anyone give any insight into how I would do this with Perl?

Examples would be nice but I might be reaching.

Thanks in advance`

Rob Hill
rhill@thisbox.com





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

Date: Fri, 22 Jan 1999 08:12:16 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Data Files without using text files.
Message-Id: <ebohlmanF5yC4G.I87@netcom.com>

Rob Hill <rhill@thisbox.com> wrote:
: 	I am attempting to write a perl program that manipulates a
: fair amount of data. Right now, all of my data is stored in ascii text
: files that I read in one line at a time, but I am wanting to use
: something a little for versatile. dbm will not work for me because I
: am looking for more that key/value pairs.

[snip]
: When I would save this to a file I would make the length sizeof(struct
: data1) and if I needed to pull the 52nd record out of the file, I did
: a seek for sizeof(struct data1) * 52 and read sizeof(struct data1)
: bytes into my struct var (mydata1)...

: Can anyone give any insight into how I would do this with Perl?

Take a look at the documentation for:

pack
unpack
read
sysread
syswrite
seek
tell

You should be able to cobble up something with those.



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

Date: Fri, 22 Jan 1999 09:39:52 GMT
From: rcook@pcug.org.au (Owen Cook)
Subject: European Characters again :Active State 509
Message-Id: <36ae430e.42375849@newshost.pcug.org.au>

I am using Activestate perl for MSWin32 build 509, and cannot enter
"European" characters correctly.

As I got a different response from build 508, I thought it might be an
Activestate perl problem, 

The program below prints out 246, 242, 251 where  I would have expected
148,149,150.

Now I am thinking it is maybe a keyboard problem. I suspect if the program
was run on an English(English) keyboard the results would be different .
(I am using an English (United States) keyboard). 

Would appreciate any suggestions as to what I should be doing.

(I have the corresspondence from    Upper and lower case problem with
swedish chars (<36A1C5A0.E11F7F80@lc.vetlanda.se>) but
I do not have perllocale manpage with my documentation. I also tried 
use locale;  This did not even produce an error message despite the fact I
don't have it.)


Owen

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

#!/usr/local/bin/perl -w
#The next 7 lines just prints a table for reference 
for ($j=128;$j<256;$j+=10){
    for ($i=0;$i<10;$i++){
	$a=chr($j+$i);
	$b=$j+$i;
	print "$b=$a ";
    }print "\n";
}

# Now assign a variable to ouml (Alt +148)
# ograve (Alt+149) and ucirc(Alt+150);
# If there is no "" around the character, I get "Unrecognized character"
# error \366 with oulm,\362 with ograve ,\373 withucirc

$a="v";$b="r";$c="{";     #Alt+148,Alt+149,Alt+150 on my system
# this is ok also   $a='v';$b='r';$c='{';
print "\n";

# Now find out what $a $b $c prints out.

$d =ord $a;$e=ord $b; $f=ord $c;
print " $a =$d   $b =$e   $c =$f\n";


__END__



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

Date: Thu, 21 Jan 1999 22:58:50 -0500
From: Eugene Sotirescu <eugene@snailgem.org>
Subject: Re: File Upload.
Message-Id: <36A7F77A.6906352E@snailgem.org>

Ghulam Hussein Kara wrote:
> 
> Assuming that your file input variable is "cv" , the following should
> suffice :
> 
> #-------Beginning Code----------
> 
> #!/usr/bin/perl
> require "cgi-lib.pl";
> &ReadParse;
> open (F, ">uploaded.dat");
> print F "$in{'cv'}\n";
> close (F);
> 
> #-------End of Code-------------



what are you talking about, dude? Ever tried this with a binary?

-- 

Eugene

 "I have an Apache Web Server that uses CGI forms written in COBOL."
 							Post in clpm


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

Date: Thu, 21 Jan 1999 15:47:18 -0500
From: "O. S. Spencer" <ollie.spencer@lmco.com>
Subject: Re: Filelisting of Dir & Subdir
Message-Id: <36A79256.61674AC4@lmco.com>

Try:
$dir="c:\\something\\";
opendir(DIR, $dir) or die "Can't open $dir\n";
@FilesInDir=readdir(DIR);
closedir DIR;
foreach (@FilesInDir){print "$_\n";}

Or you can type perldoc readdir at the command line to read about the same.

Yeah, I had homegrown code till I found this!

Ollie Spencer

Charles R. Thompson wrote:

> Charles R. Thompson wrote in message
> <76luqh$1an@bgtnsc03.worldnet.att.net>...
> >>Could someone please show me an example of how to have listed all
> files of
> >a
> >>directory & its subdirectories (to push them lateron into an array) ?
> >>The only input needed is a physical root-directory like 'c:\data\' .
>
> >Feel free to ask anything about the code.
>
> Except how stupid I am to be using it. What a waste of resources.
>
> Still learning,
>
> CT





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

Date: 22 Jan 1999 09:36:27 GMT
From: rlb@intrinsix.ca (Lee Brandson)
Subject: gethostbyname troubles
Message-Id: <rlb-2201990448100001@204.112.166.54>

Morning, all

I've got this little script that used to work, but no longer...

Code snippet:

      ($name, $aliases, $type, $length, @addrs) = gethostbyname ($dn);
      print " dn: $dn\n";
      print "  n: $name\n";
      print "  a: $aliases\n";
      print "  t: $type\n";
      print "  l: $length\n";
      print "  #: $#addrs\n";

and the results:

 dn: revelstoke-11.junction.net
  n: revelstoke-11.junction.net
  a:
  t: 2
  l: 4
  #: 0

Yet the same name resolves to an ip# on the same machine using nslookup,
and the (lack of) results are the same on four machines.

So... has something changed with gethostbyname?

-- 
Lee Brandson, Burnt Lake Software and Intrinsix Canada


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

Date: 22 Jan 1999 00:13:34 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: How do I define a scalar name with a scalar
Message-Id: <m3yamvhja9.fsf@moiraine.dimensional.com>

abigail@fnx.com (Abigail) writes:

>                    (${"special$scalar1"} is actually using a hash)

Only in the sense that everything not lexical is using a hash.  Not
a very useful distinction.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: 21 Jan 1999 22:19:37 PST
From: "Phlip" <address@web.page>
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <78959p$bb@chronicle.concentric.net>

Abigail escribis:
>Phlip:
>{}
>{} Is anyone out there running a Unix with no Perl installed?
>
>
>Gazillions of systems. I wouldn't be surprised if there are more
>Unix systems where Perl isn't used than Unix systems where Perl
>is used.
>
>But I have no data to prove it.

Uh, if anyone were doing the actual survey, they'd then chart the
results against the age of the system. Some Unixes could conceivably
have been running their programs for decades without anyone messing
with the system or upgrading.

So rephrase my question as "how long would Unixes maintain or increase
market share without Perl?"...

  --
 Phlip at politizen dot com                  (address munged)
======= http://users.deltanet.com/~tegan/home.html =======
  --  Workers Arise! Overthrow the Proletariat!  --




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

Date: 22 Jan 1999 00:18:39 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <m3u2xjhj1s.fsf@moiraine.dimensional.com>

"Alan J. Flavell" <flavell@mail.cern.ch> writes:

> I often run Perl with no Unix installed ;-)

At least there is some sign of civilization in yonder heathen
lands.  :-)

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Fri, 22 Jan 1999 17:30:35 +1000
From: "David Ahrens" <david.ahrens@dnr.qld.gov.au>
Subject: installation of Perl on Digital Unix
Message-Id: <7899ef$sd66@inet6.citec.com.au>

Trying to install the latest version of Perl on Digital Unix system
results in the following error (half way through make process.

AutoSplitting perl library

 ./miniperl -Ilib -e 'use AutoSplit; autosplit_lib_modules(@ARGV)' lib/*.pm
lib/*/*.pm

Package Getopt::Long (Getopt/Long.pm) does not match filename
lib/getopt/long.pm at

lib/AutoSplit.pm line 244, <IN> chunk 58289.

*** Exit 255

Stop.

seems to be a problem with the module (Autosplit?)
and this is the output of myconfig if it may be of use.

Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration:
Platform:

osname=dec_osf, osvers=4.0, archname=alpha-dec_osf-thread

uname='osf1 slicca.dnr.qld.gov.au v4.0 564.32 alpha '

hint=recommended, useposix=true, d_sigaction=define

usethreads=define useperlio=undef d_sfio=undef

Compiler:

cc='cc', optimize='-O4', gccversion=

cppflags='-pthread -std -ieee -D_INTRINSICS -I/usr/local/include -D__LANGUAG
E_C__'

ccflags ='-pthread -std -fprm
d -ieee -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'

stdchar='unsigned char', d_stdstdio=define, usevfork=true

intsize=4, longsize=8, ptrsize=8, doublesize=8

d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8

alignbytes=8, usemymalloc=n, prototype=define

Linker and Libraries:

ld='ld', ldflags =' -L/usr/local/lib'

libpth=/usr/local/lib /usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib
/var/shlib

libs=-ldbm -ldb -lm -lpthread -lexc

libc=/usr/shlib/libc.so, so=so, useshrplib=false, libperl=libperl.a

Dynamic Linking:

dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '

cccdlflags=' ', lddlflags='-shared -expect_unresolved
"*" -O4 -msym -s -L/usr/local/lib'


----------------------------------------------------------------------------
------------------------------------
David Ahrens
Drought Research Officer
Queensland Centre for Climate Applications
Climate Impacts and Grazing Systems
Department of Natural Resources
QCCA Building
Gate 4, 80 Meiers Road
Indooroopilly   Qld   4068                    Ph   +61 7 3896 9842
Australia                                           Fax  +61 7 3896 9843
E-mail: david.ahrens@dnr.qld.gov.au
URL:    www.dnr.qld.gov.au/longpdk/
----------------------------------------------------------------------------
------------------------------------




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

Date: Fri, 22 Jan 1999 13:12:49 +0530
From: Ramanujam Parthasarathi <partha@mihy.mot.com>
Subject: Memory management
Message-Id: <36A82BF9.887ECB18@mihy.mot.com>

Hi,

I have a query on how and when does PERL do memory management. I want to
know when does it free the memory - more correctly, how does it know
when to free the memory being used by a variable. This query becomes
more important when we use references (named or anonymous) inside
references - say in a class (OO Perl).

Any clarification is appreciated

-Partha



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

Date: Fri, 22 Jan 1999 07:01:58 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Newbie - Whats wrong with this script?
Message-Id: <ebohlmanF5y8vA.DzI@netcom.com>

Michael J. Bahr <targa@cornhusker.net> wrote:
: Extremely new to perl - go easy.

You should definitely check out the Perl FAQ; there's a lot of *very* 
useful information in there that will help you go from "extremely new to 
Perl" to "extremely good at Perl."

: I get this error -
: Can't modify subroutine entry in scalar assignment at
: E:\XITAMI\cgi-bin\netimage.cgi line 20, near "$hosts;"
: Execution of E:\XITAMI\cgi-bin\netimage.cgi aborted due to compilation
: errors.

: from the following script:
: #! perl

You want a -w on the end of that line so that perl can help you find 
problems in your code.  You also want a "use strict;" after that line so 
that perl can help you keep track of your variable names.

: use GD;
: # Collect IP nodes to ping
: open(NODES,'nodes.dat');

You want to check whether or not you successfully opened the file, and 
die() with an appropriate error message if not, rather than blindly 
plowing ahead.

: while() {

You need to supply an expression for while() to evaluate.  Since the 
program shouldn't have compiled without one, I'm guessing that you simply 
left it out when typing this article.  When you're posting code for other 
people to look at, it's a *very* good idea to copy-and-paste it into your 
post rather than retyping it.  Otherwise it's not clear whether an error 
in what you posted is really an error in your real code or just a typo 
that only exists in the post.  And worse, the phenomenon of 
"psychological set" can result in you unconsciously correcting an error 
in your original code when you retype it (set is basically the tendency 
to perceive what you expect to see rather than what you actually see). 

:   chop;

chomp() is almost always preferable to chop().

:   ($xy, $ipaddr) = split(" "); # parse into two values

If you had used strict as recommended, you'd need to put 'my' at the 
beginning of that line to declare your variables.  You'd also have needed 
to predeclare @check, preferably at the beginning of the program.  From 
now on I won't mention variables that needed to be declared, except once...

 :   push(@check,$ipaddr);        # add ip address to list
:   $hosts{$ipaddr} = $xy;      # add both to lookup table
:  }
: close(NODES);
: open(RESULTS, "ping -u @check 2>/dev/null |");
: open(GIF,"test.gif") || die;

You really should give an error message to indicate what went wrong that 
caused you to die.

:     $myImage = newFromGif GD::Image(GIF) || die;

Same here

: #   $RED = $im->colorAllocate(255,0,0);

Where did $im come from?  You've never assigned anything to it, and 
that's what's causing the error you got.  My guess is that you really 
meant $myImage here, since you don't use $myImage anywhere else.  If you 
had used the -w flag, perl would have warned you about that and you'd 
have already figured out the problem.

: $im->fill($x,$y,$RED);
: open(RESULTS, "ping -u @check 2>/dev/null |");

You already did that.  You should check the results of the open here as 
well.

: while() {            # While any failing nodes
:    chop;                         take off extraneous
:    $xy = $hosts{$_};          # Lookup x,y coordinate
:    ($x,$y) = split(/,/,$xy);  # parse it into x and y
:    $im->fill($x,$y,$red);  # flag the node as down
: }

: close(RESULTS);

You should check the results of a close() when the filehandle you're 
closing was a pipe.  Due to the way piping works, you may get a 
successful result from opening the pipe even if you can't run the 
piped-from program.

: $| = 1;
: print "Content-type: image/gif\n\n";
: print $im->gif;


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

Date: Fri, 22 Jan 1999 09:33:51 GMT
From: dave@mag-sol.com
Subject: Re: Newbie - Whats wrong with this script?
Message-Id: <789glv$dk9$1@nnrp1.dejanews.com>

In article <36A7FB93.DD491876@cornhusker.net>,
  "Michael J. Bahr" <targa@cornhusker.net> wrote:
> Extremely new to perl - go easy.
>
> I get this error -
> Can't modify subroutine entry in scalar assignment at
> E:\XITAMI\cgi-bin\netimage.cgi line 20, near "$hosts;"
> Execution of E:\XITAMI\cgi-bin\netimage.cgi aborted due to compilation
> errors.
>
> from the following script:
> #! perl
> use GD;
> # Collect IP nodes to ping
> open(NODES,'nodes.dat');
> while() {
>   chop;
>   ($xy, $ipaddr) = split(" "); # parse into two values
>   push(@check,$ipaddr);        # add ip address to list
>   $hosts{$ipaddr} = $xy;      # add both to lookup table
>  }
> close(NODES);
> open(RESULTS, "ping -u @check 2>/dev/null |");
> open(GIF,"test.gif") || die;
>     $myImage = newFromGif GD::Image(GIF) || die;
> #   $RED = $im->colorAllocate(255,0,0);
> $im->fill($x,$y,$RED);
> open(RESULTS, "ping -u @check 2>/dev/null |");
> while() {            # While any failing nodes
>    chop;                         take off extraneous
>    $xy = $hosts{$_};          # Lookup x,y coordinate
>    ($x,$y) = split(/,/,$xy);  # parse it into x and y
>    $im->fill($x,$y,$red);  # flag the node as down
> }
>
> close(RESULTS);
> $| = 1;
> print "Content-type: image/gif\n\n";
> print $im->gif;
>
> Whats wrong??? What needs to be where {$_} is???
>
> Any help greatly appreciated!

<gentle newbie mode>

Mike,

There is quite a lot wrong with this script. So much, in fact, that I'm not
sure I can really work out where to start.

A good way to get to the bottom of problems like this is to add '-w' at the
end of the '#! perl' line and 'use strict' near the top of the file. Perl
will then do all it can to help you debug the program. These two additions
should be used in *every* Perl script that you write. It will make your life
much easier.

</gentle newbie mode>

--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 22 Jan 1999 07:23:41 GMT
From: Juergen.Puenter@materna.de (J|rgen P|nter)
Subject: Re: perl script error
Message-Id: <78991t$s8p$6@penthesilea.Materna.DE>

In article <788bah$eck$1@nnrp1.dejanews.com>, kamez@my-dejanews.com says...

>"bash: syntax error near unexpected token `open(IN,"<$name"'  "

Now this looks like you run your script through bash
(your Unix shell) and not through perl. Look at what 
Alastair told you about the first line of your script.
It has to be something like: #!/path/to/perl - I just
assumed you left that part of your script off.


HTH
	Juergen Puenter



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

Date: Fri, 22 Jan 1999 06:04:38 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Please help me to use sockets
Message-Id: <ebohlmanF5y67q.H2A@netcom.com>

Bart Lateur <bart.lateur@skynet.be> wrote:

:      use LWP::Simple;
:      ($content_type, $document_length, $modified_time, $expires,
: 	$server) = get('http://www.any.any/directory/page.any');

Typo alert.  That should be head, not get.  However, you really want to 
leave off the semicolon and treat the following 'or' as a Perl operator, 
since some servers will process GET requests but not HEAD requests, so if 
a HEAD fails it's necessary to try a GET.

: or
:      $success = get('http://www.any.any/directory/page.any');

: 	Bart.


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

Date: Thu, 21 Jan 1999 22:35:17 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Random Invoice #
Message-Id: <MPG.1111bbfa9c571feb9899b7@nntp.hpl.hp.com>

In article <fkQp2.67$CB1.4392@nsw.nnrp.telstra.net> on Fri, 22 Jan 1999 
01:16:59 GMT, Martien Verbruggen<mgjv@comdyn.com.au> says...
> In article <788icg$i0l$1@camel18.mindspring.com>,
 ...
> > for invoice numbers....I want it to begin with 00000000 and then goto
> > 00000001 and so on, everytime the form is submitted
 ... 
> Have every process that creates an invoice, read that number,
> increment it, and store it again.
 ...
> use sprintf to get the padding zeroes. 

That is not necessary if the value is initialized as a string 
'00000000'.  Magic auto-increment will preserve the leading zeros.

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


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

Date: Fri, 22 Jan 1999 09:21:27 GMT
From: dave@mag-sol.com
Subject: Re: Random Invoice #
Message-Id: <789fui$ctr$1@nnrp1.dejanews.com>

In article <788icg$i0l$1@camel18.mindspring.com>,
  "Brian Thompson" <hitbyabus@mindspring.com> wrote:
> Is there anyway that I can assign a random number to a scalar? I'm using it
> for invoice numbers....I want it to begin with 00000000 and then goto
> 00000001 and so on, everytime the form is submitted

Interesting definition of 'random'!

--
Dave Cross
Magnum Solutions Ltd: <http://www.mag-sol.com/>
London Perl M[ou]ngers: <http://london.pm.org/>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 22 Jan 1999 07:15:05 GMT
From: Steve Vertigan <vertigan@iinet.net.au>
Subject: Safely editing /etc/passwd.
Message-Id: <36a82135.19643605@news.omen.com.au>

I'm writing a perl script that will run from cron, read information from
files and update the /etc/passwd file.  Touching the /etc/passwd file has
given me the screaming heebie jeebies ever since I blanked out a machines
entire passwd file once so I'm wondering if people can point out any
deficiencies in my procedure.

(1) Email with add/remove/modify instructions are sent to an email alias
from a cgi script.  This is filtered through to a perl script which checks
that a valid password has been supplied to authorise the procedure and also
that the user being changed is allowed (ie. not root).  Will eventually use
pgp but is plaintext for the moment although the authorisation password is
never written to a file.

(2) Perl script runs from cron, read information in files that the first
script has written.  Doesn't do any checking, just obeys orders.  It loads
/etc/passwd into an array, makes modifications, writes array to
/etc/passwd2.  If /etc/passwd2 exists and has a file size > 0 call
system("cp /etc/passwd2 /etc/passwd");

My main question is are there any modules or procedures I can use to verify
the integrity of /etc/passwd2 before copying other than checking for it's
existence and > 0 size?  I've included the system overview in case someone
wants to scream "DON'T DO THAT YOU FOOL!" :-)  The directory that "command"
files are written to is only readable/writeable to the user that owns it
(which recieves mail and writes a file assuming password was correct).  I
figure the only way someone can write files in here is if they have root
access to start with.  All operations are reported to the person who sent
the mail and an administrator who's address is hardcoded into the scripts
itself.  Is this workable?

Regards,
--Steve


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

Date: Fri, 22 Jan 1999 01:30:03 -0500
From: jamesht <jamesht@idt.net>
To: Tojo Punnoose <Tojo.Punnoose@Blr.Sni.de>
Subject: Re: Specifying Location in Perl
Message-Id: <36A81AEB.D7407772@idt.net>

Hello,

This is really a CGI question. You should try
comp.infosystems.www.authoring.cgi

But in the meantime...

Have your script load the page that you want to have as the thanks page or
whatever. In that page, you can either have an invisible frame, or an
onload="document.location.href='zipfile';" in the body tag.

Either should do the trick, but might require a little testing.

You could also write a <meta http-equiv="refresh" content="1;
URL='thefile.zip'"> in the html head.

I think that'll work as well.

James



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

Date: Fri, 22 Jan 1999 01:41:22 -0500
From: jamesht <jamesht@idt.net>
To: "D.C.Karthikeyan" <ckdasari@cs.hku.hk>
Subject: Re: ssl.
Message-Id: <36A81D92.A4CDEFEE@idt.net>

Hello,

LWP knows when to use which protocol.

Just use it same as ever, and it'll do the right thing.

James



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

Date: Fri, 22 Jan 1999 00:55:46 -0500
From: jamesht <jamesht@idt.net>
To: Matt Johnson <cpuweb@cpuweb.com>
Subject: Re: Trying to work with a text database
Message-Id: <36A812E2.61BB9FB3@idt.net>

Hello again,

One thing you should note is that if the thing you're sorting by is a number,
you should:

substitute:

<=>    # the number comparison operator

for

cmp   # the string comparison operator.

hth,

James



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

Date: Fri, 22 Jan 1999 09:05:14 -0000
From: "webmaster (Intervid)" <webmaster@intervid.co.uk>
Subject: Re: URGENT Perl Programmer needed
Message-Id: <36a83f3b.0@nnrp1.news.uk.psi.net>

Problem solved!






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

Date: Fri, 22 Jan 1999 07:53:25 GMT
From: leostar@mailcity.com
Subject: URGENTLY want some help
Message-Id: <789api$836$1@nnrp1.dejanews.com>

Hello
      I just got my assignment from my professor. I'm new in Perl. and I don't
know what function I can use for check string length and How to check whether
all text in varable is pure numeric.
      Please help me. I have to finish it soon.
      Anyway, Thanks for dropping here.
                                                  Leo

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 21 Jan 1999 10:56:54 -1000
From: "Michael Ching" <m_ching@hotmail.com>
Subject: Re: URGENTLY want some help
Message-Id: <36a82220.0@news.hawaii.rr.com>

perldoc -f length

and a regex could tell you if a pattern is matched
perldoc perlop

i recommend getting a good book, such as the camel book by orielly and to at
least get a brief overview of the language.

alternately you could see if
$scalar + 5 - 5 = $scalar;
though the teacher probably wants a regex

leostar@mailcity.com wrote in message <789api$836$1@nnrp1.dejanews.com>...
>Hello
>      I just got my assignment from my professor. I'm new in Perl. and I
don't
>know what function I can use for check string length and How to check
whether
>all text in varable is pure numeric.
>      Please help me. I have to finish it soon.
>      Anyway, Thanks for dropping here.
>                                                  Leo
>
>-----------== Posted via Deja News, The Discussion Network ==----------
>http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own




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

Date: Fri, 22 Jan 1999 09:40:47 GMT
From: billdraper@my-dejanews.com
Subject: WIN32::OLE, Word Dir Info
Message-Id: <789h2u$dqm$1@nnrp1.dejanews.com>

I want to display a table of info from a directory of Word8 files to a web
page and use these as links to open the files in Word. I want to list the
title, size, and date of last modification. I have found scripts on how to
get all the document info, but can't figure out how to only get the info I
require, and how to do this with a directory of files rather than a single
file. Can anyone help with an example script which does this or could be
modified. I am using Perl 5 on a Win95 PC and Apache for the Web interface.
Any information would be gratefully appreciated.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 21 Jan 1999 22:50:47 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: writing to files
Message-Id: <MPG.1111bf9bf8ff18869899b8@nntp.hpl.hp.com>

In article <788ao2$m9j@news.voyager.net> on Thu, 21 Jan 1999 22:46:16 
GMT, J Holden<jholden@voyager.net> says...
> that worked great....
> cept is should have been open (FILE, ">file.txt"); instead of jsut the
> single ', but I am not nit picky
 ...
> On Thu, 21 Jan 1999 20:25:23 -0000, "Mike Watkins"
> <mwatkins@promotion4free.com> wrote:
 ...
> >open (FILE, '>file.txt');

I *am* 'nit picky'.  Why do you think it should have been ">file.txt"? 
'>file.txt' works fine (and IMO is *far* better) when there is no 
interpolation into the string.

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


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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 4718
**************************************

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