[7721] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1347 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 20 12:17:15 1997

Date: Thu, 20 Nov 97 09:00:27 -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           Thu, 20 Nov 1997     Volume: 8 Number: 1347

Today's topics:
     (URGENT) How can i validate a date? <curbano@ccg.uc.pt>
     Re: (URGENT) How can i validate a date? (Casper K. Clausen)
     Re: -e switch <qdtcall@esb.ericsson.se>
     Re: -e switch <clark@s3i.com>
     Re: -e switch <merlyn@stonehenge.com>
     700msgs/day in c.l.p.m  (Was: PERL for ALPHA/VMS) (Keith Willis)
     any GUI modules? ()
     Re: Atomic operations (was Re: exclusive file rights) <camerond@mail.uca.edu>
     Can I change the UID my script runs as? <peterv@valkieser.nl>
     Complex Regular Expression: Help needed <Eric.Lewis@swisscom.com>
     Re: exclusive file rights <camerond@mail.uca.edu>
     Re: File::Find, find() question (Andrew M. Langmead)
     getpwuid and shadow passwords (Tarik Sedlarevic)
     Re: giving up on flock (Tad McClellan)
     Re: Here we go again... If you know perl PLEASE HELP ME (Andrew M. Langmead)
     Here's a simple one <myleslawrence@email.msn.com>
     Re: Is there a sendmail utility for MIIS/NT (Steve_Kilbane)
     Re: JavaScript < -------- > Perl (CGI) <david.martin@biotek.uio.no>
     Re: JavaScript < -------- > Perl (CGI) <myleslawrence@email.msn.com>
     Re: max size of cookie? (Bart Lateur)
     Re: pass by reference? what is wrong? <keson@uswest.com>
     Perl Source Formatter <bill@lanl.gov>
     Re: Perl Source Formatter <zkessin@pasilla.bbnplanet.com>
     Re: PLEASE HELP, retreive output (Keith Willis)
     Problem with localtime and timelocal (getting the Weekd <b.leguen@renault.fr>
     Q: perl5 flock an AFS file/solaris 2.5.1 (Felix Mailer)
     Re: Q: perl5 flock an AFS file/solaris 2.5.1 (Jeremy D. Zawodny)
     Re: Searching a WORD 6 DOC by line line number <bob@surfnetusa.com>
     Re: Searching question (John Moreno)
     Re: Searching question (Andrew M. Langmead)
     Re: Spell check dictionary where? <billg@networkapparel.com>
     System call on Dos/Win Perl - How To? (David Hawkins)
     undef and blessed thingies <reibert@mystech.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Thu, 20 Nov 1997 14:46:38 +0000
From: Carlos Urbano <curbano@ccg.uc.pt>
Subject: (URGENT) How can i validate a date?
Message-Id: <34744D4D.A4BA32CB@ccg.uc.pt>

Ex:

DD/MM/YY

31/02/97 is not a valid date but
29/02/96 is a valid date

Thanks

Urbano




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

Date: 20 Nov 1997 16:08:22 +0100
From: ckc@hobbes.ejoper.dmi.min.dk (Casper K. Clausen)
Subject: Re: (URGENT) How can i validate a date?
Message-Id: <wvp90ujbo2h.fsf@hobbes.ejoper.dmi.min.dk>

Carlos Urbano <curbano@ccg.uc.pt> writes:

> 31/02/97 is not a valid date but
> 29/02/96 is a valid date

Is it me, or is it really as easy as:

[WARNING: A date format such as this is not Y2K compliant. Make sure
you really want to use this format.]

($month,$date,$year) = split /\//;

And then do simple comparisons to determine validity.

Kvan.

-- 
-------Casper Kvan Clausen------ | 'Ah, Warmark, everything that passes
----------<ckc@dmi.dk>---------- |  unattempted is impossible.'
           Lokal  544            |   
I do not speak for DMI, just me. |        - Lord Mhoram, Son of Variol.      


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

Date: 20 Nov 1997 16:34:45 +0100
From: Calle Dybedahl <qdtcall@esb.ericsson.se>
Subject: Re: -e switch
Message-Id: <isu3d7o9yi.fsf@godzilla.kiere.ericsson.se>

Joseph Kewish <jsrk@pipeline.com> writes:

> Anyone care to give me an example?

Here's a line which prints out all your environment variables:

perl -e 'for(keys %ENV){print "$_";print "=$ENV{$_}" if $ENV{$_};print "\n";}'

This isn't the most elegant way to do it, but since you asked for an
example of a loop, this is what you get.

Also note that this was written for bash under Unix. If you use
something else, you may have to do the quoting of the Perl code differently.

-- 
		    Calle Dybedahl, UNIX Sysadmin
       qdtcall@esavionics.se  http://www.lysator.liu.se/~calle/


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

Date: 20 Nov 1997 10:32:32 -0500
From: Clark Dorman <clark@s3i.com>
Subject: Re: -e switch
Message-Id: <dk9e3insf.fsf@s3i.com>


Joseph Kewish <jsrk@pipeline.com> writes:
> I'm having the damndest time trying to figure out how to use perl
> straight from the command line. There are times when I just need a
> little loop or what have you, but I've not been able to find a clear
> example of how the -e switch is used.
> 
> Anyone care to give me an example?

Below is the "Canonical List of One-Liners", that really isn't but when I
once asked for such a list I got the following (from Jeff Stampes).  The one
that I use _all_ the time is when I'm searching for some really weird string
in a file, and the string consists of special characters.  Grep gags on it,
but perl does just fine:

	perl -ne 'print if /\#\$/' file.dat


NOTE:  If someone has additional one-liners, please send them to me!


Here's the list.  Some of them appear to be cryptic, but you have to remember
that perl sets special variables (so in the above, perl knows that we are
matching each line): 


    # run contents of "my_file" as a program
    perl my_file

    # run debugger "stand-alone"
    perl -d -e 42

    # run program, but with warnings
    perl -w my_file

    # run program under debugger
    perl -d my_file

    # just check syntax, with warnings
    perl -wc my_file

    # useful at end of "find foo -print"
    perl -nle unlink

    # simplest one-liner program
    perl -e 'print "hello world!\n"'

    # add first and penultimate columns
    perl -lane 'print $F[0] + $F[-2]'

    # just lines 15 to 17
    perl -ne 'print if 15 .. 17' *.pod

    # in-place edit of *.c files changing all foo to bar
    perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c

    # command-line that prints the first 50 lines (cheaply) 
    perl -pe 'exit if $. > 50' f1 f2 f3 ...

    # delete first 10 lines
    perl -i.old -ne 'print unless 1 .. 10' foo.txt

    # change all the isolated oldvar occurrences to newvar
    perl -i.old -pe 's{\boldvar\b}{newvar}g' *.[chy]

    # command-line that reverses the whole file by lines
    perl -e 'print reverse <>' file1 file2 file3 ....

    # find palindromes
    perl -lne 'print if $_ eq reverse' /usr/dict/words

    # command-line that reverse all the bytes in a file
    perl -0777e 'print scalar reverse <>' f1 f2 f3 ...

    # command-line that reverses the whole file by paragraphs
    perl -00 -e 'print reverse <>' file1 file2 file3 ....

    # increment all numbers found in these files
    perl i.tiny -pe 's/(\d+)/ 1 + $1 /ge' file1 file2 ....

    # command-line that shows each line with its characters backwards
    perl -nle 'print scalar reverse $_' file1 file2 file3 ....

    # delete all but lines beween START and END
    perl -i.old -ne 'print unless /^START$/ .. /^END$/' foo.txt

    # binary edit (careful!)
    perl -i.bak -pe 's/Mozilla/Slopoke/g' /usr/local/bin/netscape

    # look for dup words
    perl -0777 -ne 'print "$.: doubled $_\n" while /\b(\w+)\b\s+\b\1\b/gi'

    # command-line that prints the last 50 lines (expensively)
    perl -e '@lines = <>; print @lines[ $#lines .. $#lines-50' f1 f2 f3 ...


-- 
Clark Dorman				"Evolution is cleverer than you are."
http://cns-web.bu.edu/pub/dorman/D.html                -Francis Crick


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

Date: 20 Nov 1997 09:49:20 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: Clark Dorman <clark@s3i.com>
Subject: Re: -e switch
Message-Id: <8c7ma3fr3j.fsf@gadget.cscaper.com>

>>>>> "Clark" == Clark Dorman <clark@s3i.com> writes:

Clark>     # look for dup words
Clark>     perl -0777 -ne 'print "$.: doubled $_\n" while /\b(\w+)\b\s+\b\1\b/gi'

Anyone who combines \b\w\W\B with \s\S in the same regex is asking for
trouble. These are *not* complementary.  All \w is \S, but not all \W
is \s.  And \b is the boundary between \w and \W, not between \S and
\s.

Eieio.

:-)

And if you didn't follow that, you should NOT be mixing the two
classes of stuff.  It's even odd for us experts.

Specifically, the regex above fails to find:

	don't don't

and

	randal, randal

Even though it would seem to fit in the category of "dup words".  To find
the first, use:

	(?:^|\s)(\S+)\s+\1(?:\s|$)

(this is an answer from Learning Perl exercises :-), and to find the
second, use:

	\b(\w+)\W+\1\b

Regex are powerful.  Use them wisely, and they can save you much grief.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 284 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Thu, 20 Nov 1997 14:10:54 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: 700msgs/day in c.l.p.m  (Was: PERL for ALPHA/VMS)
Message-Id: <34754477.15831464@elf.bri.hp.com>

On Sun, 16 Nov 1997 21:32:22 -0500, jsbobcat@erols.com wrote:

>Please respond via newsgroup (to benefit others) and e-mail.  I check my
>e-mail more frequently than this newsgroup and do not have to filter
>through over 700 messages a day.   Thank you.

Really?  I never see more than about 100 messages/day in c.l.p.misc.
and I have no filters active in this group...

klw
----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: 20 Nov 1997 16:44:49 GMT
From: mhempel@select.net ()
Subject: any GUI modules?
Message-Id: <651pe1$97e@newshub.atmnet.net>

Are there any modules to make those swell boxes and buttons in X
windows and/or Windows 95/NT?  Would anybody have any use for such
a thing if I went about trying to make some?
-- 
____________________________________________________________________________
Matthew Hempel			SelectNet Internet Services
Systems Administrator		Carlsbad, California
				(760) 438-9555


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

Date: Thu, 20 Nov 1997 09:13:49 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
To: "Jeremy D. Zawodny" <jzawodn@wcnet.org>
Subject: Re: Atomic operations (was Re: exclusive file rights)
Message-Id: <347453AC.9858E37F@mail.uca.edu>

Jeremy D. Zawodny wrote:
> 
[snip]
> 
> If you use flock() on a Win32 system it appears to work right. [Note
> that I've only *tested* this on NT, but I suspect it works on 95 as
> well.]
> 
> Using flock(), you can lock the files that you need to mess with.

"To lock, perchance to flock, ay, there's the rub" (with apologies to
WS, Hamlet, Act 5, sc. 2)

flock(), although implemented in WinNT, is *not* implemented in Win95
(5.00402, GS port). That's why I've had to use the create/unlink as a
workaround. 

Program to test (adapted from the gecko book):

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

# lockit.pl

use strict;
sub bail {
	my$error = "@_";
	print  "Unexpected error: ";
	dir $error;
}

my (
	$FILENAME,
	$LOCK_EX,
);

$LOCK_EX = 2;
$FILENAME = "c:/temp/myfile.txt";

open (CHANDLE, "+<$FILENAME")||
	bail ("cannot open $FILENAME: $!");
flock (CHANDLE, $LOCK_EX)|| bail ("cannot flock $FILENAME: $!");

_____________________________________

Output from running program within DOS box:

c:\>perl lockit.pl
flock() unimplemented on this platform at lockit.pl line 22.

Oh, well...

Now, there is a Win32:Semaphore module, but I don't know anything about
the Semaphore function (command, ?) in Win32. Can anybody point me to an
elementary reference?

Cameron Dorey
camerond@mail.uca.edu


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

Date: Thu, 20 Nov 1997 14:31:52 +0100
From: Peter de Vroomen <peterv@valkieser.nl>
Subject: Can I change the UID my script runs as?
Message-Id: <34743BC8.43AA016@valkieser.nl>

I'm having a little problem here. I have a CGI script which has to make
a backup from a database. The problem is, the database-data can only be
exported by a certain user, which is not the user under which my script
is started.

So, I have to first change the user to the one which is allowed to
export the database (perform a 'su').

Is there a way to do this?

I keep reading references to 'suidperl', but I can't seem to find any
info on it. Would 'suidperl' help?

Ehrm, I'm not a Perl newbie, so the answer to my question doesn't have
to be simplified or something. :-)

Thanks,

Peter
-- 
Peter de Vroomen (e-mail: peterv@valkieser.nl), Software Engineer,
Valkieser Solutions, 's Gravelandseweg 80a, 1217 EW Hilversum,
The Netherlands, +31-(0)35-6714300, fax: +31-(0)35-6714333


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

Date: 20 Nov 1997 12:57:08 GMT
From: "Eric Lewis" <Eric.Lewis@swisscom.com>
Subject: Complex Regular Expression: Help needed
Message-Id: <01bcf5b3$e2a7a540$735bbe8a@gd2l3x>

I'm a Perl newbie, and I'm programming a acronym database application.
Every acronym has an explanation, and it's probable that there are other
acronyms inside the explanation. My goal is to make every acronym in there
a link, so the user can just click on it and get to that acronym.

The problem is that the acronyms inside the explanations are just plain
text. So I have to find out inside my Perl program what might be an
acronym. Up to now, my definition is the following:

- Anything that starts with an uppercase letter (including German umlauts)
or a number or a slash
- Then this is followed by a variable number of characters which are not in
lowercase, are not a comma, a bracket or a full stop followed by a blank
- Then at the end of the acronym comes again an uppercase letter (including
German umlauts) or a number
- And to make sure it's ok, it must be followed by no lowercase letters
(except s, for plurals like RAMs) or nothing (acronym is at the end of the
explanation)

Now, my problem is that the sequence of . (full stop and blank) isn't
recognized. Rather it seems that either the full stop or the blank are
recognized, making an acronym like
  LU 6.2
appear like
  LU

In the same vein, an acronym like ACCESS.BUS is split into ACCESS and BUS.

I guess the solution is simple, but as I said, being a newbie... :-) 
Here's my regular expression:

/([A-Z0-9DV\\/][^a-z\,\. \(\)]*[A-Z0-9DV\])([^a-r^t-z]|$)/

Thanks for any help you can give me!
-- 
Eric Lewis

Programmer/analyst (http://www.swisscom.com)
Musician (http://www.thenet.ch/soundservice/mle/)
Recording studio owner (http://www.access.ch/private-users/elewis/)

If my views correspond with those of Swisscom, all the better  ;-)


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

Date: Thu, 20 Nov 1997 09:23:29 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: exclusive file rights
Message-Id: <347455F1.AD564B1C@mail.uca.edu>

Brandon S. Allbery KF8NH; to reply, change void to kf8nh wrote:
> 
> [snip]
> 
> You did miss the beginning of the thread.  flock() is advisory on
> Unix, but
> is(?) mandatory on Win32. 

Except flock() is *missing* in Win95 (see my two minutes earlier post
somewhere on another branch in this thread).

Cameron Dorey
camerond@mail.uca.edu


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

Date: Thu, 20 Nov 1997 15:39:33 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: File::Find, find() question
Message-Id: <EJyBHx.GC3@world.std.com>

BJ Gillette <bgillette@corp.borland.com> writes:

>1) I want to use find() from File::Find,
>but I've hardly touched Unix for 4
>years, so my familiarity w/ the find()
>command has long since waned, to put it
>mildly.  Where can us slaves to MS
>Windows find "softcopy" help for the
>Unix find() command -- I'm talking man
>page, type of information.

One source of information that I can think of would be the man pages
that are distributed with a freely distributable Unix (like FreeBSD)
or Unix clone (like Linux.) or the GNU version of find. You might have
to retrieve all of the man pages if you get them from part of a
unix(-like) distribution, or the source code to find as well as the
documentation (for GNU find.)


>2) I'm trying to find all the .zip files
>under a dir. hierarchy,
>and put them into an array.  

How about:

sub wanted {
  return unless -f $File::Find::name; # skip all but "normal" files;
  push @ZIPS, $File::Find::name if /\.zip$/i;
}

-- 
Andrew Langmead


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

Date: Thu, 20 Nov 1997 22:07:50 +1100
From: tariq@infinet.net.au (Tarik Sedlarevic)
Subject: getpwuid and shadow passwords
Message-Id: <MPG.edec5131153739989688@news.infinet.net.au>

Hi all,

I've got a problem with perl's getpwuid function. 

I'm trying to use it to verify the password supplied by a user, but it 
can't check it if the password is shadowed (works fine if the password is 
in /etc/passwd). 

I've run it as root, tried making it and/or /usr/bin/perl suid root..., 
but nothing helped.

FAQ says that getpw* functions work with shadow files _if_ perl is 
correctly installed (see "How do I modify the shadow password file on a 
Unix system?"). I've installed perl with RedHat's RPM and don't it should 
have be installed correctly. 

Here's "perl -v" output:
------------------------
This is perl, version 5.003 with EMBED
        Locally applied patches:
          SUIDBUF - Buffer overflow fixes for suidperl security

        built under linux at Apr 22 1997 10:04:46
        + two suidperl security patches

And here's the script:
----------------------
#!/usr/bin/perl

    $pwd = (getpwuid($<))[1];
    $salt = substr($pwd, 0, 2);

    system "stty -echo";
    print "Password: ";
    chop($word = <STDIN>);
    print "\n";
    system "stty echo";

    if (crypt($word, $salt) ne $pwd) {
        die "Sorry...\n";
    } else {
        print "ok\n";
    }

I would appreciate any help/ideas/pointers etc.

Regards,
Tarik


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

Date: Thu, 20 Nov 1997 06:27:21 -0600
From: tadmc@flash.net (Tad McClellan)
Subject: Re: giving up on flock
Message-Id: <9ba156.ei.ln@localhost>

Mark Mielke (markm@nortel.ca) wrote:

: flock() should work on just about anything that calls itself unix. Perl
[snip]
: unlock the file... all done. here's some pseudo-type code..

:    sub append_to_file
:    {
:       if (open_the_file_for_writing) {
:          if (request_exclusive_lock_on_the_open_file) {
:             seek_to_the_end_of_the_file; <-- NECESSARY!!!!!!!!!!!!!!!
:             print_your_stuff_to_the_filehandle;
:             release_the_lock_on_the_open_file; <-- OPTIONAL
                                                     ^^^^^^^^

Never use this option  ;-)

You could lose your time slice right here, while you still have stuff
in the file buffers, and have not yet closed the file. ie. you are
not finished writing the file, yet you no longer have a lock!

Some other process may access the file before you get to the close()...


Don't unlock. Just close the file, it will unlock it for you.


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Thu, 20 Nov 1997 15:47:51 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Here we go again... If you know perl PLEASE HELP ME!!
Message-Id: <EJyBvs.M4p@world.std.com>

sdinitto@kronos.com (Scott DiNitto) writes:

>I have a big problem I am stumped on. I am trying to grab a value from
>a scalar in a module. The problem is, the variables in the module are
>dynamicly created. So I can not hardcode the variable in my main
>program. 

Very often, when someone is trying to use variable names created at
runtime, they are better off using an array or hash instead.

$volumename{usrhome}++;
print $volumename{$LV3VolumeJoin};

If you really need to access variables that are created at runtime,
you can use symbolic references:

{ 
  no strict 'refs';
  ${"brain::$LV3VolumeJoin"};
}

-- 
Andrew Langmead


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

Date: Thu, 20 Nov 1997 07:11:34 -0800
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: Here's a simple one
Message-Id: <OXuOhXc98GA.198@upnetnews02.moswest.msn.net>

I've got a script that has a name and password field on it. When I run the
form, I verify the values. If the name is verified, I would like to call
form1.pl, if not I'd like to call form2.pl. Whats more I'd like to send the
name to form1.pl?$name. Is this possible?
myleslawrence@msn.com




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

Date: Thu, 20 Nov 1997 14:08:33 GMT
From: steve@vampire.cegelecproj.co.uk (Steve_Kilbane)
To: david@thames.com
Subject: Re: Is there a sendmail utility for MIIS/NT
Message-Id: <b147cd$e821.10f@news.cegelecproj.co.uk>

[ Copy mailed ]

In article <34740DEF.5957@thames.com>, David Rayner <david@thames.com> writes:
> I can simulate everything except piping information
> to sendmail is there a utility or work around for NT???


See http://www.cgitricks.com/tgmail.htm

steve
-- 
<Steve_Kilbane@cegelecproj.co.uk> - All opinions are mine alone.
Kilbane's law of integration: standardise on protocols and file
formats, and the applications take care of themselves.



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

Date: Thu, 20 Nov 1997 13:24:11 +0100
From: David Martin <david.martin@biotek.uio.no>
Subject: Re: JavaScript < -------- > Perl (CGI)
Message-Id: <34742BEB.B81D6A9C@biotek.uio.no>

Jeremy D. Zawodny wrote:
> On Tue, 18 Nov 1997 11:41:33 +0100, "Reinhard E. Voglmaier"
> <rv33100@ggr.co.uk> wrote:

> >Hi there ,
> >
> >is anybody embedding JavaScript in Perl-CGI scripts ?
> 
> Yes. 

Me too.. but I prefer to reference a library rather than a HEREDOC. 

my $JAVASCRIPT='http:// ....';
 ...
<SCRIPT SRC="$JAVASCRIPT"></SCRIPT>

thus allowing my javascript library to be reused as many times as I feel
like.

 ..d

-- 
* David Martin - Atherosclerosis and Thrombosis research group  *
* http://www.uio.no/~damartin/      david.martin@biotek.uio.no  *
* Lab +47 22 95 84 54 Fax +47 22 69 41 30  GSM +47 90 74 27 65  *


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

Date: Thu, 20 Nov 1997 07:15:32 -0800
From: "Myles Lawrence" <myleslawrence@email.msn.com>
Subject: Re: JavaScript < -------- > Perl (CGI)
Message-Id: <u1Ez0Zc98GA.317@upnetnews02.moswest.msn.net>

I've started to do this a bit but am stuck getting perl variables , $vars,
into the jscripts. I use Roth' ODBC pm to fill perl vars and would like to
get the data into a java script. Have you done this?

myleslawrence@msn.com

David Martin wrote in message <34742BEB.B81D6A9C@biotek.uio.no>...
>Jeremy D. Zawodny wrote:
>> On Tue, 18 Nov 1997 11:41:33 +0100, "Reinhard E. Voglmaier"
>> <rv33100@ggr.co.uk> wrote:
>
>> >Hi there ,
>> >
>> >is anybody embedding JavaScript in Perl-CGI scripts ?
>>
>> Yes.
>
>Me too.. but I prefer to reference a library rather than a HEREDOC.
>
>my $JAVASCRIPT='http:// ....';
>...
><SCRIPT SRC="$JAVASCRIPT"></SCRIPT>
>
>thus allowing my javascript library to be reused as many times as I feel
>like.
>
>..d
>
>--
>* David Martin - Atherosclerosis and Thrombosis research group  *
>* http://www.uio.no/~damartin/      david.martin@biotek.uio.no  *
>* Lab +47 22 95 84 54 Fax +47 22 69 41 30  GSM +47 90 74 27 65  *




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

Date: Thu, 20 Nov 1997 15:20:12 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: max size of cookie?
Message-Id: <347451bb.1698720@news.tornado.be>

Eli the Bearded <usenet-tag@qz.little-neck.ny.us> wrote:

>kim slack <kas5670@vaxb.isc.rit.edu> wrote:
>> How much data can you fit in a cookie?  Geoff
>
>What kind of cookie? I saw a great shortbread recipe the other day,
>but is is off-topic here.

Maybe it's a Chinese fortune cookie. That would alow for, eh..., one
tiny piece of paper. How many bytes is that?

	Bart.


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

Date: Thu, 20 Nov 1997 09:38:12 -0700
From: Kevin Eson <keson@uswest.com>
Subject: Re: pass by reference? what is wrong?
Message-Id: <34746774.9044CF39@uswest.com>

Tina Marie Holmboe wrote:

> In article <3473E06E.BE31EAFB@sonnets.dot.com>,
>         designky <designky@sonnets.dot.com> writes:
>
> > [... original stuff snipped ...]
>
> [... some snippage ...]

> sub ps {
>          my $f = shift;
>          my $aa = shift ;
>          my $bb = shift ;
>
>          $aa->{'one'} = 1;
>          $aa->{'two'} = 2;
>
>          $bb->{rr} = "rr";
>
>
>          print $f, "\n";
>
>  }

<smile>Tina you took the code right out of my mind.</smile>

Using the reference "->" arrow has always been my method of
dealing with the reference variables.

Kevin Eson
--
The view presented here are mine and mine alone.  They
do not relect the views of my employer nor do I speak
for them.  My employer's involvement to my post is only
as a provider of equipment and connection.




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

Date: Thu, 20 Nov 1997 06:20:15 -0600
From: Bill Dorin <bill@lanl.gov>
Subject: Perl Source Formatter
Message-Id: <34742AFB.CCE1A299@lanl.gov>

Anyone point me to a perl source formatter similar to lint?  Sorry if this has been a previous
topic.

bill@lanl.gov




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

Date: 20 Nov 1997 09:14:50 -0500
From: Zachary Kessin <zkessin@pasilla.bbnplanet.com>
Subject: Re: Perl Source Formatter
Message-Id: <2jpvnvsld1.fsf@pasilla.bbnplanet.com>


Bill Dorin <bill@lanl.gov> writes:

>  Anyone point me to a perl source formatter similar to lint?  Sorry
> if this has been a previous topic.

The emacs perl mode will do this (any many other cool things) for you.


--Zach Kessin zkessin@bbnplanet.com
x^n+y^n=z^n has no integer solutions other than 0 for n>2
I have a wonderful proof of this, but it won't fit in a .sig file

>  bill@lanl.gov


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

Date: Thu, 20 Nov 1997 12:44:54 GMT
From: keith_willis.junk@non-hp-unitedkingdom-om1.om.hp.com (Keith Willis)
Subject: Re: PLEASE HELP, retreive output
Message-Id: <34743033.10643925@elf.bri.hp.com>

On 17 Nov 1997 00:27:52 GMT, hoang@step.polymtl.ca (Anh-tuan Hoang)
wrote:

>I don't know if somebody can help me. It's has been a long time I try to
>find out how to solve this problem. The problem is : I try to execute an
>Unix program and try to retreive the output and put into a string. I try
>with "system" and also with backtice `` but the only thing they return is
>an number 26250 , it is a kind of exist status number. I don't want this
>number but only the output of the program I execute by perl.
>So anyhelp will be very appreciate.

I don't really see where your problem is.  If I execute the following
line from the system prompt:

perl -e 'my $var = `ls -l ~`; print "$var\n";'

I get $var containing the directory listing of my home directory.  Are
you sure that your external program writes its output to stdout?

klw
----------------------------------------------------------------------
The above message reflects my own views, not those of Hewlett Packard.
When emailing me, please note that there is no '.junk' in my address.


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

Date: Thu, 20 Nov 1997 15:48:44 +0100
From: Bertrand Le Guen <b.leguen@renault.fr>
Subject: Problem with localtime and timelocal (getting the Weekday)
Message-Id: <34744DCC.167E@renault.fr>

Hi every body,
 in fact, i need to find the week number of any specific day, knowing
the day, the month and the year.

i wrote something like this but it doesn't work !

use Time::Local;
#for example
$day = 20;
$month=11;
$year =97
#hours = 12 (half of a day)
$tmday = timelocal(0,0,12,$day,$month,$year);
($scds,$mnts,$hrs,$day,$dtmonth,$dtyear,$weekday,$yearday,$sdst)
 = localtime($tmday);
$weekday = 6 !!!!! (6 is Saturday)

it may be equal to 4 ? (tuesday is 4 no ?)

time give me 
$test = time  results 880037296  (at 16:45 the 11/20/97)
timelocal for timelocal(0,0,12,20,11,97); 
TimeLocal = 88261560  (at 12:00 the 11/20/97) (might be less no?)
what's wrong ?

could someone explain that to me or show me an example on how to get
the weekday number from a date !

i didn't find anything in the FAQ so i wish someone could help !

thanks


-- 
(Hobby)
http://www.tamtam.insat.com (le Web en Francais sur la Musique)
(Job)
***************************** Bertrand Le Guen               
*  "If at first you don't   * CAD/CAM & SGI/Unix Admin 
*   succeed, destroy all    * Web Master (Intranet)
* evidences that you tried" * mailto:b.leguen@renault.fr
*****************************


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

Date: 20 Nov 1997 12:14:31 GMT
From: fmailer@smail.Uni-Koeln.DE (Felix Mailer)
Subject: Q: perl5 flock an AFS file/solaris 2.5.1
Message-Id: <6519j7$gnr@news.rrz.Uni-Koeln.DE>

on solaris 2.5.1:
- flock'ing an AFS file within a perl5 script has no effect. <===
- flock'ing a local file within the perl5 script works.
- flock'ing an AFS file whithin a C program works.
on aix/hp-ux ...
- flock'ing an AFS file within a perl5 script works.

(the perl5 call is: flock(<file handle>,2);)

Any idea?
Thank you,
Felix


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

Date: Thu, 20 Nov 1997 12:51:53 GMT
From: jzawodn@wcnet.org (Jeremy D. Zawodny)
Subject: Re: Q: perl5 flock an AFS file/solaris 2.5.1
Message-Id: <3474325d.61444582@igate.hst.moc.com>

[original author automagically cc'd via e-mail]

On 20 Nov 1997 12:14:31 GMT, fmailer@smail.Uni-Koeln.DE (Felix Mailer)
wrote:

>on solaris 2.5.1:
>- flock'ing an AFS file within a perl5 script has no effect. <===
>- flock'ing a local file within the perl5 script works.
>- flock'ing an AFS file whithin a C program works.
>on aix/hp-ux ...
>- flock'ing an AFS file within a perl5 script works.
>
>(the perl5 call is: flock(<file handle>,2);)

What, *exactly* are you asking?

Jeremy
-- 
Jeremy D. Zawodny                 jzawodn@wcnet.org
Web Server Administrator          www@wcnet.org
Wood County Free Net (Ohio)       http://www.wcnet.org/


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

Date: Thu, 20 Nov 1997 16:21:28 GMT
From: Bob Breedlove <bob@surfnetusa.com>
To: mhfarris@presbycan.ca
Subject: Re: Searching a WORD 6 DOC by line line number
Message-Id: <34746388.C55@surfnetusa.com>

Michael Farris wrote:
> 
> I want to write a PERL script to read through a MS Word document and
> return a line number where a match occurs.
> 
> The problem is the binary line breaks. How can I open the file into an
> array that can be read line by line.  I've tried out splitting on \m and
> a few others but I'm not sure what WORD uses for its line breaks.

Check

http://user.cs.tu-berlin.de/~schwartz/pmh/laola.html

It may help.
-- 
Bob Breedlove
WebSite Automation/SurfnetUSA Technical Support
bob@surfnetusa.com
http://colo.tntmedia.com/~breedlov/


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

Date: Thu, 20 Nov 1997 08:52:44 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: Searching question
Message-Id: <1czzjk7.tru1iv5i7s8yN@roxboro-161.interpath.net>

John Dubchak <jdubchak@sprint.ca> wrote:

] I am trying to search a text file for a given string.  I am able to do
] this, but what I want to do is retrieve an unspecified amount of
] information (i.e. extract a value from an array into a scalar) up to a
] certain point.  For instance, between two delimiters like [ and ].
] 
] Any suggestions as to how I may do this?

You mean like slurping the whole file in and then using a regex?

Like so:


$_=qq{I am looking for a string 
that is inside a pair of brackets like this
[yes this is the string I'm looking for]};

/\[  # start looking here
(.*) # this is the stuff we are looking for.
\]   # no more stuff - we are at the end
/sx;

print "$1\n";

-- 
John Moreno


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

Date: Thu, 20 Nov 1997 15:21:17 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Searching question
Message-Id: <EJyAnH.2CI@world.std.com>

"John Dubchak" <jdubchak@sprint.ca> writes:

>I am trying to search a text file for a given string.  I am able to do this,
>but what I want to do is retrieve an unspecified amount of information (i.e.
>extract a value from an array into a scalar) up to a certain point.  For
>instance, between two delimiters like [ and ].

If you have loaded all of the text file into an array, (which I'm
assuming because of the way you intersperse "text file" and "array" in
the above text) you might just want to join all of the lines into a
scalar and use the match operator on the scalar.

  ($found) = join('',@array) =~ /\[(.*)\]/s;

If you want to do your searching while you are reading the text file,
(which may be create a program that will use less memory) then you may
want to look into the range operator "..".

-- 
Andrew Langmead


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

Date: Thu, 20 Nov 1997 07:47:31 -0500
From: Bill Guindon <billg@networkapparel.com>
Subject: Re: Spell check dictionary where?
Message-Id: <34743162.2412B9BD@networkapparel.com>

Jeremy D. Zawodny wrote:

> [original author automagically cc'd via e-mail]
>
> On Tue, 18 Nov 1997 10:21:59 -0600, thomas@y4.com wrote:
>
> >Anyone know where to get an English language spell check dictionary for
> >use with PERL?
>
> /usr/dict/words on many systems is a good starting point.

Cool!  I didn't know about that either.  Being relatively new to perl (and
Unix), can you point me to a "tips & tricks" page for 'standard' Unix
features (like the above files) that are easily taken advantage of by perl?

Thomes: btw... if you can't find it there (ours is in /usr/share/dict), try:

    locate dict
to get a list of paths with "dict" in them.



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

Date: 20 Nov 1997 08:11:16 -0800
From: dhawk@best.com (David Hawkins)
Subject: System call on Dos/Win Perl - How To?
Message-Id: <651nf4$pds$1@shell3.ba.best.com>

I normally work on Unix but have a script I'd like to do on DOS
that would do the following:

net use g: \\$machine\d$   [ $machine is a variable,  d$  is not]
[read the directory]
[take appropriate action - copy, delete, rename, etc.]
net delete g:  [I think that's it]

But I can't get the system call for   net use g: \\$machine\d$
to work. It complains about the \'s no matter how I escape them.

Thoughts?

later, david
--
David Hawkins    dhawk@best.com       http://www.river.org/~dhawk
Only when an organization exists in stable circumstances, when its
operations resemble clockwork, unvarying in their practices, can
individuals be taken for granted or ignored without peril.
		-- Rosabeth Moss-Kanter: The Change Masters


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

Date: Thu, 20 Nov 1997 09:45:29 -0700
From: "Mark S. Reibert" <reibert@mystech.com>
Subject: undef and blessed thingies
Message-Id: <34746928.392759AB@mystech.com>

Question regarding Perl classes whose underlying data type is a hash or an
array:

Does undef'ing the hash or array (or assigning to it an empty list) "break"
or "dissolve" the blessedness of the thingy?

For example, given a constructor defined as

sub new
{
  my $type = shift;
  my $class = ref($type) || $type;
  my $this = {};
  bless $this, $class;
  return $this;
}

Do the following methods "break" the bless so that further use of the
object is not allowed?

sub ClearA
{
  my $this = shift;
  undef %$this;
}

sub ClearB
{
  my $this = shift;
  %$this = ();
}

By the way, initial tests indicate that neither of the Clear methods causes
a problem. I think the real question is if undef removes an entry from
whatever namespace the bless is adding to. Any thought are appreciated.

Thanks,
Mark Reibert

-----------------------------
   Mark S. Reibert, Ph.D.

  Mystech Associates, Inc.
  3233 East Brookwood Court
   Phoenix, Arizona 85044

    Tel: (602) 732-3752
    Fax: (602) 706-5120
 E-mail: reibert@mystech.com
-----------------------------




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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.  

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

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