[18591] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 759 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 25 06:05:38 2001

Date: Wed, 25 Apr 2001 03:05:08 -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: <988193108-v10-i759@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 25 Apr 2001     Volume: 10 Number: 759

Today's topics:
        access rights on any RDBMS <eg@tzv.fal.de>
    Re: Best Listserv <gtoomey@usa.net>
    Re: Email to MySQL (Tad McClellan)
    Re: Execute script at certain times? (Bernard El-Hagin)
        HELP!!!  Bus error(coredump) - How to recover? <johnlin@chttl.com.tw>
    Re: HELP!!!  Bus error(coredump) - How to recover? <johnlin@chttl.com.tw>
        Lvalue <alf.salte@nextra.no.spam.com>
    Re: Must send lots of emails (Rafael Garcia-Suarez)
    Re: Must send lots of emails (Tweetie Pooh)
    Re: Must send lots of emails (Rafael Garcia-Suarez)
    Re: operators: != vs. ne, strange behaviour <webmaster@einhardschule.de>
    Re: Pass variables from one script to another? <gtoomey@usa.net>
    Re: Please help (pat)
    Re: Please help <krahnj@acm.org>
    Re: pointer/reference question <uri@sysarch.com>
        Printing obscuremu@riftsmux.dhs.org
    Re: regexp matching with optional part <ronald.fischer@deadspam.com>
        Regexp Question <hpya78@postoffice.pacbell.net>
    Re: Regexp Question (Bernard El-Hagin)
    Re: Regexp Question (Rafael Garcia-Suarez)
    Re: sorting filenames alphanumerically <krahnj@acm.org>
        Unix Commands from PERL <gglackin@nospam.eircom.net>
    Re: Unix Commands from PERL (Bernard El-Hagin)
    Re: Unix Commands from PERL <christoph.neubauer@siemens.at>
    Re: US$50 prize for hash failure from 'delete' inside a <webmaster@einhardschule.de>
    Re: weird 'use constant' behaviour. Suggestions? <webmaster@webdragon.unmunge.net>
    Re: weird 'use constant' behaviour. Suggestions? <webmaster@webdragon.unmunge.net>
    Re: Where is my script <webmaster@einhardschule.de>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: 25 Apr 2001 08:53:35 +0100
From: Eildert Groeneveld <eg@tzv.fal.de>
Subject: access rights on any RDBMS
Message-Id: <3ae6746f@leda.tzv.fal.de>

Hello Everyone,
we are developing a platform independant information system that
uses any RDBMS that complies to SQL-92, using a meta level for
specification of the business rules. The meta level is currently 
written in PERL and so are the applications.

We now have to address the access right control. The requirements 
are:
 - be independant from the RDBMS used
 - restrict access to any column for select, update, delete and insert
 - restrict access conditional on the content of a column

One place to implement this would be the meta level. Then we 
would be completely independant from the RDBMS. However, it implies
that no direct interaction from PERL (or any other language) with the
backend is possible, creating additional overhead.

Any thaughts on this problem?


Eildert Groeneveld
==================================================
Institute for Animal Science and Animal Behaviour
Mariensee 31535 Neustadt Germany
Tel : (+49)(0)5034 871155 Fax : (+49)(0)5034 92579
e-mail: eg@tzv.fal.de  http://www.tzv.fal.de/~eg/ 
==================================================


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

Date: Wed, 25 Apr 2001 18:18:32 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Best Listserv
Message-Id: <nyvF6.11249$482.52787@newsfeeds.bigpond.com>

www.ultimatebb.com is written in Perl and worth a look

gtoomey
-----------
"BarryK" <notmyrealemail@fake.com> wrote in message
news:90mF6.20466$U4.4788564@news1.rdc1.tn.home.com...
> No, I mean a listserv for me to subscribe to read and post. There are
many,
> but some are small. I'm looking for one with 100+ subscribers.





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

Date: Tue, 24 Apr 2001 23:15:33 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Email to MySQL
Message-Id: <slrn9ecgal.rin.tadmc@tadmc26.august.net>

John Smith <j2lab@my-deja.com> wrote:
>
>I'm planning on receiving hundreds of emails to one of my mail accounts
>sitting on a Sendmail box.  Each mail message will be unique and I want
>to parse each message and put all the information in a MySQL database as
>a separate entry.

>Are there any modules that I should look at for doing something like
>this?


   http://search.cpan.org/


Type "mail" in the little box, click on "Search".

I think "filter" would be a good term to look for too.


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


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

Date: Wed, 25 Apr 2001 05:21:04 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Execute script at certain times?
Message-Id: <slrn9ecnbd.bfu.bernard.el-hagin@gdndev25.lido-tech>

On Tue, 24 Apr 2001 21:46:32 +0000 (UTC), Abigail <abigail@foad.org> wrote:
>Bernard El-Hagin (bernard.el-hagin@lido-tech.net) wrote on MMDCCXCIII
>September MCMXCIII in <URL:news:slrn9eacp6.bfu.bernard.el-hagin@gdndev25.lido-tech>:
>:}  On Tue, 24 Apr 2001 00:52:34 -0700, Preston Price <pric3596@cs.uidaho.edu>
>:}  wrote:
>:} >I was wondering if anyone knew of a way to have a program run at a certain
>:} >time everyday. I want something that will run at midnight every night. Does
>:} >anyone know of a way to do this?
>:} >Thanks in advance.
>:}  
>:}  If you can prove that this is a Perl question I'll give you the answer.
>
>
>    _:_ while ((localtime) [2] || (localtime) [1] || (localtime) [0]);
>    mid_night_run;
>    goto _;

I wasn't talking to you. :-)

Cheers,
Bernard
--
perl -e's;;s,,Just another Perl hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'


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

Date: Wed, 25 Apr 2001 17:56:13 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: HELP!!!  Bus error(coredump) - How to recover?
Message-Id: <9c66s8$rjv@netnews.hinet.net>

Dear all,

I have one program (using two modules) deployed in 6 machines.
Exactly the same programs, exactly the same machines (perl -V)
but only one machine got coredump:

$ perl -c GWftp.pl
Bus error(coredump)

I checked, the perl interpreter is OK (all other perl hello.pl worked fine).
Just my program failed.  (even if I rename the program)

I guess I can delete some intermediate files generated by perl (byte-code?)
then it will recover, just guessing... Could you help me with the first step?

Thank you very much.

John Lin

P.S.
$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=hpux, osvers=11.00, archname=PA-RISC2.0
    uname='hp-ux ltp42086 b.11.00 u 9000800 141901537 unlimited-user license '
    config_args='-Ubincompat5005'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undf
    useperlio=undef d_sfio=undef uselargefiles=define
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-O', gccversion=
    cppflags='-D_HPUX_SOURCE -Aa +z'
    ccflags =' -D_HPUX_SOURCE +z -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64  -A'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksiz8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -Wl,+vnocompatwarnings -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lnsl -lnm -lndbm -ldld -lm -lc -lndir -lcrypt -lsec -lcl -lpthread
    libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,defer'
    cccdlflags='+z', lddlflags='-b +vnocompatwarnings -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: USE_LARGE_FILES
  Built under hpux
  Compiled at Jan 18 2001 14:31:20
  @INC:
    /opt/perl5/lib/5.6.0/PA-RISC2.0
    /opt/perl5/lib/5.6.0
    /opt/perl5/lib/site_perl/5.6.0/PA-RISC2.0
    /opt/perl5/lib/site_perl/5.6.0
    /opt/perl5/lib/site_perl





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

Date: Wed, 25 Apr 2001 18:01:56 +0800
From: "John Lin" <johnlin@chttl.com.tw>
Subject: Re: HELP!!!  Bus error(coredump) - How to recover?
Message-Id: <9c676q$sj9@netnews.hinet.net>

More information, when I run with perl -d, I got

$ perl -d GWftp.pl
Default die handler restored.

Loading DB routines from perl5db.pl version 1.07
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

Signal BUS at /opt/perl5/lib/site_perl/5.6.0/Net/FTP.pm line 21
        Net::FTP::BEGIN('strict', 'Fcntl') called at /opt/perl5/lib/site_perl/50
        require 0 called at /opt/perl5/lib/site_perl/5.6.0/Net/Config.pm line 0
        require Net/FTP.pm called at GWftp.pl line 5
        main::BEGIN() called at /opt/perl5/lib/site_perl/5.6.0/Net/Config.pm li0
        require 0 called at /opt/perl5/lib/site_perl/5.6.0/Net/Config.pm line 0
Abort(coredump)


Thank you.

John Lin





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

Date: Wed, 25 Apr 2001 11:40:30 +0200
From: "Alf Salte" <alf.salte@nextra.no.spam.com>
Subject: Lvalue
Message-Id: <C_wF6.73$Ty6.190@news1.oke.nextra.no>

If you pass an Lvalue as argument in Perl you can modify that value.

sub whatever {
  $_[0] = 14;
}

my $x = 13;
whatever $x;

$x is now 14.

This will of course not work if you instead wrote:
whatever 13;

Question is, is there any way the function whatever can figure out that it
is given a variable that can be modified as opposed to a value it can't
other than attempt it and freak out if it failed? What I would like to have
here is some form of a function that says if the variable $_[0] can be used
to modify the original value.

Like:

if (lvalue($_[0]) {
    # $_[0] is an lvalue and if modified you will modify the original value.
} else {
   # $_[0] is not an lvalue, you will NOT modify the original value.
}

I guess you can define this function in terms of doing an eval() and trap
the error but that appears to me to be a very costly way of checking
something that should be very quick and easy check so I am hoping there's a
better way.

Alf




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

Date: 25 Apr 2001 06:25:05 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Must send lots of emails
Message-Id: <slrn9ecrfi.hjb.rgarciasuarez@rafael.kazibao.net>

Victor Prasad wrote in comp.lang.perl.misc:
} Hello,
} 
} I have a user list of a about 20000.  Hopefully on a spreadsheet.

Let's hope this spreadsheet is not in a proprietary format ;-)

} I have to parse out the email addresses then make a program to attach the
} email address to an email and send them off.
} 
} I plan to write it in PERL and use the unix sendmail program on my server.
} It will be a generic message for everyone on the users list.

You mean Perl, not PERL. This is not an acronym.

} Does anyone know of a premade script that does this?  Or suggestions on how
} to do this efficiently?

There's a module to send bulk mail on CPAN. Go to
http://search.cpan.org/ and search for "Bulk".

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Wed, 25 Apr 2001 09:17:51 GMT
From: tp601553@cia.gov (Tweetie Pooh)
Subject: Re: Must send lots of emails
Message-Id: <Xns908E68C2E4FC7TweetiePooh@62.253.162.104>

rgarciasuarez@free.fr (Rafael Garcia-Suarez) honoured comp.lang.perl.misc on 
Wed 25 Apr 2001 07:25:05a with 
<slrn9ecrfi.hjb.rgarciasuarez@rafael.kazibao.net>:

>
> You mean Perl, not PERL. This is not an acronym.
> 
Larry Wall may have something to say about that
PERL = programmers eclectic rubbish lister.

Anyway it should be perl (UNIX at least is case sensitive)


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

Date: 25 Apr 2001 09:47:14 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Must send lots of emails
Message-Id: <slrn9ed7aj.imq.rgarciasuarez@rafael.kazibao.net>

Tweetie Pooh wrote in comp.lang.perl.misc:
} > You mean Perl, not PERL. This is not an acronym.
} > 
} Larry Wall may have something to say about that
} PERL = programmers eclectic rubbish lister.
} 
} Anyway it should be perl (UNIX at least is case sensitive)

Read perlfaq1 again :
'' What's the difference between "perl" and "Perl"? ''

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Wed, 25 Apr 2001 08:37:13 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: operators: != vs. ne, strange behaviour
Message-Id: <9c5r3d$28i$04$1@news.t-online.com>

brian d foy <comdog@panix.com> schrieb in im Newsbeitrag:
comdog-39DDB4.20461124042001@news.panix.com...
> In article <m3lmoqx75q.fsf@dhcp9-172.support.tivoli.com>, Ren Maddox
> <ren@tivoli.com> wrote:
>
> > On Tue, 24 Apr 2001, comdog@panix.com wrote:
> >
> > > In article <m3d7a2ywy0.fsf@dhcp9-172.support.tivoli.com>, Ren Maddox
> > > <ren@tivoli.com> wrote:
> > >
> > >> $ perl -e 'print "Gotcha!\n" if "NAN" != "NAN"'
> > >> Gotcha!
>
> > > which version of perl are you using?
> > >
> > > vaio_brian[1789]$ perl5.00503 -e 'print "Gotcha!\n" if "NAN" != "NAN"'
> > > vaio_brian[1790]$ perl5.6.0 -e 'print "Gotcha!\n" if "NAN" != "NAN"'
> > > vaio_brian[1791]$
>
> > $ perl -v
> >
> > This is perl, v5.6.0 built for i386-linux
> > ...
> >
> > Something else interesting that I've found is:
> >
> > $ perl -le 'print "NON"+0'
> > 0
> > $ perl -le 'print "NAN"+0'
> > nan
>
> i don't think this is perl.  i don't have a Solaris box to check, but
> FreeBSD and NetBSD give different results than Linux (and MacPerl is
> just goofy - it gives 2147483648 ( which is 1 << 31 ).).  perhaps
> one of the ActivePerl types can find out what its result is. :)
>
> ========================
> vaio_brian[1791]$ perl -le 'print "NAN"+0'
> 0
> vaio_brian[1792]$ uname -a
> FreeBSD vaio.perl.org 4.2-RELEASE FreeBSD 4.2-RELEASE #0: Mon Nov 20
13:02:55 GMT 2000
> jkh@bento.FreeBSD.org:/usr/src/sys/compile/GENERIC  i386
>
>
> ========================
> sirius_bdfoy[903]$  perl -le 'print "NAN"+0'
> nan
> sirius_bdfoy[904]$ perl -v
>
> This is perl, version 5.005_03 built for i386-linux
>
>
> ========================
> panix2_comdog[998]$ perl -le 'print "NAN"+0'
> 0
> panix2_comdog[999]$ perl -v
>
> This is perl, version 5.005_02 built for i386-netbsd
>
>
> ========================
> [parsons@gocho parsons]$ perl -le 'print "NAN"+0'
> nan
> [parsons@gocho parsons]$ perl -v
>
> This is perl, v5.6.0 built for i686-linux

C:\perl\bin>perl -e "print 'NAN' + 0"
0
C:\perl\bin>perl -V
Summary of my perl5 (revision 5 version 6 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=undef d_sfio=undef uselargefiles=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cl', optimize='-O1 -MD -DNDEBUG', gccversion=
    cppflags='-DWIN32'
    ccflags
='-O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DPERL_
IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DPERL_MSVCRT_READFIX'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=4
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='link', ldflags
'-nologo -nodefaultlib -release  -libpath:"C:\Perl\lib\CORE"  -machine:x86'
    libpth="C:\Perl\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl56.lib
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
ddlflags='-dll -nologo -nodefaultlib -release  -libpath:"C:\Perl\lib\CORE"  
-machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS PERL_IMPLICIT_CONTEXT
PERL_IMPLICIT_SYS
  Locally applied patches:
   ActivePerl Build 613
  Built under MSWin32
  Compiled at Mar 24 2000 12:36:25
  @INC:
    C:/perl/lib
    C:/perl/site/lib
    .


--
MfG
Rudolf Polzer
Internet AG der Einhardschule Seligenstadt www.einhardschule.de
I know the sigseperator is wrong. But I may not install anything on the
school's PC!




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

Date: Wed, 25 Apr 2001 18:15:12 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Pass variables from one script to another?
Message-Id: <fvvF6.11246$482.52499@newsfeeds.bigpond.com>

This answersd all the points

I'm not sure if the original post was a Perl quetion or a CGI question.

gtoomey
--------------
"Chris Stith" <mischief@velma.motion.net> wrote in message
news:tebumkqb4g64af@corp.supernews.com...
> Nils Lien <Nils.Lien@informatikk.hive.no> wrote:
> > Hi,
> > I'm wondering how to pass a variable form one script to another.
>
> > For example;
> > I'm gonna fetch the variable $foo from script1.cgi
> > into the script I'm currently in now, script2.cgi.
>
> > I've managed it using the variable in the URL, but isn't there another
> > way around it?
>
>  1) Form data (usually type hidden works best here).
>
>  2) LWP. See CPAN.
>
>  3) Intermediate files on disk. (How to coordinate which file
>     is being used by which pair of CGI scripts is left as an
>     exercise to the reader, who hopefully set a cookie in the
>     user's browser or at least keyed something to an IP (which
>     can be less than ideal with shared machines and proxies)).
>
>  4) A database which keeps track of the data between script1
>     and script2. How to make sure the two scripts access the
>     same data for the same user is left as an exercise. Be
>     careful if you use this to sell anything, or you may have
>     to sacrifice most of what you own to the gods^Wcompany
>     called Amazon to appease their demons^Wlawyers.
>
> Chris
>
> --
> Try not. Do, or do not. The Force is binary. -- Yoda,
> The Empire Strikes Back (paraphrased)
>




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

Date: Wed, 25 Apr 2001 04:06:53 GMT
From: tulask@hotmail.com (pat)
Subject: Re: Please help
Message-Id: <Xns908EF8CDtulask@24.215.0.21>

Joe Schaefer <joe+usenet@sunstarsys.com> wrote in 
<m3k849wsqg.fsf@mumonkan.sunstarsys.com>:

>dified, and reused; but that is rarely true of the commen

Thank you for your help I'll work on it.

Thanks pat fegan



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

Date: Wed, 25 Apr 2001 07:44:38 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Please help
Message-Id: <3AE68065.EA1EF698@acm.org>

pat wrote:
> 
> "John W. Krahn" <krahnj@acm.org> wrote in <3AE50B3C.CDFD559B@acm.org>:
> 
> >Joe Schaefer wrote:
> >>
> >> % perl -MMorse a1-q3.pl
> >> 101, 102, 103, 104, 105, 106, 107, 108, 109, tenth
> >> 111, 112, 113, 114, 115, 116, 117, 118, 119, tenth
> >> 121, 122, 123, 124, 125, 126, 127, 128, 129, tenth
> >> 131, 132, 133, 134, 135, 136, 137, 138, 139, tenth
> >> 141, 142, 143, 144, 145, 146, 147, 148, 149, tenth
> >
> >You should have used the Bleach module. :-)
> >
> >
> >John
> 
> Ok you got me Assignment 1 question 3
> all this prints is
> ,,,,,,,,,
> ,,,,,,,,,
> ,,,,,,,,,
> ,,,,,,,,,
> ,,,,,,,,,
> 
> If you guy Know a better mothods Please let me know.
> thanks a million $-)

$ perl -e 'print map { $_ % 10 ? "$_, " : "tenth\n" } ( 101 .. 150 )'
101, 102, 103, 104, 105, 106, 107, 108, 109, tenth
111, 112, 113, 114, 115, 116, 117, 118, 119, tenth
121, 122, 123, 124, 125, 126, 127, 128, 129, tenth
131, 132, 133, 134, 135, 136, 137, 138, 139, tenth
141, 142, 143, 144, 145, 146, 147, 148, 149, tenth


John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 25 Apr 2001 05:29:11 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: pointer/reference question
Message-Id: <x74rvdim33.fsf@home.sysarch.com>

>>>>> "GJ" == Gwyn Judd <tjla@guvfybir.qlaqaf.bet> writes:

  GJ> ... and so on. Is there a way to alias one type of variable without
  GJ> doing the whole typeglob?

*y = \$x ;

now only $y will be aliased to $x

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Learn Advanced Object Oriented Perl from Damian Conway - Boston, July 10-11
Class and Registration info:     http://www.sysarch.com/perl/OOP_class.html


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

Date: Wed, 25 Apr 2001 08:06:37 GMT
From: obscuremu@riftsmux.dhs.org
Subject: Printing
Message-Id: <3ae6854b.93293889@news.inreach.com>

OK.. Here is a newbie question that I can't seem to find the answer to.

How do you send a text file to the printer queue in win98(etc) via perl?

Shain


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

Date: 25 Apr 2001 08:43:09 +0200
From: Ronald Fischer <ronald.fischer@deadspam.com>
Subject: Re: regexp matching with optional part
Message-Id: <7qf8zkpa39e.fsf@icn.siemens.de>

Uri Guttman <uri@sysarch.com> writes:

> >>>>> "RF" == Ronald Fischer <ronald.fischer@deadspam.com> writes:
> 
>   RF> Uri Guttman <uri@sysarch.com> writes:
>   >> 
>   >> s/^x-|-x$//g && $_
> 
>   RF> That's it! I never thought about the s/// function here, but of course,
>   RF> the solution is simple:
> 
>   RF> (s/^x-|-x$//g, length($_) > 0)
> 
> better off using && instead of , because if the s/// fails, why test for
> length? also the > 0 is not needed in any case.

Simply because it is not an error if s/// fails. After all, $_ should be
accepted even if it has neither x- in front nor -x at the end. Actually,
the only rejected case should be the string "x--x", so of course I could
manually exclude this borderline case in an additional test, as I said
in my original post.

Ronald
-- 
Do NOT reply to the address given in the From: header. If you want to
reply by mail, use the following address (after deleting the XXX):
Ronald Otto Valentin Fischer <rovfXXX@earthling.net>
(Tired of getting spam after posting a message? http://www.deadspam.com)


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

Date: Wed, 25 Apr 2001 00:44:27 -0700
From: Peter White <hpya78@postoffice.pacbell.net>
Subject: Regexp Question
Message-Id: <3AE6805A.5361A39A@postoffice.pacbell.net>

Hi,

I have a file like:

File:
      10 20 30 40
      100 20 50 66
     200 300 400 500

How to write a Regexp to get the record between 0 and 100?

Thanks.




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

Date: Wed, 25 Apr 2001 07:50:48 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Regexp Question
Message-Id: <slrn9ed044.bfu.bernard.el-hagin@gdndev25.lido-tech>

On Wed, 25 Apr 2001 00:44:27 -0700, Peter White <hpya78@postoffice.pacbell.net>
wrote:
>Hi,
>
>I have a file like:
>
>File:
>      10 20 30 40
>      100 20 50 66
>     200 300 400 500
>
>How to write a Regexp to get the record between 0 and 100?

Show us what you've tried so far and we'll help you fix it.

Cheers,
Bernard
--
perl -e's;;s,,Just another Perl hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'


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

Date: 25 Apr 2001 07:54:50 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: Regexp Question
Message-Id: <slrn9ed0nr.iak.rgarciasuarez@rafael.kazibao.net>

Peter White wrote in comp.lang.perl.misc:
} Hi,
} 
} I have a file like:
} 
} File:
}       10 20 30 40
}       100 20 50 66
}      200 300 400 500
} 
} How to write a Regexp to get the record between 0 and 100?

What do you mean exactly? You want to do something with the lines that
begin with a number between 0 and 100?

My advice is not to use regexps when you want to match numbers. This may
introduce bugs and will not be easily modifiable if your requirements
change (e.g. "numbers between 5 and 102 but not 97").

Here's an example:

#!/usr/local/bin/perl -w
use strict;
while (<DATA>) {
  my $number = (split)[0];
  chomp;
  print "$_ matches\n" if $number >= 0 && $number <= 100;
}
__DATA__
      10 20 30 40
      100 20 50 66
     200 300 400 500

-- 
Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/


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

Date: Wed, 25 Apr 2001 07:34:36 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: sorting filenames alphanumerically
Message-Id: <3AE67E06.6EC2B59F@acm.org>

bmm wrote:
> 
> Hi. How would I perform an alphanumeric sort on filenames that abide by the
> following naming convention:
> 
> intelVrambus_0001.csv
> intelVrambus_0002.csv
> ...
> intelVrambus_0255.csv
> 
> When I read the directory that contains the load files with the following
> code
> 
>     my @loadfiles;
>     find sub { push @loadfiles, $File::Find::name if /\.csv\z/ && -f; },
> $loaddir;
> 
> I find that the files are not subsequently processed in alphanumeric order.

opendir DIR, $loaddir or die "Cannot open $loaddir: $!";
my @loadfiles = sort grep { /\.csv\z/ and -f "$loaddir/$_" } readdir
DIR;
closedir DIR;


John
-- 
use Perl;
program
fulfillment


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

Date: Wed, 25 Apr 2001 09:58:53 +0100
From: "Bob Smith" <gglackin@nospam.eircom.net>
Subject: Unix Commands from PERL
Message-Id: <JlwF6.11456$_W2.11517@news.indigo.ie>

Hi ,

I was wondering if there is any way that I can call unix commands from a
perl program
so that I can access all the return values from the command - porblem is
that certain
commands return a lot of data (i.e. vmstat)

Thanks

Bob




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

Date: Wed, 25 Apr 2001 09:32:08 +0000 (UTC)
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Re: Unix Commands from PERL
Message-Id: <slrn9ed623.bfu.bernard.el-hagin@gdndev25.lido-tech>

On Wed, 25 Apr 2001 09:58:53 +0100, Bob Smith <gglackin@nospam.eircom.net>
wrote:
>Hi ,
>
>I was wondering if there is any way that I can call unix commands from a
>perl program
>so that I can access all the return values from the command - porblem is
>that certain
>commands return a lot of data (i.e. vmstat)

If you want to capture the output of a system command use backticks:

perldoc perlop

If you just want to run a system command and don't care about the output use
system:

perldoc -f system

You can also check out the $? special variable:

perldoc perlvar

Cheers,
Bernard
--
perl -e's;;s,,Just another Perl hacker,;and$\="\r"and
$$=q!print${"\x27"}!;$;=qq.$0..q.v..qq!al $$!;$;=~s-\---;
/^....*(?{$|=eval$;;select($Just,$another,$Perlhacker,0.1)}).{25}/x;'


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

Date: Wed, 25 Apr 2001 11:34:27 +0200
From: Christoph Neubauer <christoph.neubauer@siemens.at>
Subject: Re: Unix Commands from PERL
Message-Id: <3AE69A23.517F44C1@siemens.at>

Bob Smith wrote:

> Hi ,
>
> I was wondering if there is any way that I can call unix commands from a
> perl program
> so that I can access all the return values from the command - porblem is
> that certain
> commands return a lot of data (i.e. vmstat)
>
> Thanks
>
> Bob

See manual for:  `...`  (Backticks)    for little output
                         system (...)            for common commands (with
redirected STDOUT)

Hope that helps.

Chris





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

Date: Wed, 25 Apr 2001 08:42:16 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: US$50 prize for hash failure from 'delete' inside an 'each' loop
Message-Id: <9c5rcd$vfn$07$1@news.t-online.com>


Craig Berry <cberry@cinenet.net> schrieb in im Newsbeitrag:
te9egpa7p70a39@corp.supernews.com...
> Dan Sugalski (dan@tuatha.sidhe.org) wrote:
> : In comp.lang.perl.misc Mark-Jason Dominus <mjd@plover.com> wrote:
> : > I will give a $50 prize to the first person who can come up with an
> : > example that demonstrates this.
> :
> : I'm close to 100% sure that this can't happen with a plain hash. I
> : would say that all bets are off with a ties one, however.
>
> I've always seen this as wiggle room left for future implementors.  In
> other words, even if it's impossible with current hashes, there's no
> guarantee it will stay that way, so you shouldn't write code that depends
> on it.

Why? As already posted, it happens on my computer: each time I delete a key,
_all_ elements are re-read (as if each() was reset). But this depends on the
perl version.


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

Date: 25 Apr 2001 04:43:50 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: weird 'use constant' behaviour. Suggestions?
Message-Id: <9c5km6$amc$0@216.155.33.49>

In article <3ae61a3e.4693$1e2@news.op.net>,
 mjd@plover.com (Mark Jason Dominus) wrote:

 | In article <9c53q9$9p6$0@216.155.33.49>,
 | Scott R. Godin <webmaster@webdragon.unmunge.net> wrote:
 | >use constant USE_SAVEFILE => exists($opts{'f'}) ? '1' : '0'; #<- problem
 | 
 | Well, that's not a constant, now is it?
 | 
 | Try putting this at the appropriate place in the file, instead.
 | 
 |         sub USE_SAVEFILE () { exists($opts{'f'}) ? '1' : '0' }

Right, I mentioned that at the bottom of the original post:

 | | I finally resorted to this: 
 | | 
 | |     sub USE_SAVEFILE { exists($opts{'f'}) ? 1 : 0 }; 

although I later changed that to the empty prototype as well.

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: 25 Apr 2001 05:02:13 GMT
From: "Scott R. Godin" <webmaster@webdragon.unmunge.net>
Subject: Re: weird 'use constant' behaviour. Suggestions?
Message-Id: <9c5lol$f6t$0@216.155.33.49>

In article <comdog-FFA408.20415624042001@news.panix.com>,
 brian d foy <comdog@panix.com> wrote:

 | 
 | > short test script that exhibits the problem
 | 
 | 
 | > getopts('rf:', \%opts);
 | 
 | > use constant USE_SAVEFILE => exists($opts{'f'}) ? '1' : '0'; #<- problem
 | 
 | 
 | exercise for the poster:  which line is executed first?  ;)

Doh!  egads, why didn't I think of that? Where's my coffee? ;) Can you 
tell I've been plugging away at stuff for too long today? 

#!/usr/bin/perl -w
#minitest
use strict;
use vars qw/%opts/;
use Getopt::Std;

BEGIN {
   getopts('rf:', \%opts);
}

sub printl { print @_, "\n" }

use constant USE_SAVEFILE => exists($opts{'f'}) ? 1 : 0;

printl USE_SAVEFILE;
__END__

 ./minitest
0
 ./minitest -f
1
 ./minitest -f testing
1

Thanks again Brian. :)

-- 
unmunge e-mail here:
#!perl -w
print map {chr(ord($_)-3)} split //, "zhepdvwhuCzhegudjrq1qhw"; 
# ( damn spammers. *shakes fist* take a hint. =:P )


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

Date: Wed, 25 Apr 2001 08:40:42 +0200
From: "Einhardschule Seligenstadt" <webmaster@einhardschule.de>
Subject: Re: Where is my script
Message-Id: <9c5r98$2gc$04$1@news.t-online.com>


Craig Berry <cberry@cinenet.net> schrieb in im Newsbeitrag:
te94gqkoemtp84@corp.supernews.com...
> Martin Djernaes (martin@djernaes.net) wrote:
> : What's the way to find the location of a script (from within the
> : script)?
>
>   perldoc FindBin
>
> : I have a CGI script in /home/someuser/public_html/adir/ called
> : ascript.pl. When ever it's called by Apache I can use '.' for the
> : current dir, which is also the dir of the script,
>
> This does work for Apache (and many other servers), but beware of counting
> on it; port to IIS, and you will experience great pain.  I've learned this
> the hard way. :P

Will you find a path to the script in $0?



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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 V10 Issue 759
**************************************


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