How to Konsole
Hi How would I go about display a message say like "hello and welcome" in a konsole from a perl scripts if some thing meets a pattern that my perl srcipt is look for. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Konsole
Hi > -Original Message- > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 1:19 AM > To: [EMAIL PROTECTED] > Subject: How to Konsole > > > > Hi > > How would I go about display a message say like "hello and welcome" in a > konsole from a perl scripts if some thing meets a pattern that my > perl srcipt > is look for. > I'm not sure what you are asking; the perl 'print' command, by default, prints to STDOUT which is normally the shell or command prompt that your script was started from. So: { print "hello and welcome\n"; } would work. You may want to ask this question again with a sample script, your environment, and what you mean by 'konsole'. Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Konsole
On Sunday 16 Feb 2003 11:43 am, Beau E. Cox wrote: > Hi > > > -Original Message- > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, February 16, 2003 1:19 AM > > To: [EMAIL PROTECTED] > > Subject: How to Konsole > > > > > > > > Hi > > > > How would I go about display a message say like "hello and welcome" in a > > konsole from a perl scripts if some thing meets a pattern that my > > perl srcipt > > is look for. > > I'm not sure what you are asking; the perl 'print' command, > by default, prints to STDOUT which is normally the shell or > command prompt that your script was started from. So: > > { >print "hello and welcome\n"; > } > > would work. You may want to ask this question again with > a sample script, your environment, and what you mean by > 'konsole'. > > Aloha => Beau; Yes a know about the print A Linux Konsole abit like M$DOS window -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Konsole
On Sun, Feb 16, 2003 at 12:42:29PM +, Benjamin Jeeves wrote: > On Sunday 16 Feb 2003 11:43 am, Beau E. Cox wrote: > > Hi > > > > > -Original Message- > > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > > Sent: Sunday, February 16, 2003 1:19 AM > > > To: [EMAIL PROTECTED] > > > Subject: How to Konsole > > > > > > > > > > > > Hi > > > > > > How would I go about display a message say like "hello and welcome" in a > > > konsole from a perl scripts if some thing meets a pattern that my > > > perl srcipt > > > is look for. > > > > I'm not sure what you are asking; the perl 'print' command, > > by default, prints to STDOUT which is normally the shell or > > command prompt that your script was started from. So: > > > > { > >print "hello and welcome\n"; > > } > > > > would work. You may want to ask this question again with > > a sample script, your environment, and what you mean by > > 'konsole'. > > > > Aloha => Beau; > Yes a know about the print > > A Linux Konsole abit like M$DOS window > Could you state in clear terms what it is you are trying to do? I'm guessing here that you want to load an xterm. Is that correct? kent -- To know the truth is to distort the Universe. Alfred N. Whitehead (adaptation) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Konsole
Hi- > -Original Message- > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 2:42 AM > To: [EMAIL PROTECTED] > Subject: Re: How to Konsole > > > On Sunday 16 Feb 2003 11:43 am, Beau E. Cox wrote: > > Hi > > > > > -Original Message- > > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > > Sent: Sunday, February 16, 2003 1:19 AM > > > To: [EMAIL PROTECTED] > > > Subject: How to Konsole > > > > > > > > > > > > Hi > > > > > > How would I go about display a message say like "hello and > welcome" in a > > > konsole from a perl scripts if some thing meets a pattern that my > > > perl srcipt > > > is look for. > > > > I'm not sure what you are asking; the perl 'print' command, > > by default, prints to STDOUT which is normally the shell or > > command prompt that your script was started from. So: > > > > { > >print "hello and welcome\n"; > > } > > > > would work. You may want to ask this question again with > > a sample script, your environment, and what you mean by > > 'konsole'. > > > > Aloha => Beau; > Yes a know about the print > > A Linux Konsole abit like M$DOS window > Well, then print works! It will print text to STDOUT which is the Linux shell from whence the script was started. (Like the shell 'echo' command). If you want to get into GUI (X-Windows), look into Perl/Tk. Am I missing the point of your question? If so, try it and post a question with a script sample included. Aloha => Beau. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
gui with perl modules
First of all I would like to introduce myself. I am new to the list and this is my first post. My name is Mikel, I am from Venezuela and am very interested in learning Perl. At the moment I am interested in building Gui's for some of the work I am doing with Perl under linux. I am having trouble figuring out which Perl module to use in order to aid me in constructing these simple Gui's. Any ideas? Thank you. Mikel -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Konsole
If say the word HELLO is found within a text file then open a xterm and display within xterm I have found HELLO On Sunday 16 Feb 2003 1:21 pm, ktb wrote: > On Sun, Feb 16, 2003 at 12:42:29PM +, Benjamin Jeeves wrote: > > On Sunday 16 Feb 2003 11:43 am, Beau E. Cox wrote: > > > Hi > > > > > > > -Original Message- > > > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > > > Sent: Sunday, February 16, 2003 1:19 AM > > > > To: [EMAIL PROTECTED] > > > > Subject: How to Konsole > > > > > > > > > > > > > > > > Hi > > > > > > > > How would I go about display a message say like "hello and welcome" > > > > in a konsole from a perl scripts if some thing meets a pattern that > > > > my perl srcipt > > > > is look for. > > > > > > I'm not sure what you are asking; the perl 'print' command, > > > by default, prints to STDOUT which is normally the shell or > > > command prompt that your script was started from. So: > > > > > > { > > >print "hello and welcome\n"; > > > } > > > > > > would work. You may want to ask this question again with > > > a sample script, your environment, and what you mean by > > > 'konsole'. > > > > > > Aloha => Beau; > > > > Yes a know about the print > > > > A Linux Konsole abit like M$DOS window > > Could you state in clear terms what it is you are trying to do? > I'm guessing here that you want to load an xterm. Is that correct? > kent -- Thank You Benjamin Jeeves -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: gui with perl modules
Hi - welcome to Perl! > -Original Message- > From: Mikel Rodriguez [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 3:48 AM > To: [EMAIL PROTECTED] > Subject: gui with perl modules > > > First of all I would like to introduce myself. I am new to the > list and this > is my first post. My name is Mikel, I am from Venezuela and am very > interested in learning Perl. > > At the moment I am interested in building Gui's for some of the work I am > doing with Perl under linux. > I am having trouble figuring out which Perl module to use in > order to aid me > in constructing these simple Gui's. > Any ideas? > > Thank you. > > Mikel > I would suggest Tk - found at: http://search.cpan.org/author/NI-S/Tk-800.024/ It may, in fact, already be installed in your system. At the command prompt (or in an XTerm) type: perl -e "use Tk" If you *don't* get an error, Tk is already installed! The documentation is on CPAN (use the link above); It will take you a while to catch on, but Tk is a good package and it runs on any platform (with some kind of GUI) that perl runs on. If you don't know abount CPAN yet, go to http://cpan.org and read. It is a giant depository of user-contributed perl extensions that cover almost every software requirement known to man... Good luck, and use this list. Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Konsole
Hi - I'm still confused - > -Original Message- > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 3:59 AM > To: [EMAIL PROTECTED] > Subject: Re: How to Konsole > > > If say the word HELLO is found within a text file then open a xterm and > display within xterm I have found HELLO > > On Sunday 16 Feb 2003 1:21 pm, ktb wrote: > > On Sun, Feb 16, 2003 at 12:42:29PM +, Benjamin Jeeves wrote: > > > On Sunday 16 Feb 2003 11:43 am, Beau E. Cox wrote: > > > > Hi > > > > > > > > > -Original Message- > > > > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > > > > Sent: Sunday, February 16, 2003 1:19 AM > > > > > To: [EMAIL PROTECTED] > > > > > Subject: How to Konsole > > > > > > > > > > > > > > > > > > > > Hi > > > > > > > > > > How would I go about display a message say like "hello > and welcome" > > > > > in a konsole from a perl scripts if some thing meets a > pattern that > > > > > my perl srcipt > > > > > is look for. > > > > > > > > I'm not sure what you are asking; the perl 'print' command, > > > > by default, prints to STDOUT which is normally the shell or > > > > command prompt that your script was started from. So: > > > > > > > > { > > > >print "hello and welcome\n"; > > > > } > > > > > > > > would work. You may want to ask this question again with > > > > a sample script, your environment, and what you mean by > > > > 'konsole'. > > > > > > > > Aloha => Beau; > > > > > > Yes a know about the print > > > > > > A Linux Konsole abit like M$DOS window > > > > Could you state in clear terms what it is you are trying to do? > > I'm guessing here that you want to load an xterm. Is that correct? > > kent > > -- > Thank You > > > > Benjamin Jeeves > Assuming your input is in $string: print "hello and welcome\n" if ($string =~ /HELLO/); Now, my confusion(s): * What platform are your running on? * How is your perl script started - if not from an xterm? (an NT service - Windows or deamon - *nix, or CGI?) Sorry I am having so much trouble understanding your problem. Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Konsole
What I wanted to do was if say HELLO was found within a text file the script would open a xterm and display a message within that xterm say like I have found HELLO in name of text file. My script that I have do so far work but wanted to add a method like that the script runs as a server and I wanted it to inform me if it finds a pattern that I my looking for. On Sunday 16 Feb 2003 2:18 pm, you wrote: > Hi - I'm still confused - > > > -Original Message- > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, February 16, 2003 3:59 AM > > To: [EMAIL PROTECTED] > > Subject: Re: How to Konsole > > > > > > If say the word HELLO is found within a text file then open a xterm and > > display within xterm I have found HELLO > > > > On Sunday 16 Feb 2003 1:21 pm, ktb wrote: > > > On Sun, Feb 16, 2003 at 12:42:29PM +, Benjamin Jeeves wrote: > > > > On Sunday 16 Feb 2003 11:43 am, Beau E. Cox wrote: > > > > > Hi > > > > > > > > > > > -Original Message- > > > > > > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > > > > > > Sent: Sunday, February 16, 2003 1:19 AM > > > > > > To: [EMAIL PROTECTED] > > > > > > Subject: How to Konsole > > > > > > > > > > > > > > > > > > > > > > > > Hi > > > > > > > > > > > > How would I go about display a message say like "hello > > > > and welcome" > > > > > > > > in a konsole from a perl scripts if some thing meets a > > > > pattern that > > > > > > > > my perl srcipt > > > > > > is look for. > > > > > > > > > > I'm not sure what you are asking; the perl 'print' command, > > > > > by default, prints to STDOUT which is normally the shell or > > > > > command prompt that your script was started from. So: > > > > > > > > > > { > > > > >print "hello and welcome\n"; > > > > > } > > > > > > > > > > would work. You may want to ask this question again with > > > > > a sample script, your environment, and what you mean by > > > > > 'konsole'. > > > > > > > > > > Aloha => Beau; > > > > > > > > Yes a know about the print > > > > > > > > A Linux Konsole abit like M$DOS window > > > > > > Could you state in clear terms what it is you are trying to do? > > > I'm guessing here that you want to load an xterm. Is that correct? > > > kent > > > > -- > > Thank You > > > > > > > > Benjamin Jeeves > > Assuming your input is in $string: > > print "hello and welcome\n" if ($string =~ /HELLO/); > > Now, my confusion(s): > > * What platform are your running on? > > * How is your perl script started - if not from an xterm? > (an NT service - Windows or deamon - *nix, or CGI?) > > Sorry I am having so much trouble understanding > your problem. > > Aloha => Beau; -- Thank You Benjamin Jeeves -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tk module error
hi all , i am installing the module Tk804.0_24 from CPAN. but i get the following error while 'make' ing and couldnt install it : -error msg cd pTk && make DEFINE="" make[1]: Entering directory `/home/km/Tk804.024/pTk' gcc -c -I.. -I/usr/X11R6/include -I. -Ibitmaps -I/usr/X11R6/include -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O2 -march=i386 -mcpu=i686 -DVERSION=\"804.024\" -DXS_VERSION=\"804.024\" -fPIC "-I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE" -Wall -Wno-implicit-int -Wno-comment -Wno-unused -D__USE_FIXED_PROTOTYPES__ strdup.c strdup.c:2: parse error before `__extension__' strdup.c:2: `__len' undeclared here (not in a function) strdup.c:2: initializer element is not constant strdup.c:2: parse error before `if' strdup.c:2: conflicting types for `__retval' strdup.c:2: previous declaration of `__retval' strdup.c:2: warning: data definition has no type or storage class strdup.c:2: parse error before `}' strdup.c:4: parse error before `{' make[1]: *** [strdup.o] Error 1 make[1]: Leaving directory `/home/km/Tk804.024/pTk' make: *** [pTk/libpTk.a] Error 2 -- and now i open the strdup.c its like this : #include "tkPort.h" char * strdup(s) const char *s; { char *p = (char *) malloc(strlen(s)+1); if (p) strcpy(p,s); return p; } -- help me out -- regards, KM -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: gui with perl modules
Thank you for your response. I have taken your addive and used the "perl -MCPAN -e shell" command and then executed a install Tk Howevere, I cpan encountered errors wile making the module. Im sure it will be hard to tell what is going on with just the error mesg, but does anyone have a general isa of what to do? Here is what I got: /usr/bin/perl is installed in /usr/lib/perl5/5.6.1/i386-linux okay PPM for perl5.006001 Test Compiling config/signedchar.c Test Compiling config/Ksprintf.c Test Compiling config/tod.c Test Compiling -DTIMEOFDAY_TZ config/tod.c TZ gettimeofday() Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.so.6.2 Cannot find X include files via /usr/X11R6/include Cannot find X include files anywhere at ./myConfig line 312. Compilation failed in require at Makefile.PL line 17. BEGIN failed--compilation aborted at Makefile.PL line 19. Running make test Make had some problems, maybe interrupted? Won't test Running make install Make had some problems, maybe interrupted? Won't install cpan> - This is what line 312 of myConfig looks like: unless (defined $xinc) { warn "Cannot find X include files via $base/include\n"; $xinc = &IX11(map("$_/include",@xdirs), '/usr/openwin/include', chooseX11(), chooseX11(), , '/usr/X386/include', $Config{'usrinc'}); } die "Cannot find X include files anywhere" unless (defined $xinc); --- Any help would be greatly apreciated. On Sunday 16 February 2003 09:12 am, Beau E. Cox wrote: > Hi - welcome to Perl! > > > -Original Message- > > From: Mikel Rodriguez [mailto:[EMAIL PROTECTED]] > > Sent: Sunday, February 16, 2003 3:48 AM > > To: [EMAIL PROTECTED] > > Subject: gui with perl modules > > > > > > First of all I would like to introduce myself. I am new to the > > list and this > > is my first post. My name is Mikel, I am from Venezuela and am very > > interested in learning Perl. > > > > At the moment I am interested in building Gui's for some of the work I am > > doing with Perl under linux. > > I am having trouble figuring out which Perl module to use in > > order to aid me > > in constructing these simple Gui's. > > Any ideas? > > > > Thank you. > > > > Mikel > > I would suggest Tk - found at: > > http://search.cpan.org/author/NI-S/Tk-800.024/ > > It may, in fact, already be installed in your system. > At the command prompt (or in an XTerm) type: > > perl -e "use Tk" > > If you *don't* get an error, Tk is already installed! > The documentation is on CPAN (use the link above); It > will take you a while to catch on, but Tk is a good > package and it runs on any platform (with some kind > of GUI) that perl runs on. > > If you don't know abount CPAN yet, go to > > http://cpan.org > > and read. It is a giant depository of user-contributed > perl extensions that cover almost every software > requirement known to man... > > Good luck, and use this list. > > Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to Konsole
Ok - > -Original Message- > From: Benjamin Jeeves [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 4:32 AM > To: Beau E. Cox > Cc: [EMAIL PROTECTED] > Subject: Re: How to Konsole > > > What I wanted to do was if say HELLO was found within a text file > the script > would open a xterm and display a message within that xterm say > like I have > found HELLO in name of text file. > > My script that I have do so far work but wanted to add a method > like that the > script runs as a server and I wanted it to inform me if it finds > a pattern > that I my looking for. > OK - you have a perl script you will run in background on *nix and you want to pop up a message every now and then... Well... I tried a few things - like using system to start bash with a parameter if a script what outputs a message - and that didn't work. But I'm NOT a Linux/UNIX guru - maybe someone else can chip in. Some possibilities: * log it to a file; load the log in to a browser window - refresh to see messages. * start a simple server in an xterm and leave it running. In your main script, print to that server... the simple server then prints to its xterm, and you have your notification. * use sound - beep (or actually play a sound file) from you main script. That's it from me - good luck. Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to Konsole
On Sun, Feb 16, 2003 at 11:18:32AM +, Benjamin Jeeves wrote: > > Hi > > How would I go about display a message say like "hello and welcome" in a > konsole from a perl scripts if some thing meets a pattern that my perl srcipt > is look for. OK I'm going to post the following in hopes that it will help someone else help you or give you enough info to run with. This is just a quick hack and ugly:) 1) This will check your file for the word HELLO and load an xterm which will call another program to display a message. #!/usr/bin/perl use strict; use warnings; open FILE, 'text.txt'; while () { if (/HELLO/) { exec("xterm -e /path/to/prog.pl"); } } close FILE; 2) The "prog.pl" opened by the xterm prints a text message and in order to stop the xterm from closing I have added a line. Just hit return to close the window. #!/usr/bin/perl use strict; use warnings; print "You have found HELLO"; my $whatever = ; 3) You may want to read /HELLO/ into a scalar in the first bit of code and pass it to "prog.pl" or check for /HELLO/ in text.txt again. Clunky as I said:) hth, kent -- To know the truth is to distort the Universe. Alfred N. Whitehead (adaptation) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to get the script line number on demand
"John W. Krahn" <[EMAIL PROTECTED]> writes: > print 'Program name: ', __FILE__, "\n"; > print 'Current script line: ', __LINE__, "\n"; > print 'Current package: ', __PACKAGE__, "\n"; Thanks.. I'd seen those first too in a few places but blithely zipped over them not realizing what they were. Thanks... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: gui with perl modules
Hi Mikel - > -Original Message- > From: Mikel Rodriguez [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 4:57 AM > To: Beau E. Cox; [EMAIL PROTECTED] > Subject: Re: gui with perl modules > > > Thank you for your response. > I have taken your addive and used the "perl -MCPAN -e shell" > command and then > executed a install Tk > Howevere, I cpan encountered errors wile making the module. > Im sure it will be hard to tell what is going on with just the > error mesg, but > does anyone have a general isa of what to do? > > Here is what I got: > > > /usr/bin/perl is installed in /usr/lib/perl5/5.6.1/i386-linux okay > PPM for perl5.006001 > Test Compiling config/signedchar.c > Test Compiling config/Ksprintf.c > Test Compiling config/tod.c > Test Compiling -DTIMEOFDAY_TZ config/tod.c > TZ gettimeofday() > Using -L/usr/X11R6/lib to find /usr/X11R6/lib/libX11.so.6.2 > Cannot find X include files via /usr/X11R6/include > Cannot find X include files anywhere at ./myConfig line 312. > Compilation failed in require at Makefile.PL line 17. > BEGIN failed--compilation aborted at Makefile.PL line 19. > Running make test > Make had some problems, maybe interrupted? Won't test > Running make install > Make had some problems, maybe interrupted? Won't install > > cpan> > > - > > This is what line 312 of myConfig looks like: > > unless (defined $xinc) > { > warn "Cannot find X include files via $base/include\n"; > $xinc = &IX11(map("$_/include",@xdirs), > '/usr/openwin/include', > chooseX11(), > chooseX11(), > , > '/usr/X386/include', > $Config{'usrinc'}); > } > > die "Cannot find X include files anywhere" unless (defined $xinc); > > --- > > Any help would be greatly apreciated. > Read your INSTALL file (or look at it on CPAN): http://search.cpan.org/src/NI-S/Tk-800.024/INSTALL You have to find the x-includes on your system and specify them for your make. (If you can't find them check with your sysadmin, I know you can get them online but I haven't done that becaude they appear magically for me on my SuSE distro). I'm not sure how to specify parameters in the CPAN shell, but you can always: -download to some location- tar vxzf Tketc.tar.gz -go to extracted dir- perl Makefile.PL ...parameters as specified in INSTALL... make make test make install I almost *always* use this old-style config/make/install sequence - rather than the CPAN shell - because I feel like I have more control of the process and I can read the README, INSTALL, etc. files before starting. Aloha => Beau. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem executing perl script
John Lin wrote: Hi list, I have written a perl CGI script that basically executes a system command via an open command like so: open (COMHANDLE, '/usr/local/bin/gpg --no-tty --list-keys |') or die "can not list keys \n"; print ; close (COMHANDLE) or die "can not close COMHANDLE \n"; For some reason, if I run this CGI script in the command line, it executes correctly (I get a list of keys in the shell). But when i try to run this script in a browser, nothing is printed in the borwser. I have also tried with a simpler script that basically gets the system date and output it like so: open (COMHANDLE, 'date |') or die "Can not get system date \n"; print ; close (COMHANDLE) or die "Can not close COMHANDLE \n"; But with this script, I can run it both in the shell and in a browser and I get the system date. I am not really sure what the problem is at this time Any help is welcome! gpg depends on the user that you are running the command as, and requires either more options or a home directory. When you are running it command line are you running it as the same user as the web server? Are you trying to get your list of keys or the user the web server is running as keys'? As a side note it might be simpler to just use backticks instead of an open call, unless you are planning on doing something more interesting than reading the output, but then chances are you aren't going to want to do it this way with gpg anyways. (I can explain why if it is the case). For instance: my @output = `/usr/local/bin/gpg --no-tty --list-keys`; print @output; Don't forget to check $?... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem executing perl script
Wiggins d'Anconia wrote: John Lin wrote: As another side note if you are planning on doing anything complex you might want to have a look at the GnuPG::Interface module: http://search.cpan.org/author/FTOBIN/GnuPG-Interface-0.33/lib/GnuPG/Interface.pm http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: gui with perl modules
Beau E. Cox wrote: I almost *always* use this old-style config/make/install sequence - rather than the CPAN shell - because I feel like I have more control of the process and I can read the README, INSTALL, etc. files before starting. Just haven't read up on CPAN enough ;-) (neither had I until recently)... Within the shell do: > o conf This will dump you a list of configuration parameters. Then to set a parameter do: > o conf = In particular for install options you will probably want to be using, 'make','make_arg',make_install_arg','makepl_arg' which correspond nicely to the the command line options when doing the manual install. For viewing the README, etc. you can issue: > get To download and unpack the module, then issue: > look Which will dump you to a sub shell inside the build directory where you can look at the README, hack the makefile, etc. then just exit the sub shell and you are back into CPAN where you started... Fun for the whole family... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
help with (do $ENV{HOME})
I've read the faq on "do" and looked around the web but can't discover what I'm doing wrong. I have a file named "text" with the following line it it - $name = "kent"; My prog contains the following - #!/usr/bin/perl use diagnostics; use strict; use warnings; do "$ENV{HOME}/scratch/address_book/text"; my $name; print "$name\n"; The problem I'm having is my print statement just prints a new line without printing any text. It was my understanding that the "do" function would pull the scalars from "text" into my prog as if it was part of the program. What am I doing wrong? Thanks, kent -- To know the truth is to distort the Universe. Alfred N. Whitehead (adaptation) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: gui with perl modules
Yeah, but... > -Original Message- > From: Wiggins d'Anconia [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 6:20 AM > To: Beau E. Cox > Cc: [EMAIL PROTECTED] > Subject: Re: gui with perl modules > > > > > Beau E. Cox wrote: > > > > > I almost *always* use this old-style config/make/install > > sequence - rather than the CPAN shell - because I feel > > like I have more control of the process and I can read the > > README, INSTALL, etc. files before starting. > > > > Just haven't read up on CPAN enough ;-) (neither had I until recently)... > > Within the shell do: > > > o conf > > This will dump you a list of configuration parameters. Then to set a > parameter do: > > > o conf = > > In particular for install options you will probably want to be using, > 'make','make_arg',make_install_arg','makepl_arg' which correspond nicely > to the the command line options when doing the manual install. > > For viewing the README, etc. you can issue: > > > get > > To download and unpack the module, then issue: > > > look > > Which will dump you to a sub shell inside the build directory where you > can look at the README, hack the makefile, etc. then just exit the sub > shell and you are back into CPAN where you started... Fun for the whole > family... > > http://danconia.org > > 1) I am a creature of habit and my fingers have 'memorized' perl Makefile.PL, make, ... 2) In the early days of the CPAN shell I had a lot of problems and my brain can't forget them... 3) I am a closet power freak, and I like feeling I am in control (even when I'm not)... ON THE OTHER HAND 1) The auto-prerequi. is sooo nice... 2) CPAN shell is all fixed now... AND 1) Thanks for the info. 2) :) :) :) Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help with (do $ENV{HOME})
ktb wrote: I've read the faq on "do" and looked around the web but can't discover what I'm doing wrong. I have a file named "text" with the following line it it - $name = "kent"; My prog contains the following - #!/usr/bin/perl use diagnostics; use strict; use warnings; do "$ENV{HOME}/scratch/address_book/text"; my $name; print "$name\n"; The problem I'm having is my print statement just prints a new line without printing any text. It was my understanding that the "do" function would pull the scalars from "text" into my prog as if it was part of the program. It may be doing just that, but with the line: my $name; After the 'do' you are resetting the variable. You should be using 'our' instead of 'my'. perldoc -f our perldoc -f my http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: help with (do $ENV{HOME})
Hi - > -Original Message- > From: ktb [mailto:[EMAIL PROTECTED]] > Sent: Sunday, February 16, 2003 6:52 AM > To: [EMAIL PROTECTED] > Subject: help with (do $ENV{HOME}) > > > I've read the faq on "do" and looked around the web but can't discover > what I'm doing wrong. > > I have a file named "text" with the following line it it - > $name = "kent"; > > My prog contains the following - > #!/usr/bin/perl > use diagnostics; > use strict; > use warnings; > > do "$ENV{HOME}/scratch/address_book/text"; > my $name; > print "$name\n"; > > The problem I'm having is my print statement just prints a new line > without printing any text. It was my understanding that the "do" > function would pull the scalars from "text" into my prog as if it was > part of the program. > > What am I doing wrong? > Thanks, > kent > I think this type of 'do' reads the file and evals it (you should check $@ to see if it evaled OK). The eval returns whatever the script in the file returns. So... 1) Change your file to contain only "kent"; 2) load $name as follows: my $name = do "$ENV{HOME}/scratch/address_book/text"; die "bad file (whatever): $@\n" if $@; 3) all done. Aloha => Beau; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: gui with perl modules
Beau E. Cox wrote: Yeah, but... Ditto. 1) I am a creature of habit and my fingers have 'memorized' perl Makefile.PL, make, ... 2) In the early days of the CPAN shell I had a lot of problems and my brain can't forget them... 3) I am a closet power freak, and I like feeling I am in control (even when I'm not)... Yeh I definitely agree, but the first time I had to install 15 or so modules, many of which had 6-10 prereqs (see any module in Crypt:: ;-)), in a non-root environment I became a believer. ON THE OTHER HAND 1) The auto-prerequi. is sooo nice... 2) CPAN shell is all fixed now... AND 1) Thanks for the info. 2) :) :) :) No problem. Though whenever I want a throw back to the good ole days of Slakware, I just check out the latest copy of Enlightenment 17 and see if I can get it to run that usually sufficiently humbles me back into using CPAN ;-) http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help with (do $ENV{HOME})
On Sun, Feb 16, 2003 at 12:05:57PM -0500, Wiggins d'Anconia wrote: > > > ktb wrote: > >I've read the faq on "do" and looked around the web but can't discover > >what I'm doing wrong. > > > >I have a file named "text" with the following line it it - > >$name = "kent"; > > > >My prog contains the following - > >#!/usr/bin/perl > >use diagnostics; > >use strict; > >use warnings; > > > >do "$ENV{HOME}/scratch/address_book/text"; > >my $name; > >print "$name\n"; > > > >The problem I'm having is my print statement just prints a new line > >without printing any text. It was my understanding that the "do" > >function would pull the scalars from "text" into my prog as if it was > >part of the program. > > > > It may be doing just that, but with the line: > > my $name; > > After the 'do' you are resetting the variable. You should be using 'our' > instead of 'my'. > > perldoc -f our > perldoc -f my > Thanks much had not heard of "our" till now. That did the trick:) kent -- To know the truth is to distort the Universe. Alfred N. Whitehead (adaptation) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: problem executing perl script
John Lin wrote: > Hi list, > > I have written a perl CGI script that basically executes a system > command via an open command like so: > > open (COMHANDLE, '/usr/local/bin/gpg --no-tty --list-keys |') or die > "can not list keys \n"; > print ; > close (COMHANDLE) or die "can not close COMHANDLE \n"; > > For some reason, if I run this CGI script in the command line, it > executes correctly (I get a list of keys in the shell). > But when i try to run this script in a browser, nothing is printed in > the borwser. Hi John, I think it's highly unlikely that the problem is in the lines you sent. How are you opening your output to the browser? How are you getting input or the rquest from the browser? I think we need to see the whole script to be able to help you much. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Quickie
What's the equivalent to $variable++ but to decrease a number instead of increase? Dan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: writing a script
On Sat, Feb 15, 2003 at 01:03:50PM -0800, brady jacksan wrote: > Hi Hi, > I am writing a script that reads file from command line and places > each line from the files into an array, and prints out the total lines > read and then > each line read. > > while (defined ($files = <>)) { > chomp; > print "Total lines in the files:@files\." ^ > print "@files\n" ^ > ^ > why do keep getting compilation errors? Because your syntax is invalid. Braces must be balanced, and each statement must end in a semicolon. Also, you don't need to escape periods in quoted strings. -- Michael [EMAIL PROTECTED] http://www.jedimike.net/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
re:felloship chat
it keeps tellinj me to push refresh button,No siccess.Then it says push reload button on browser. But can you please tell me hoe to do this? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
automatic telnet
Hi I have used NEt::telnet for remote login and automatic login to oen freebsd , it's ok and i could login ,but how can i telnet as root? i mean how can i do "su - root" with net::telnet ? or is there other way to do that ? Sky __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Quickie
Dan wrote: > > What's the equivalent to $variable++ but to decrease a number instead of > increase? $variable-- John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: help with (do $ENV{HOME})
ktb, Wiggins, Another perspective: text.txt contains: return 'My Full Name with middle initial'; #!/usr/bin/perl -w use strict; my $name = do "./text.txt"; print "$name\n"; prints: My Full Name with middle initial > > The problem I'm having is my print statement just prints a new line > > without printing any text. It was my understanding that the "do" > > function would pull the scalars from "text" into my prog as if it was > > part of the program. > It may be doing just that, but with the line: > my $name; > After the 'do' you are resetting the variable. You should be using 'our' > instead of 'my'. > perldoc -f our > perldoc -f my Note also that I use the -w. (Not right or wrong, just warning you of different behavior) HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
linked lists?
I just had a friend explain in some little detail about linked lists in C using structures. How would such a thing be done with Perl? This may help me understand C's version a little better. If you need more information than this, I can provide it...I think :) - Jim -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Visual Perl/TK
Does anyone know about the existence of any good Visual Perl/Tk application for both windows and linux? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: automatic telnet
blue wrote: Hi I have used NEt::telnet for remote login and automatic login to oen freebsd , it's ok and i could login ,but how can i telnet as root? Well to login as root is different than to su in as root, which do you need? i mean how can i do "su - root" with net::telnet ? or is there other way to do that ? Have you read the docs for Net::Telnet? It appears you should login, then use the 'print' and 'waitfor' commands to do you 'su'. Then any commands following that should be done in a privileged manner. perldoc Net::Telnet From the above: "Consider using a combination of "print()" and "waitfor()" as an alternative to this method when it doesnt do what you want, e.g. the command you send prompts for input." http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: linked lists?
JC(oesd) wrote: I just had a friend explain in some little detail about linked lists in C using structures. How would such a thing be done with Perl? This may help me understand C's version a little better. If you need more information than this, I can provide it...I think :) Well a linked list is really a type of data structure, C uses structs because that is the easiest way to combine related pieces of data, but that isn't the only way to handle it in C, which also means there are many ways to handle it in Perl. My CS is a little rusty and I haven't implemented one in a while, but one way would be to use hashes. Depending on whether your list is bi-directional would determine how many keys you need, aka 2 or 3 depending on whether you needed to store the next element only, or both the next and previous. So essentially you end up with a bunch of hashes, with one key 'next' which stores a reference to the next hash, and a key 'prev' which stores a reference to the previous hash, and then a key 'data' which stores a scalar or a reference to whatever your data looks like. Another way would be to use an array, and then your methods for adding elements, shifting elements, and removing elements would need to do a bunch of splicing, which seems like it wouldn't be as clean as the hash method. The key really is to have a way to store whatever data you need, along with a "link" to the next (and maybe previous) element. Then to write whatever methods you need, to work on the chain. perldoc -q "linked" perldoc perldsc perldoc perlreftut perldoc perlref http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
proxy server
i am trying to write a mini proxy server to authenticate and run some other checking on http requests before they are passed to a squid server. I have got the following program which works for very basic requests but cannot deal with forms or anything complex. I will detail the problems after the snip: #!/usr/bin/perl # Standard common-sense modules use strict; use warnings; # Modules for getting http pages use LWP::UserAgent; use URI::URL; use HTTP::Request; use HTTP::Headers; # Modules for dealing with the sockets use IO::Socket; use Net::hostent; # Modules for DNS lookups and mysql connection use Net::MySQL; use Net::DNS; # The port the proxy server will run on my $PORT = 8850; # urn on autoflushing $| = 1; # Get the config file our %CONFIG; require './proxy.conf'; # Manage correct internet line endings my $EOL1 = "\012"; my $EOL2 = "\015"; # Do all the logging in one function sub logmsg { my ($mesg) = @_; my $date = `date`; chomp($date); print LOG "[$date]: $mesg\n"; print "[$date]: $mesg\n"; } my $mysql; # Connect to the mysql database for authentication if specified in the # config file if ($CONFIG{'use_auth_mysql'} eq 'true') { my $mysql = Net::MySQL->new( hostname => $CONFIG{'mysql_host'}, database => $CONFIG{'mysql_name'}, user => $CONFIG{'mysql_user'}, password => $CONFIG{'mysql_pass'} ); } # Open the listening socket my $server = IO::Socket::INET->new( Proto => 'tcp', LocalPort => $PORT, Listen=> SOMAXCONN, Reuse => 1 ); # Die unless the socket is ok die "can't setup server: $!\n" unless $server; # Open a logfile open (LOG, ">>$CONFIG{'logfile'}") || die "couldn't open file, $!\n"; # Specify SIG INT sub $SIG{'INT'} = 'shutdown'; sub shutdown { logmsg "SIGINT caught"; if ($CONFIG{'use_auth_mysql'} eq 'true') { logmsg "Closing connection to database..."; $mysql->close; } logmsg "Closing client connections..."; $server->close; logmsg "Closing logfile..."; close LOG; exit; } # Print message to show startup ok logmsg ("Server accepting clients on $PORT"); # Fork to allow multiple connections fork(); # For every client connection while (my $client = $server->accept()) { # Force autoflushing $client->autoflush(1); # Get the remote client ip/hostname my $hostinfo = gethostbyaddr($client->peeraddr); my $remote_info = $hostinfo->name || $client->peerhost; my ($url, @headers); # Get the request from the client... while (my $input = <$client>) { if ($input =~ m/^GET /) { # Get the requested url from the supplied headers $input =~ s/GET //; $input =~ s/ HTTP\/1.1//; $input =~ s/$EOL1//; $input =~ s/$EOL2//; $url = $input; } else { # Add the input to the list of headers push (@headers, $input); if ($input =~ m/Cookie/) { last; } print "$input"; } } print @headers; my $hdrs = new HTTP::Headers(@headers); my $url2 = new URI::URL($url); my $req = new HTTP::Request('GET', $url, $hdrs); my $ua = new LWP::UserAgent; my $resp = $ua->request($req); if ($resp->is_success) { my $results = $resp->content; print $client "$results"; chomp($url); logmsg ("$url - $remote_info - ok"); } else { chomp($url); logmsg ("$url - $remote_info - ".$resp->message); } } I believe the problem is recieving the headers. In the while() loop that reads the headers from the browser, the browser never gives a ^D so the while loop hangs. Any suggestion on how to cure this or any other ideas? cheers Mat Harris OpenGPG Public Key ID: C37D57D9 [EMAIL PROTECTED]www.genestate.com msg38670/pgp0.pgp Description: PGP signature
Re: linked lists?
Hi Jim, "JC(oesd)" wrote: > I just had a friend explain in some little detail about linked lists in C > using structures. > > How would such a thing be done with Perl? In brief, Perl already has a built-in linked list structure. It is called Array. > This may help me understand C's > version a little better. Probably not. Perl and C take very different paths when handling low-level functionality. In Perl, you don't have the precisely typed variables that you use with C. Nor do you have the straightforward definition of new types that you get with a C struct or C++ class. Although you could artificially construct a linked list in Perl, it probably would not make sense, or render any results you could not obtain using the built-in containers. I strongly suspect that the Perl Array type is actually implemented on a linked list. It operates in very similar ways, with push and pop providing stack-type functionality, and shift accessing the first-in item of a queue. Also, the Perl Array type allows the deletion of elements [but DON'T DO IT while iterating through the array], which is a very linked-list sort of offering: In a list you can simply re-link the node preceding the deltion node to the node following it, then delete the deletion node itself. In a true array you would have to shift the values in all subsequent nodes backwards to fill in the gap. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
client side password protection
I've come up with a system that is pretty hard to crack I think. I used flash to read a txt file that is created by a perl script. Perl makes a jumbled array of letters and numbers and directory info and puts it into a txt file. With flash you can't see the source code. In fact the encryption code doesn't even help a hacker. It's created from a random number in my perl script. Then after it loads in flash another random number jumbles the array one more time. Flash sends the encrypted password to another script which unwinds it. The orignal password is then sent to the crypt unix function. Nobody can see the users original password in transit from the browser. The only way to crack the password is to catch the transmission at exactly the same time they are installing the program, while creating their password. The txt file with the key and installation files self destruct after login. __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
eegads! File::Copy not copying
Everything "was" perfect in my little program. I gave it a test run today. My file which copies some demofiles is sending blank empty files. I've used -e to make sure it exists and checked the return value on the copy(). Both check out fine. But the files have no content. Any suggestions? This is a snippet from one copy statement: my$ok = ""; $ok = copy("/$htmlroot/$htmldir/demosite/$filenames[$i]","/$htmlroot/$htmldir/$files[$i]") || push(@messages, "Couldn't copy /$htmlroot/$htmldir/demosite/$filenames[$i],\n to /$htmlroot/$htmldir/$files[$i]\n Error: $!"); if(-e "/$htmlroot/$htmldir/$files[$i]" && $ok){ push(@messages, "Copied /$htmlroot/$htmldir/demosite/$filenames[$i],\n to /$htmlroot/$htmldir/$files[$i]"); } Anybody see a mistake??? __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eegads! File::Copy not copying
Precedence. Patricia Hinman wrote: Everything "was" perfect in my little program. I gave it a test run today. My file which copies some demofiles is sending blank empty files. I've used -e to make sure it exists and checked the return value on the copy(). Both check out fine. But the files have no content. Any suggestions? This is a snippet from one copy statement: my$ok = ""; $ok = copy("/$htmlroot/$htmldir/demosite/$filenames[$i]","/$htmlroot/$htmldir/$files[$i]") || push(@messages, "Couldn't copy /$htmlroot/$htmldir/demosite/$filenames[$i],\n to /$htmlroot/$htmldir/$files[$i]\n Error: $!"); In the above the || binds more tightly than =, you need 'or' instead... if(-e "/$htmlroot/$htmldir/$files[$i]" && $ok){ push(@messages, "Copied /$htmlroot/$htmldir/demosite/$filenames[$i],\n to /$htmlroot/$htmldir/$files[$i]"); } Anybody see a mistake??? At least I am pretty sure ;-)... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Out Of memory
Hello All, We installed a shopping cart program awhile back, written perl, which was working fine... no problems.. then when we upgraded the cart the other day, then started getting an "Out of Memory" errors from one of the scripts, but not all the time, and I've been working on this most day, trying to find what would cause this type of error. Is there anything in particular in a script, that would cause this type of error?? Any suggestions or areas to look at, would be greatly appreciated. TIA, -- MikeBlezien =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thunder Rain Internet Publishing Providing Internet Solutions that work! http://www.thunder-rain.com Tel: 1(985)902-8484 MSN: [EMAIL PROTECTED] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eegads! File::Copy not copying
Thankyou for the advice, but it still sends blanks. Should I open up each individual file and copy it using open statements? Isn't there a switch which checks for file content. I haven't had the need to check that till now. --- Wiggins d'Anconia <[EMAIL PROTECTED]> wrote: > Precedence. > > Patricia Hinman wrote: > > Everything "was" perfect in my little program. I > gave > > it a test run today. My file which copies some > > demofiles is sending blank empty files. I've used > -e > > to make sure it exists and checked the return > value on > > the copy(). Both check out fine. But the files > have > > no content. > > > > Any suggestions? > > > > This is a snippet from one copy statement: > > > > my$ok = ""; > > $ok = > > > copy("/$htmlroot/$htmldir/demosite/$filenames[$i]","/$htmlroot/$htmldir/$files[$i]") > > || push(@messages, "Couldn't copy > > /$htmlroot/$htmldir/demosite/$filenames[$i],\n to > > /$htmlroot/$htmldir/$files[$i]\n Error: $!"); > > > > In the above the || binds more tightly than =, you > need 'or' instead... > > > if(-e "/$htmlroot/$htmldir/$files[$i]" && $ok){ > > push(@messages, "Copied > > /$htmlroot/$htmldir/demosite/$filenames[$i],\n to > > /$htmlroot/$htmldir/$files[$i]"); > > } > > > > Anybody see a mistake??? > > At least I am pretty sure ;-)... > > http://danconia.org > __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eegads! File::Copy not copying
I combed the file and found an open statement in the wrong place. Thankyou everyone for all your help. It is appreciated! __ Do you Yahoo!? Yahoo! Shopping - Send Flowers for Valentine's Day http://shopping.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: eegads! File::Copy not copying
Patricia Hinman wrote: > Everything "was" perfect in my little program. I gave > it a test run today. My file which copies some > demofiles is sending blank empty files. I've used -e > to make sure it exists and checked the return value on > the copy(). Both check out fine. But the files have > no content. > > Any suggestions? > > This is a snippet from one copy statement: > > my$ok = ""; > $ok = > copy("/$htmlroot/$htmldir/demosite/$filenames[$i]","/$htmlroot/$htmldir/$files[$i]") > || push(@messages, "Couldn't copy > /$htmlroot/$htmldir/demosite/$filenames[$i],\n to > /$htmlroot/$htmldir/$files[$i]\n Error: $!"); One validation approach at a time. You are assigning the return value of the copy staement to $ok, OK? If you need to add the error message to the messages array, you can do that on a separate line, with nuch greater clarity: $ok = copy($demodir . '/' . $filenames[$i], $targetdir . '/' . $files[$i]) if (!$ok) { push(@messages, "Couldn't copy $demodir/$filenames[$i],\n" . "to $targetdir/$files[$i]\n Error: $!"); } The or operator should be a tool, not a mantra. > if(-e "/$htmlroot/$htmldir/$files[$i]" && $ok){ > push(@messages, "Copied > /$htmlroot/$htmldir/demosite/$filenames[$i],\n to > /$htmlroot/$htmldir/$files[$i]"); > } > > Anybody see a mistake??? Since $ok will have a value whether or not the file copy succeeded, and since at least the filename is copied, WHETHER OR NOT the original existed, you have no real test here. I don't know, Patricia. Following the principle of KISS, I just used File::Copy to copy a stray mpeg from my test directory for this list to its parent directory, as follows: #!/usr/bin/perl -w use strict; use warnings; use File::Copy; copy ("venus.mpg", "..\\venus.mpg"); Then I went to Explorer, clicked on the newly-copied venus.mpg in the target directory, and was treated to a thirty-second simulation of a Venus flyover, as seen through the clouds. File::Copy works fine. Uncomplicate your code a little, do one thing at a time, and see what you get. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: linked lists?
on Sun, 16 Feb 2003 18:29:23 GMT, [EMAIL PROTECTED] (Jc) wrote: > How would such a thing be done with Perl? This may help me > understand C's version a little better. You may want to take a look at O'Reilly's "Mastering Algorithms with Perl", by Jon Orwant, Jarkko Hietaniemi and John Macdonald, which has a whole chapter on advanced data structures, including linked lists. -- felix -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]