[10889] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4490 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Dec 23 22:07:20 1998

Date: Wed, 23 Dec 98 19:00:18 -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           Wed, 23 Dec 1998     Volume: 8 Number: 4490

Today's topics:
        Accessing Objects in END Block-How ?? johnvv@hotmail.com
    Re: ADO cade@acm.org
    Re: ADO (Sam Holden)
    Re: Cannot build: egcs _fails_ on 5.005_02 & NT4 <metcher@spider.herston.uq.edu.au>
    Re: Cannot build: egcs _fails_ on 5.005_02 & NT4 <mds-resource@mediaone.net>
    Re: Closure and lexical scoping bug(?) in Perl (Mark-Jason Dominus)
        doscp command in program - proper email address (Randy Snott)
    Re: doscp command in program - proper email address (Sam Holden)
    Re: doscp command in program - proper email address <gavin@optus.net.au.dontspam.myass>
    Re: doscp command in program - proper email address (Randy Snott)
    Re: Equivilent of C's is_alpha() function? (Mark-Jason Dominus)
        help with indirect reference for pattern match (Steven Barbash)
    Re: help with indirect reference for pattern match (Steven Barbash)
    Re: help with indirect reference for pattern match (Matthew Bafford)
    Re: Hiring --> CGI/PERL - Deathshift Webmaster -- Web G (Clay Irving)
    Re: How to duplicate a list of lists (corrected email a (Mark-Jason Dominus)
    Re: How to put a password and user name in socket progr <gavin@optus.net.au.dontspam.myass>
    Re: Perl 5.005_002 and berkeley db problems <ltl@rgsun5.viasystems.com>
    Re: Perl 5.005_002 and berkeley db problems (Fluffy)
    Re: regular expression alternation <Paul.Makepeace@POBox.com>
    Re: sizeof() function? (Abigail)
        use base <ol@twics.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 24 Dec 1998 01:50:54 GMT
From: johnvv@hotmail.com
Subject: Accessing Objects in END Block-How ??
Message-Id: <75s6lt$irk$1@nnrp1.dejanews.com>




Hi all,

I have a wrapper module for Socket.pm and I want to issue a disconnect
statement from a client to a server on exit.  All the socket info is in the
object of course but the END statement is isolated and I get the error that
tells me that the object is no existant, or something like that.  I tried
AtExit.pm but I had no luck there either.

As an aside I would also like to know if there is a TCP/IP disconnect signal
that will be interpereted as a hang up at the other end in the vein of send or
receive.

Thanks in advance, John van V. aka pres/chief_bottle_washer
                      CXN, Inc.
                      proud home of Cxn.pm and the NetDepth Data server




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


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

Date: Wed, 23 Dec 1998 23:46:59 GMT
From: cade@acm.org
Subject: Re: ADO
Message-Id: <75rvdj$cvo$1@nnrp1.dejanews.com>

It appears that ->Value is not an lvalue, but ->{Value} is.  Can anyone
explain why you can extract data from what appears to be a reference without
an explicit dereference, yet you cannot assign data without an explicit
dereference?

Thanks,

Cade

In article <75r28h$jol$1@nnrp1.dejanews.com>,
  cade@acm.org wrote:
> I get the following error:
>
> Can't modify subroutine entry in scalar assignment, at EOF
>
> The problem line is the one which sets the value.  I have no trouble
> extracting values from an existing recordset, but when attempting to add
> records and update the fields I get this.  I can add empty records with no
> problem! (i.e. the ->AddNew() and ->Update() are working fine.)  FWIW, the
> script is hosted by Windows Scripting Host if that's any issue.
>
> use Net::POP3 ;
> use Win32::ADO ;
>
> $Conn = $WScript->CreateObject("ADODB.Connection") ; $RS =
> $WScript->CreateObject("ADODB.Recordset") ;
> $Conn->Open("DBQ=test.mdb;DefaultDir=.;Driver={Microsoft Access Driver
> (*.mdb)};DriverId=25;FIL=MS
> Access;ImplicitCommitSync=Yes;MaxBufferSize=512;MaxScanRows=8;PageTimeout=5;S
> afe Transactions=0;Threads=3;UID=admin;UserCommitSync=Yes;", "admin", "") ;
> $Conn->Execute("DELETE * FROM test") ; $RS->Open("SELECT FIELD1 FROM Test",
> $Conn, adLockOptimistic, adOpenDynamic) ;
>
> $RS->AddNew() ;
> $RS->Fields("FIELD1")->Value = "test" ;
> $RS->Update() ;
>
> $RS->Close() ;
> $Conn->Close() ;
>
> $WScript->Echo("All Done") ;
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

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


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

Date: 24 Dec 1998 00:06:41 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: ADO
Message-Id: <slrn7831ch.aui.sholden@pgrad.cs.usyd.edu.au>

On Wed, 23 Dec 1998 23:46:59 GMT, cade@acm.org <cade@acm.org> wrote:
>It appears that ->Value is not an lvalue, but ->{Value} is.  Can anyone
>explain why you can extract data from what appears to be a reference without
>an explicit dereference, yet you cannot assign data without an explicit
>dereference?

->Value would appear to be a call to the method Value().
->{Value} would appear to be an access to an element of a hash.

Of course I'm probably wrong since I don't know the context and all of that...

-- 
Sam

PC's are backwards ... throw them out! Linux is ok though.
	--Rob Pike (on the subject of CR/LF etc)


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

Date: Thu, 24 Dec 1998 11:37:28 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: Cannot build: egcs _fails_ on 5.005_02 & NT4
Message-Id: <36819AD8.1636A919@spider.herston.uq.edu.au>

Michael D. Schleif wrote:
> 
<snip>
> if not exist ".\mini" mkdir ".\mini"
> gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32   -DPERLDLL
> -DPERL_CORE -g -O2  -o.\mini\av.o ..\av.c
> In file included from ..\lib\CORE\config.h:2100,
>                  from ..\perl.h:137,
>                  from ..\av.c:16:
> ..\lib\CORE\win32.h:30: warning: `__declspec' redefined
> *Initialization*:1: warning: this is the location of the previous
> definition
> In file included from ..\lib\CORE\config.h:2100,
>                  from ..\perl.h:137,
>                  from ..\av.c:16:
> ..\lib\CORE\win32.h:216: warning: `_environ' redefined

This seems to indicate that you haven't in fact applied the patch.

> d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\stdlib.h:87:
> warning: this is the location of the previous definition

This is where _environ should indeed be defined.

<snip>
> win32.c: In function `win32_environ':
> win32.c:1345: `_environ' undeclared (first use in this function)

And this is where the ship goes down.
<snip>

Does it really behave identically with the patch applied?  Show us the
output *with* the patch.

-- 
Jaime Metcher


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

Date: Wed, 23 Dec 1998 20:41:58 -0600
From: "Michael D. Schleif" <mds-resource@mediaone.net>
Subject: Re: Cannot build: egcs _fails_ on 5.005_02 & NT4
Message-Id: <3681A9F6.49C4CEB8@mediaone.net>

Jaime, et al. ==>

Sorry, this maybe too long -- I have tried to annotate as best I can
*without* losing critical content  }:-^

Jaime Metcher wrote:
> 
> Michael D. Schleif wrote:
> <snip>
> > if not exist ".\mini" mkdir ".\mini"
> > gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32   -DPERLDLL
> > -DPERL_CORE -g -O2  -o.\mini\av.o ..\av.c
> > In file included from ..\lib\CORE\config.h:2100,
> >                  from ..\perl.h:137,
> >                  from ..\av.c:16:
> > ..\lib\CORE\win32.h:30: warning: `__declspec' redefined
> > *Initialization*:1: warning: this is the location of the previous
> > definition
> > In file included from ..\lib\CORE\config.h:2100,
> >                  from ..\perl.h:137,
> >                  from ..\av.c:16:
> > ..\lib\CORE\win32.h:216: warning: `_environ' redefined
> 
> This seems to indicate that you haven't in fact applied the patch.
> 
> Does it really behave identically with the patch applied?  Show us the
> output *with* the patch.

##########

OK, what am I doing wrong?

Following are _with_ the patch:

##########

D:\p500502\win32>dmake
del /f config.h
Could Not Find D:\p500502\win32\config.h
copy config_H.gc config.h
        1 file(s) copied.
gcc -c  -I..\lib\CORE -I.\include -I. -I.. -DWIN32   -DPERLDLL
-DPERL_CORE -g -O2   -operlglob.o perlglob.c
gcc  -Ld:\egcs-1.1\lib  -o ..\perlglob.exe perlglob.o  -ladvapi32
-luser32 -lnetapi32 -lwsock32 -lmingw32 -lgcc -lmoldname -lcrtdll
-lkernel32
if not exist ".\mini" mkdir ".\mini"
gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32   -DPERLDLL
-DPERL_CORE -g -O2 -o.\mini\av.o ..\av.c
In file included from ..\lib\CORE\config.h:2100,
                 from ..\perl.h:137,
                 from ..\av.c:16:
 ..\lib\CORE\win32.h:30: warning: `__declspec' redefined
*Initialization*:1: warning: this is the location of the previous
definition
In file included from ..\lib\CORE\config.h:2100,
                 from ..\perl.h:137,
                 from ..\av.c:16:
 ..\lib\CORE\win32.h:216: warning: `_environ' redefined
d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\stdlib.h:87:
warning: this is the location of the previous definition
gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32   -DPERLDLL
-DPERL_CORE -g -O2 -o.\mini\byterun.o ..\byterun.c
In file included from ..\lib\CORE\config.h:2100,
                 from ..\perl.h:137,
                 from ..\byterun.c:13:
 ..\lib\CORE\win32.h:30: warning: `__declspec' redefined
*Initialization*:1: warning: this is the location of the previous
definition
In file included from ..\lib\CORE\config.h:2100,
                 from ..\perl.h:137,
                 from ..\byterun.c:13:
 ..\lib\CORE\win32.h:216: warning: `_environ' redefined

##########
 ... you don't really want _all_ of this, do you?
##########

d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\stdlib.h:87:
warning: this is the location of the previous definition
gcc -c -I..\lib\CORE -I.\include -I. -I.. -DWIN32   -DPERLDLL
-DPERL_CORE -g -O2 -o.\mini\win32.o win32.c
In file included from ..\lib\CORE\config.h:2100,
                 from ..\lib\CORE\perl.h:137,
                 from win32.c:39:
 ..\lib\CORE\win32.h:30: warning: `__declspec' redefined
*Initialization*:1: warning: this is the location of the previous
definition
In file included from ..\lib\CORE\config.h:2100,
                 from ..\lib\CORE\perl.h:137,
                 from win32.c:39:
 ..\lib\CORE\win32.h:216: warning: `_environ' redefined
d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\stdlib.h:87:
warning: this is the location of the previous definition
In file included from
d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..
\..\i386-mingw32\include\windows.h:39,
                 from win32.c:17:
d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\Windows32/Base.h:268:
warning: redefinition of `TCHAR'
d:\egcs-1.1\lib\gcc-lib\i386-mingw32\egcs-2.91.57\..\..\..\..\i386-mingw32\include\tchar.h:143:
warning: `TCHAR' previously declared here
win32.c: In function `win32_environ':
win32.c:1345: `_environ' undeclared (first use in this function)
win32.c:1345: (Each undeclared identifier is reported only once
win32.c:1345: for each function it appears in.)
win32.c: In function `win32_fsetpos':
win32.c:1574: warning: passing arg 2 of `fsetpos' discards `const' from
pointer
target type
dmake.exe:  Error code 1, while making '.\mini\win32.o'

##########
d:\p500502\win32\win32.h
##########

/* WIN32.H
 *
 * (c) 1995 Microsoft Corporation. All rights reserved.
 * 		Developed by hip communications inc., http://info.hip.com/info/
 *
 *    You may distribute under the terms of either the GNU General
Public
 *    License or the Artistic License, as specified in the README file.
 */
#ifndef  _INC_WIN32_PERL5
#define  _INC_WIN32_PERL5

#ifdef PERL_OBJECT
#  define DYNAMIC_ENV_FETCH
#  define ENV_HV_NAME "___ENV_HV_NAME___"
#  define prime_env_iter()
#  define WIN32IO_IS_STDIO		/* don't pull in custom stdio layer */
#  ifdef PERL_GLOBAL_STRUCT
#    error PERL_GLOBAL_STRUCT cannot be defined with PERL_OBJECT
#  endif
#  define win32_get_privlib PerlEnv_lib_path
#  define win32_get_sitelib PerlEnv_sitelib_path
#endif

#ifdef __GNUC__
typedef long long __int64;
#  define Win32_Winsock
/* GCC does not do __declspec() - render it a nop
 * and turn on options to avoid importing data
 */
#  undef __declspec
#  define __declspec(x)
#  ifndef PERL_OBJECT
#    define PERL_GLOBAL_STRUCT
#    define MULTIPLICITY
#  endif
#endif

##########
 ... only relevant portions, OK?
##########

#endif /* PERL_OBJECT */

#endif /* _MSC_VER */

#ifdef __MINGW32__		/* Minimal Gnu-Win32 */

typedef long		uid_t;
typedef long		gid_t;
/* #define _environ	environ */
#define flushall	_flushall
#define fcloseall	_fcloseall

##########
Mext, I wondered about *other* win32 in path?
NOTE: I am calling `dmake' from d:\p500502\win32 directory[!]
##########

D:\>dir \win32.h /a /s
 Volume in drive D is PROGRAMS
 Volume Serial Number is 69CC-177A


 Directory of D:\perl5\lib\core

08/10/97  11:12a                 3,385 win32.h
               1 File(s)          3,385 bytes

 Directory of D:\perl5\5.00502\lib\MSWin32-x86\CORE

12/22/98  11:22p                 9,668 win32.h
               1 File(s)          9,668 bytes

 Directory of D:\p500502\lib\CORE

07/24/98  07:02a                 9,668 win32.h
               1 File(s)          9,668 bytes

 Directory of D:\p500502\win32

12/23/98  08:16p                 9,685 win32.h
               1 File(s)          9,685 bytes

     Total Files Listed:
               4 File(s)         32,406 bytes
                            507,052,032 bytes free

##########

D:\p500502\win32>set
BLASTER=A220 I5 D1 H5 P330 E620 T6
CLASSPATH=D:\Adobe\PhotoDeluxe\AdobeConnectables
COMPUTERNAME=THOR
ComSpec=G:\WINNT\system32\cmd.exe
CTCM=C:\WIN.95
GCC_EXEC_PREFIX=d:\egcs-1.1\lib\gcc-lib\
HOMEDRIVE=G:
HOMEPATH=\
LOGONSERVER=\\THOR
MIDI=SYNTH:1 MAP:E MODE:0
NTRESKIT=G:\ntResKit
NUMBER_OF_PROCESSORS=1
OS=Windows_NT
Os2LibPath=G:\WINNT\system32\os2\dll;
Path=d:\egcs-1.1\bin;G:\WINNT\system32;G:\WINNT;G:\ntResKit;C:\WIN.95;C:\WIN.95\
COMMAND;D:\PERL5\BIN;C:\;C:\BIN;C:\UMAX\PAGEMGR\IMGFOLIO;C:\UMAX\PAGEMGR
PATHEXT=.COM;.EXE;.BAT;.CMD
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 5 Stepping 1, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0501
PROMPT=$P$G
SOUND=C:\PROGRA~1\CREATIVE\CTSND
SystemDrive=G:
SystemRoot=G:\WINNT
TEMP=G:\TEMP
TMP=G:\TEMP
TZ=CST6CDT
USERDOMAIN=THOR
USERNAME=Administrator
USERPROFILE=G:\WINNT\Profiles\Administrator
windir=G:\WINNT

##########

Please, help }:-^

-- 

Best Regards,

mds
mds resource
888.250.3987

"Dare to fix things before they break . . . "

"Our capacity for understanding is inversely proportional to how much we
think we know.  The more I know, the more I know I don't know . . . "


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

Date: 23 Dec 1998 21:30:26 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Closure and lexical scoping bug(?) in Perl
Message-Id: <75s902$dvn$1@monet.op.net>

In article <24dg2.556$7P2.7337912@news2.voicenet.com>,
Matt Knecht <hex@voicenet.com> wrote:
>If you uncomment either line that references $base within the sub
>definiton, that brings $base into "lexical scope".  The closure then
>knows to hang onto this value.

No, that's not right.  I know you won't mind my saying so, because:

>The question here is, "What *exactly* does 'lexical scope' mean?"

`lexical scope' means that the part of the program in which the name
is associated with the variable depends only on the contents of the
source code file, and not on the order in which things are executed.

The typical example is:

	sub A {
	  my $var = 3;
	  B();
	}

	sub B {
	  print $var;
	}

The question here is: ``Can B see that variable $var that was declared
in A?''  In some languages, $var would be created at the time A was
called, and would continue to exist until A returned, so that B could
get at it; this is called `dynamic scope'.  But in most languages,
variables have `lexical scope', which means that $var is only
available in A, never in B, regardless of which functions call which
others.  

`my' variables have lexical scope; their scope begins at the place
they are declared, and continues to the end of the smallest enclosing
block.  Such a region of the program is sometimes called `a lexical
scope'.  

So in Paul's example:

>>{
>>        my $base = "Hello, ";
>>        sub msg {
>>                #print "Making a message starting with '$base'...\n";
>>                #$base=$base;
>>                my $what = shift ;
>>                sub {
>>                        print "$base$what\n"
>>                }
>>        }
>>}

`$base' should be available to the anonymous subroutine, regardless of
when that subroutine is actually called, or by whom, because $base is
supposed to be available from the point at which it is declared up to
the final close brace.

To me, it seems that the peculiar behavior he reported is clearly a
bug.  Paul sent it to the bug address, but I did not see anyone make
any remarks about it.

>perlref says:
>	Anonymous subroutines act as closures with respect to
>	my() variables, that is, variables visible lexically
>	within the current scope.

That means that variable names in an anonymous subroutine refer to the
variables that were active at the time they were defined, not the
time they are executed.  This is in accordance with lexical scoping.

Consider this:

	sub A {
	  my $x = 'A';
	  return sub { print $x } ;
	}

	sub B {
	  my $x = 'B';
	  my $subr = shift;
	  &$subr;
	}

	&B(&A());

`A' returns an anonymous subroutine which, when invoked, prints the
value of $x.  We call A and get an anonymous subroutine back, and we
pass that to B, which invokes it.  Does the anonymous subroutine print
`A' or `B'?

You might think it prints `B', because it's being invoked in B, and
inside of B, `$x' has the value `B'.  But that's not what it does.

Lexical scoping says that you can find out which variable it will use
by looking at the source code, without knowing what the program does.
When you see the `return sub { print $x }' you don't need to know
about function B to know which $x is meant there.  The subroutine's
source code is in the scope of the first $x, not the second one, so
that's the variable that the subroutine uses; it prints `A'.

>I'm not exactly sure what language lawyers would have to say about
>"visible lexically within the current scope", but here it obviously
>means "variables defined with 'my' in the sub".

No; in this case it's only talking about variables decalred with `my'
that are outside the anonymous subroutine itself.



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

Date: Thu, 24 Dec 1998 00:32:57 GMT
From: Vommyt1@primenet.com  (Randy Snott)
Subject: doscp command in program - proper email address
Message-Id: <36818ba2.9559651@news.jet.net>

I am attempting to get a program to pull a file from a directory and
copy it onto a floppy drive. I have a dos formatted disk in the drive
and can run "doscp filename a:"  in the shell. When I attempt to do
the same from inside my program. I get 
Usage: doscp [-r | -m] device:path  . . .  device:path  
sh: a:: not found 

I have tried using backticks, system(), exec() and even calling out
the full name of the device, all with the same result. I am using Perl
5.005_02 on a SCO Unix 5.04 server.


Any ideas?

Thanks for any help, and a very informational group,

Jeff Griffith
Jeff@avantasoft.com


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

Date: 24 Dec 1998 01:24:54 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: doscp command in program - proper email address
Message-Id: <slrn7835v6.c73.sholden@pgrad.cs.usyd.edu.au>

On Thu, 24 Dec 1998 00:32:57 GMT, Randy Snott <Vommyt1@primenet.com> wrote:
>I am attempting to get a program to pull a file from a directory and
>copy it onto a floppy drive. I have a dos formatted disk in the drive
>and can run "doscp filename a:"  in the shell. When I attempt to do
>the same from inside my program. I get 
>Usage: doscp [-r | -m] device:path  . . .  device:path  
>sh: a:: not found 

I can almost guarantee that you are attempting something like :

system("doscp $filename a:");

And $filename has a \n on the end... thus executing two shell commands...

-- 
Sam

compiling kernels is what I do most, so they do tend to stick to the
cache ;)	--Linus Torvalds


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

Date: Thu, 24 Dec 1998 01:45:34 GMT
From: "Gavin Cato" <gavin@optus.net.au.dontspam.myass>
Subject: Re: doscp command in program - proper email address
Message-Id: <21hg2.4$5_6.304933@news0.optus.net.au>

Have you put a chomp on the filename?

I say this because it looks as if it's trying to run 2 seperate commands
instea of one,

++Gavin;


Randy Snott wrote in message <36818ba2.9559651@news.jet.net>...
>I am attempting to get a program to pull a file from a directory and
>copy it onto a floppy drive. I have a dos formatted disk in the drive
>and can run "doscp filename a:"  in the shell. When I attempt to do
>the same from inside my program. I get
>Usage: doscp [-r | -m] device:path  . . .  device:path
>sh: a:: not found
>
>I have tried using backticks, system(), exec() and even calling out
>the full name of the device, all with the same result. I am using Perl
>5.005_02 on a SCO Unix 5.04 server.
>
>
>Any ideas?
>
>Thanks for any help, and a very informational group,
>
>Jeff Griffith
>Jeff@avantasoft.com




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

Date: Thu, 24 Dec 1998 01:47:17 GMT
From: Vommyt1@mapSoN.primenet.com  (Randy Snott)
Subject: Re: doscp command in program - proper email address
Message-Id: <36819d1f.14037356@news.jet.net>

sholden@pgrad.cs.usyd.edu.au (Sam Holden) dropped this knowledge:

>On Thu, 24 Dec 1998 00:32:57 GMT, Randy Snott <Vommyt1@primenet.com> wrote:
>>I am attempting to get a program to pull a file from a directory and
>>copy it onto a floppy drive. I have a dos formatted disk in the drive
>>and can run "doscp filename a:"  in the shell. When I attempt to do
>>the same from inside my program. I get 
>>Usage: doscp [-r | -m] device:path  . . .  device:path  
>>sh: a:: not found 
>
>I can almost guarantee that you are attempting something like :
>
>system("doscp $filename a:");
>
>And $filename has a \n on the end... thus executing two shell commands...
>
>-- 
>Sam
>
>compiling kernels is what I do most, so they do tend to stick to the
>cache ;)	--Linus Torvalds


You were completely correct, sometimes you stare at something so long
you miss the obvious. 

Thanks for the help.

Jeff


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

Date: 23 Dec 1998 20:42:45 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Equivilent of C's is_alpha() function?
Message-Id: <75s66l$brg$1@monet.op.net>

In article <75rh7g$8fj$1@statler.server.colt.net>,
Paul Makepeace <Paul.Makepeace@POBox.com> wrote:
>/[[:alpha:]]/ would be the POSIX way. A variety of GNU tools have
>implemented this but not perl.

I think it's on the way.  The syntax is reserved, but I don't think 
it's been implemented yet.



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

Date: Wed, 23 Dec 1998 20:14:56 -0500
From: stevenba@carr.org (Steven Barbash)
Subject: help with indirect reference for pattern match
Message-Id: <MPG.10eb5f9ac534c1e0989680@www.siast.sk.ca>

Hello,

I'm just getting started with perl.

Is it possible (and if so, how) to create a pattern match reference?

that is, instead of:
$x =~ /my pattern/

can one do something like
$x =~ \$ref-to-my-pattern
   where $ref-to-my-pattern = 'my pattern'  or '\my pattern\' or ??

The idea is to be able to enter a search string via external prompt, and 
then plug that value into the program via a reference.

I have tried 30 permuatations including \$ref, $ref, eval(\$ref), 
eval($ref), ...  but can't seem to find a solution.

Oh, where is the source code (module name & directory location) for the 
processing of pattern matching "m\   \"?  (Perhaps that might help.)

Thanks for any help.
Steve 


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

Date: Wed, 23 Dec 1998 20:23:08 -0500
From: stevenba@ccpl.carr.org (Steven Barbash)
Subject: Re: help with indirect reference for pattern match
Message-Id: <MPG.10eb6187da58875989681@www.siast.sk.ca>

My direct email address is stevenba@ccpl.carr.org.

The earlier post shows it as stevenba@carr.org  -- which sometimes works, 
and sometimes doesn't.

Please cc any newsgroup response to my direct address.

Thanks again.
Steve


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

Date: Wed, 23 Dec 1998 21:33:40 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: help with indirect reference for pattern match
Message-Id: <MPG.10eb7212750957298976b@news.scescape.net>

[This followup was posted to comp.lang.perl.misc and a copy was sent to 
the cited author.]

In article <MPG.10eb5f9ac534c1e0989680@www.siast.sk.ca>, 
stevenba@carr.org says...
=> Hello,

Hi!

=> I'm just getting started with perl.

Welcome aboard!

=> Is it possible (and if so, how) to create a pattern match reference?

What you want is qr//.

It is documented in perlop.

[snip]

=> Thanks for any help.

HTH!

=> Steve 

--Matthew


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

Date: 23 Dec 1998 21:50:17 -0500
From: clay@panix.com (Clay Irving)
Subject: Re: Hiring --> CGI/PERL - Deathshift Webmaster -- Web Graphics Designer
Message-Id: <75sa59$2s9@panix.com>

In <36847f75.40368245@news.nac.net> info@luciddreams.com (Info) writes:

>Luciddreams NYC, Inc. is now hiring for the following positions:

>1. CGI/PERL Programmer -- Linux
>2. Deathshift Webmaster -- Linux/Unix
>3. Web Graphics Designer -- Mac or PC or Linux

>Sorry, no NT here!

You omitted a smiley...

-- 
Clay Irving
clay@panix.com


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

Date: 23 Dec 1998 20:56:54 -0500
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: How to duplicate a list of lists (corrected email address)
Message-Id: <75s716$cfn$1@monet.op.net>

In article <3681758B.F613F9C0@yahoo.com>,
LingMin Zhu  <lingminz@yahoo.com> wrote:
>$a = [[1,[3,4],3],8];
>$b = $a;
>
>Now $b just simply point to $a.  But what I want is a separate copy of
>list.

There's a `Ref' module on CPAN that has a function that does this.
But it's easy to write one yourself:

	sub deep_copy ($) {
	  my $arg = $_[0];
          my $type = ref $arg;
	  return $arg unless $type; # Not a reference
	  return [map {deep_copy($_)} @$arg] 
	    if $type eq 'ARRAY';
	  return {map {($_ => deep_copy($arg->{$_}))} keys %$arg} 
	    if $type eq 'HASH';
	  return \deep_copy($$arg)
	    if $type eq 'SCALAR' || $type eq 'REF';
	  return $arg; # CODE GLOB IO FORMAT LVALUE
	}

If you're sure you only want to copy lists of lists of lists, you can
trim out the bottom half of this function.

I'm pretty sure this is the third time I've answered this question
this year.  Maybe the FAQ holders can put it into the FAQ list.



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

Date: Thu, 24 Dec 1998 01:48:03 GMT
From: "Gavin Cato" <gavin@optus.net.au.dontspam.myass>
Subject: Re: How to put a password and user name in socket program
Message-Id: <n3hg2.5$5_6.305907@news0.optus.net.au>

There is a program (not in perl) called "wget" that will do this for you. No
use re-inventing the wheel :-)

++Gavin;


Robin Hart wrote in message <36814070.D52D2D2F@nih.gov>...
> Hi All:
>
>I have a perl program which is used to  open socket for  accessing a web
>server because I need to download files
>from this web server.  The file directory is protected by the web
>server, but I have a password and uid to access
>information from the webpage.  I don't want to download the data from
>the url webpage because I need to download them one page at time.  It is
>time consume for me.   Therefore, I need to write the perl script which
>will
>download all files at once.
>
>I have the IP address and port number of the web site.  My question is
>how to login onto the web server by an uid and a password in my perl
>script.  I have no problem to open socket on that site.  Every time I
>run the script, and I got this message as following:
>
>               Authorization Required
>              This server could not verify that you  are authorized to
>access the document you requested.
>
>Now, I have an user name and a password, but I don't know how to put
>together with socket codes.
>Anyone has an idea?
>
>Thanks In Advance!
>
>Happy Holidays!
>
>Robin
>




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

Date: 24 Dec 1998 00:01:28 GMT
From: lt lindley <ltl@rgsun5.viasystems.com>
Subject: Re: Perl 5.005_002 and berkeley db problems
Message-Id: <75s08o$k4p$1@rguxd.viasystems.com>

bostic@bostic.com wrote:
:>In article <367FE5A5.FC256712@iscusa.com>,
[snip]
:>I've now exchanged email with Colin.  I believe that the version
:>of Berkeley DB in which he found problems was 1.85.  Version 1.85
:>was academic software released around 1992, was never supported,
:>and is widely known to have problems.  (See

:>        http://www.sleepycat.com/Berkeley DB.185.html

:>for further information.)

:>The current, 2.X versions of Berkeley DB have none of these problems,
:>whether used with Perl or not, and whether used with the DB_File or
:>BerkeleyDB Perl modules.

The only problem is that the download link from there points to
ftp.terra.net,  which has not answered me in attempts over the past
3 evenings.

-- 
// Lee.Lindley   | There was a time when I thought that "being right"
// @bigfoot.com  | was everything.  Then I realized that getting along
//    | was more important.  Still, being right is more fun!
//    | And if I'm wrong, somebody will get some joy out of telling me!


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

Date: 24 Dec 1998 00:41:56 GMT
From: meowing@banet.net (Fluffy)
Subject: Re: Perl 5.005_002 and berkeley db problems
Message-Id: <75s2kg$36k@meow.invalid>

lt lindley <ltl@rgsun5.viasystems.com> wrote:

{Berkeley DB 2.x}

> The only problem is that the download link from there points to
> ftp.terra.net,  which has not answered me in attempts over the past
> 3 evenings.

You can get a fairly recent kit from CPAN, in the src/misc directory.
-- 
"FEAST!"
      --Alice


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

Date: Thu, 24 Dec 1998 02:23:16 -0000
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: regular expression alternation
Message-Id: <75s8ns$end$1@statler.server.colt.net>

[ Cc: mailed to original author ]

Larry Rosler wrote in message ...
>      ($name, $ext)   = /^([^.]+(?:\.[^.]+)*?)(?:\.?([^.]*))$/;
>
>Yuk.  Let's try to make it comprehensible:
>
>      ($name, $ext)   =
>          /^(               # start of $1 ($name)
>             [^.]+          # first filename (no dots allowed)
>             (?:\.[^.]+)*?  # as few as possible .more's
>            )               # end of $1 ($name)
>            (?:\.?          # eat up last dot, if any
>             ([^.]*)        # extension, if any, in $2 ($ext)
>            )$/x;           # phew!  (I mean, foo!)


FWIW,

($name, $ext) = m-\.- ? m-^(.*)\.(.*)$- : ($_, "");    # or ($_, undef)

For anyone who's unaware of this, the thing to realise here is the first
(.*) matches as much as it can so the second (.*) always ends up no '.' in
it.

Paul

ObSpeedFreakQuell: index $_, '.' will work in place of m-\.-

PS It's 2:30am, and you have no idea how tempted I was to write
($name, $ext) = /\./?/^(.*)\.(.*)$/:/(.*)/ and pass it off as a single regex

;-)

--
Paul Makepeace, Independent Thinkers Ltd (UK)
0171 377 8668 / 0973 800436
"People are all donkeys, and I am Captain Carrot"
-- Vincent Grotto












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

Date: 24 Dec 1998 00:28:52 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: sizeof() function?
Message-Id: <75s1s4$l95$4@client3.news.psi.net>

Paul Makepeace (Paul.Makepeace@POBox.com) wrote on MCMXL September
MCMXCIII in <URL:news:75rs0i$b88$1@statler.server.colt.net>:
++ 
++ Abigail wrote in message <75rac2$ht4$3@client3.news.psi.net>...
++ >      print $foo, "\n";
++ 
++ I see this construct a lot. What's the appeal?

Easier to remove the newline. Or, given a 'print $foo;', easier
to add. Or, in my case, while typing the example on the command line,
after having typed 'print $fo' and then realizing I want a newline
as well, it's easier to add then deleted and redo.



Abigail


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

Date: Thu, 24 Dec 1998 09:35:22 +0900
From: Kevin Baker <ol@twics.com>
Subject: use base
Message-Id: <Pine.HPP.3.95.981224092819.7904A-100000@beehive.twics.com>

HI,

does anyone have experience with using this? The man page says that it
establishes an IS-A relationship with the base class. 

I tried it with this bit of code

package HTML::Customer;
use strict;
#require HTML;
use base qw(HTML);

but get this error message

Can't locate object method "new" via package "HTML::Customer" at 
manilow.pl line 113.

However if I uncomment the require line it works. 

Is there any reason why this is happening? If I understand the man page I
shouldn't need the require, right?

I'd like to just write this. Saves me a whole line! woooo whooo!

package HTML::Customer;
use strict;
use base qw(HTML);

Kev


bash-2.01$ perl -v

This is perl, version 5.005_02 built for i386-svr5





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

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

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