Re: unloading zip files with perl install script
On Sat, Feb 08, 2003 at 09:37:40PM -0800, Patricia Hinman wrote: > Does anyone know how to use a zip utility in an > installation script. I would like to create an > installation script for a program I've written. My > only hurdle is learning how to unpack the zip file. > I've heard of gunzip, can I use that with perl? > I'm sorry I meant to say "unzip" instead of "gunzip." 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: unloading zip files with perl install script
On Sat, Feb 08, 2003 at 09:37:40PM -0800, Patricia Hinman wrote: > Does anyone know how to use a zip utility in an > installation script. I would like to create an > installation script for a program I've written. My > only hurdle is learning how to unpack the zip file. > I've heard of gunzip, can I use that with perl? > If you are working in a *nix environment you could call "gunzip" with "system" - system("/bin/gunzip $file_archive"); 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: confused with File::Glob
Harry Putnam wrote: > > Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: > > > And || enforces scalar context, so func() won't (can't) return a list, in > > your case. > > Thanks, I'd have been a very long time figuring that out... Another point. > cat ./testglob.pl > #!/usr/local/bin/perl -w > > use File::Glob ':glob'; ^^^ Note that the only options available are ':case', ':nocase' and ':globally', John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
unloading zip files with perl install script
Does anyone know how to use a zip utility in an installation script. I would like to create an installation script for a program I've written. My only hurdle is learning how to unpack the zip file. I've heard of gunzip, can I use that with perl? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: confused with File::Glob
Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> writes: > And || enforces scalar context, so func() won't (can't) return a list, in > your case. Thanks, I'd have been a very long time figuring that out... -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: confused with File::Glob
On Feb 8, Harry Putnam said: > @files = bsd_glob("$glob_pattern",GLOB_ERR)|| die "Yikes: $!"; This line screws you up. Change the || to 'or'. @files = bsd_glob(...) or die "Yikes: $!"; The reason being: || binds very tightly, and 'or' binds less tightly. With ||, your code is like @files = (func() || die); whereas with 'or', your code is like (@files = func()) || die; And || enforces scalar context, so func() won't (can't) return a list, in your case. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
confused with File::Glob
Apparently I'm not getting what it is that File::Glob is supposed to do: ls tmp/file_[0-9]*|wc -l 99 All 99 look like tmp/file_NUM with incrementing number. Why doesn't this code unwind the list of files? when this command is given: ./testglob.pl 'tmp/file_[0-9]*' cat ./testglob.pl #!/usr/local/bin/perl -w use File::Glob ':glob'; ## Examles from perldoc File::Glob # @list = bsd_glob('*.[ch]'); # $homedir = bsd_glob('~gnat', GLOB_TILDE | GLOB_ERR); # if (GLOB_ERROR) { # # an error occurred reading $homedir # } $glob_pattern = shift; @files = bsd_glob("$glob_pattern",GLOB_ERR)|| die "Yikes: $!"; for(@files){ print "$_\n"; } Results: ./testglob.pl 'tmp/file_[0-9]*' tmp/file_99 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
html continuation between functions
Hi, I want to rewrite this script in pure cgi, I really need help at this point. I want to write a form but half of it is in one function and the other half is in the other, and I cant continue the flow of the html from one function to the next. The excerpt is as follows. sub displayNewDeleteUpdateScreen { my $cgi = shift; my $operation = shift; my $address_op; my $TITLE = "Employee Timecards Calculation"; $address_op = "Enter New Record" if ($operation eq "ADD"); $address_op = "Enter Search Criteria For Deletion" if ($operation eq "DELETE"); $address_op = "Enter Search Criteria For Updates" if ($operation eq "UPDATE"); print $cgi->header( -bgcolor=> 'lightgrey'); print $cgi->start_html($TITLE); print $cgi->start_form(); print $cgi->h3({ -align=>'center'}, "$address_op"); print $cgi->start_form(); print $cgi->br; print $cgi->hr; if ($operation eq "ADD") { print "Enter The New Information In The Form Below\n"; print $cgi->table( { -border=>'0', -cellpadding=> '5', -cellspacing=> '5', -align=> 'center'}, #HERE IS THE BREAK. } elsif ($operation eq "UPDATE") { print "Enter Criteria To Query On In The Form Below.\nYou will then be able to choose entries to modify from the resulting list.\n"; print ""; } else { print "Enter Criteria To Query On In The Form Below.\nYou will then be able to choose entries to delete from the resulting list.\n"; print ""; } getRecordTableHTML(); print hr; print p; if ($operation eq "ADD") { print p; print submit('submit_add', 'Add This New Record'); print p; } elsif ($operation eq "UPDATE") { print qq` Perform Exact Search `; } else { print qq` Perform Exact Search VALUE="Query For List To Delete"> `; } # print the HTML footer. print reset(); print submit('display_main_menu', 'Main Menu'); print end_form(); print end_html(); } # end of displayNewUpdateDeleteScreen sub getRecordTableHTML { my $cgi = shift; #STARTS HERE AGAIN... Tr( { -align=>'left', -valign=>'top'}, [ td( 'Enter Name of New Employee:', textfield(-name=>'emp_name', -size=>50, -maxlength=>80)), td( 'Enter Employee Status:', popup_menu(-name=>'emp_status', -values=>[qw/full_time part_time temp/], -labels=>{'full_time'=>'one', 'part_time'=>'two', 'temp'=>'three'}, -default=>'full_time')), td( 'Enter Hourly Rate of New Employee:', textfield(-name=>'hr_rate', -default=>'starting value', -size=>5, -maxlength=>5)), td( 'Enter Overtime Rate of New Employee:', textfield(-name=>'ot_rate', -size=>5, -maxlength=>5)) ] )); } # end of getAddressTableHTML Any help will be greatly appreciated. thanks, Ebaad. _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perl script
dakenah johnson wrote: > Hi all, > I am a novice to perl. I find Perl very interesting and I am studying how to > write and compile perl scripts without syntax and compilation errors. I need > heads up on how. > > thanks, > DJ Hi DJ, You might want to re-think your emphasis here. Of ocurse, you need to eliminate these errors, but not by suppression. For instance, you can reduce the number of error messages vastly simply by removing the use strict; statement. Your code may then compile without explicit error. Unfortunately there is a good chance that it will not be doing what you think it is, or what you want. These errors, or to be more specific, the rules whose violation invokes the errors, are your friends. They will generally indicate an underlying logic error. If you suppress the error, the program will go ahead and run on broken logic. That's the sort of convenience that could toast a system. Perl is a syntactically tricky languiage. Because many of the operators are highly context-sensitive, a formulation that works very well in one place will not work at all in another. You definitely should have a basic reference. Randal Schartz's "Learning Perl" is considered the essential starter text, but has one major shortcoming in that it seems to constantly make external reference to Larry Wall's Programming Perl. This strikes me as a sort of sweetheart deal. As the others have told you, use strict and use warnings are a good place to start. These will force you to predeclare the scope and containment capacity of your variables. I personally would prefer that data type was also explicitly declared, but that's not the way Perl works. Most Perl users prefer the features that allow us to use the same variable to represent both a numerical value and its representation. As for me, it gives me the Willies--but I still use it. I suggest that you focus first on the logic--what you want to accomplish, what steps must be taken to do it, what values must be stored, accessed or manipulated. The language and its syntax are only a medium for communicating that logic, so don't worry about syntax errors until you see them. Then work on specific examples, since there is no blanket recipe for preventing them. One other tip--when you do start testing scripts, and you need jhelp with compiler errors, please mark the line numbers the error messages refer to. You may have to change code editors to find one that shows line numbers, but they are the most useful debugging information available to you or those helping you. Joseph -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perl script
Dakenah Johnson wrote: > Hi all, > I am a novice to perl. I find Perl very interesting and I am studying > how to write and compile perl scripts without syntax and compilation > errors. I need heads up on how. Erm. That's a bit of a broad brief isn't it? I think I have to throw it back to you and say, "What problems are you having with syntax and compilation areas?". Except to say: use strict; use warnings; at the beginning of every Perl peogram! Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Perl script
dakenah johnson wrote: Hi all, I am a novice to perl. I find Perl very interesting and I am studying how to write and compile perl scripts without syntax and compilation errors. I need heads up on how. This is a very vague question...but here are some pointers: always do: use strict; use warnings; At the beginning of your scripts, this will save you many headaches later. You can run syntax checks of your script without executing them by doing: perl -c Familiarize yourself with the perldocs, check to see what is available to you by doing: perldoc perl And for specific error messages that you may receive, check: perldoc perldiag Finally don't be afraid to ask questions, here or in other forums, don't get frustrated, experience takes time to develop, and if you haven't already, check out "Learning Perl" from O'Reilly (http://www.ora.com) it is an excellent resource (from what I have heard, would have been nice to know that 6 years ago ;-)) Good luck http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pipe Help
John W. Krahn wrote: > my @file = ; > > Then at the end of the program: > > __DATA__ > tony > boby > zombie > anthony > martine > eric > charlie I forgot you could do that! Thanks John. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Perl script
Hi all, I am a novice to perl. I find Perl very interesting and I am studying how to write and compile perl scripts without syntax and compilation errors. I need heads up on how. thanks, DJ _ MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pipe Help
"John W. Krahn" wrote: > > Anthony wrote: > > > > @file = qw (tony boby zombie anthony martine eric charlie); > > It seems like you need newlines at the end of each element. > > my @file = < tony > boby > zombie > anthony > martine > eric > charlie > FILE Sorry, that's not going to work. :-) my @file = ; Then at the end of the program: __DATA__ tony boby zombie anthony martine eric charlie John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pipe Help
Anthony wrote: > > Hi, Hello, > what i'm creating is just an EXTREMELY script that sends an array to another > script via PIPE. > This is what i have: > > > #! /usr/bin/perl use warnings; use strict; > @file = qw (tony boby zombie anthony martine eric charlie); It seems like you need newlines at the end of each element. my @file = < open(SORT, "| perl sorted.pl"); You should _always_ verify that the pipe opened AND closed correctly. open SORT, '| perl sorted.pl' or die "Cannot open pipe to 'perl sorted.pl' $!"; > while(@file){ > chomp $_; There is nothing in the data TO chomp; > print SORT "$_\n"; > } If you include the newlines as I showed above then: print SORT @file; close SORT or die "Cannot close pipe to 'perl sorted.pl' $!"; > print "DID it WORKed??"; > ### > > Now in my other script called sorted. pl i'm using the "sort" command to > sort the array. But my question is How should i write the sorted.pl script > to received the data and then send it back You can't. Pipes only work in one direction. If you want bi-directional data transfer then look at IPC::Open2 or IPC::Open3 and read the perlipc document for alternatives. perldoc IPC::Open2 perldoc IPC::Open3 perldoc perlipc John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: daemons ???
[EMAIL PROTECTED] wrote: > Hi all, > > well i really need a server :-) > thanks, > KM Hi K. I really think you ought to come clean on what you're actually trying to do to give Wiggins (and the rest of us) a sporting chance of helping you :) The bottom line is that you can write a daemon in any language you like. The only question is whether it can get access to the data and conditions that it needs to to provide the functionality that you need. For exactly that reason it would be vey difficult to write anything useful in JavaScript as it only has sight of the document model. So, what is the functionality that you need? Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pipe Help
Anthony wrote: > Hi, > > what i'm creating is just an EXTREMELY script that sends an array to > another script via PIPE. Never coded in EXTREMELY before, but I'll have a go ;-) > This is what i have: > > > #! /usr/bin/perl ALWAYS: use strict; use warnings; > @file = qw (tony boby zombie anthony martine eric charlie); > open(SORT, "| perl sorted.pl"); > > while(@file){ > chomp $_; > print SORT "$_\n"; > } The test in your while condition, @file, is the number of elements in the array. You loop will therefore execute indefinitely as the array isn't empty. If you'd enabled warnings as I suggest above you would have seen an endless steam of messages saying that $_ was undefined within the loop, which would have bee a good hint. You need something like: foreach (@file) { chomp; print SORT "$_\n"; } > print "DID it WORKed??"; > ### > Now in my other script called sorted. pl i'm using the "sort" > command to sort the array. But my question is How should i write the > sorted.pl script to received the data and then send it back If you > could write the code for me please. No, I'm not going to write it for you, and I don't think most people in the group would either as it would teach you nothing. Try it yourself and we'll help you out if you get stuck. > I tried, @ARGV - or shift but no luck. I really don't know > how to do it Well that's a good start. Anything piped into a Perl script (indeed any p;rogram) like you've done appears on STDIN. > Any help GREATLY appreciated, maybe my other script is also wrong, Yes, maybe it is! Cheers, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pipe Help
Hi, i'm trying to learn pipe, so i need start somewhere i could of just say sort @file print @file and that is it but like i said i want to learn the mechanism of pipe Anthony "Anthony" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > what i'm creating is just an EXTREMELY script that sends an array to another > script via PIPE. > This is what i have: > > > #! /usr/bin/perl > @file = qw (tony boby zombie anthony martine eric charlie); > open(SORT, "| perl sorted.pl"); > > while(@file){ > chomp $_; > print SORT "$_\n"; > } > > print "DID it WORKed??"; > ### > > Now in my other script called sorted. pl i'm using the "sort" command to > sort the array. But my question is How should i write the sorted.pl script > to received the data and then send it back If you could write the code for > me please. > I tried, @ARGV - or shift but no luck. I really don't know how to > do it > > Any help GREATLY appreciated, maybe my other script is also wrong, > > Anthony > > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Pipe Help
anthony wrote: Hi, what i'm creating is just an EXTREMELY script that sends an array to another script via PIPE. This is what i have: #! /usr/bin/perl @file = qw (tony boby zombie anthony martine eric charlie); open(SORT, "| perl sorted.pl"); while(@file){ chomp $_; print SORT "$_\n"; } print "DID it WORKed??"; ### Now in my other script called sorted. pl i'm using the "sort" command to sort the array. But my question is How should i write the sorted.pl script to received the data and then send it back If you could write the code for me please. I tried, @ARGV - or shift but no luck. I really don't know how to do it Any help GREATLY appreciated, maybe my other script is also wrong, I am wondering if how you are going about this is completely wrong, why is the second script being called over the command line (pipe) in teh first place. Lets back up a few steps first... Is there a reason why the built-in 'sort' can't be used? perldoc -f sort Is there a reason why the functionality in the 'sorted.pl' can't be encapsulated, and then 'require'd or 'use'd, and then call the subroutine that would encapsulate that functionality? If all you are trying to do is sort an array it should be *much* simpler than this... http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: daemons ???
[EMAIL PROTECTED] wrote: Hi all, well i really need a server :-) thanks, KM Still confused as to why, but ok... How will your clients be connecting to the server? I would suggest having a look at: perldoc -f fork perldoc -f wait perldoc -f waitpid perldoc perlipc You may also want to have a look at: http://search.cpan.org/modlist/Server_Daemon_Utilities http://poe.perl.org http://danconia.org On Sat, 8 Feb 2003, Wiggins d'Anconia wrote: [EMAIL PROTECTED] wrote: Hi, well to make it clear -- i need to make a server -- a constantly running process -- suppose if i want to get a daily report of the frequency of all the users logging in and out on the system from the daemon written in perl -- how do i do that ? thanks, KM You probably wouldn't need a daemon/server at all if you are just looking for a daily report. You should use whatever facility your particular OS uses for scheduling events, cron on unix, something else which I won't suggest I know about, on Windows or old Macs. That scheduler would then kick off the Perl process which can grab its data, send the report (via email, for example) and then quit. Would this work, or do you really need a daemon/server? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Pipe Help
Hi, what i'm creating is just an EXTREMELY script that sends an array to another script via PIPE. This is what i have: #! /usr/bin/perl @file = qw (tony boby zombie anthony martine eric charlie); open(SORT, "| perl sorted.pl"); while(@file){ chomp $_; print SORT "$_\n"; } print "DID it WORKed??"; ### Now in my other script called sorted. pl i'm using the "sort" command to sort the array. But my question is How should i write the sorted.pl script to received the data and then send it back If you could write the code for me please. I tried, @ARGV - or shift but no luck. I really don't know how to do it Any help GREATLY appreciated, maybe my other script is also wrong, Anthony -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: daemons ???
Hi all, well i really need a server :-) thanks, KM On Sat, 8 Feb 2003, Wiggins d'Anconia wrote: > > > [EMAIL PROTECTED] wrote: > > Hi, > > > > well to make it clear -- i need to make a server -- a constantly running > > process -- > > suppose if i want to get a daily report of the frequency of all the users > > logging in and out on the system from the daemon written in perl -- how do i do >that ? > > thanks, > > KM > > You probably wouldn't need a daemon/server at all if you are just > looking for a daily report. You should use whatever facility your > particular OS uses for scheduling events, cron on unix, something else > which I won't suggest I know about, on Windows or old Macs. That > scheduler would then kick off the Perl process which can grab its data, > send the report (via email, for example) and then quit. > > Would this work, or do you really need a daemon/server? > > http://danconia.org > > > -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: daemons ???
[EMAIL PROTECTED] wrote: Hi, well to make it clear -- i need to make a server -- a constantly running process -- suppose if i want to get a daily report of the frequency of all the users logging in and out on the system from the daemon written in perl -- how do i do that ? thanks, KM You probably wouldn't need a daemon/server at all if you are just looking for a daily report. You should use whatever facility your particular OS uses for scheduling events, cron on unix, something else which I won't suggest I know about, on Windows or old Macs. That scheduler would then kick off the Perl process which can grab its data, send the report (via email, for example) and then quit. Would this work, or do you really need a daemon/server? http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: daemons ???
Hi, well to make it clear -- i need to make a server -- a constantly running process -- suppose if i want to get a daily report of the frequency of all the users logging in and out on the system from the daemon written in perl -- how do i do that ? thanks, KM On Sat, 8 Feb 2003, Wiggins d'Anconia wrote: > [EMAIL PROTECTED] wrote: > > hi all, > > how to write daemons in perl ? > > does it have such a support ? if so which module should i use? > > kindly enlighten me -- > > thanks in advance -- > > First question, do you want a "daemon" as in a process that is started, > then exec's a new process without a controlling terminal, possibly as a > new user, etc.? Or do you mean a "server"? Or do you mean a constantly > running process? > > Regardless, the answer is still yes but with very different methods for > achieving them. And notice that most servers are constantly running > daemons, and most daemons are constantly running, but you get the idea. > > Have a look here: > > http://search.cpan.org/author/EHOOD/Proc-Daemon-0.02/Daemon.pm > > If what you really want is a server, or constantly running process, > mention what type and what your goal is and more specifics can be provided. > > http://danconia.org > -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: daemons ???
[EMAIL PROTECTED] wrote: hi all, how to write daemons in perl ? does it have such a support ? if so which module should i use? kindly enlighten me -- thanks in advance -- First question, do you want a "daemon" as in a process that is started, then exec's a new process without a controlling terminal, possibly as a new user, etc.? Or do you mean a "server"? Or do you mean a constantly running process? Regardless, the answer is still yes but with very different methods for achieving them. And notice that most servers are constantly running daemons, and most daemons are constantly running, but you get the idea. Have a look here: http://search.cpan.org/author/EHOOD/Proc-Daemon-0.02/Daemon.pm If what you really want is a server, or constantly running process, mention what type and what your goal is and more specifics can be provided. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
daemons ???
hi all, how to write daemons in perl ? does it have such a support ? if so which module should i use? kindly enlighten me -- thanks in advance -- KM -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]