Sponsored Content
Top Forums Shell Programming and Scripting accessing a function in ksh from perl Post 302102922 by Yogesh Sawant on Monday 15th of January 2007 04:50:54 AM
Old 01-15-2007
in fact, your open statement lets you read the file abc.ksh by associating it with filehandle named A.

afaik, there is no specific Perl function/module to read only the required function from the given script. you may consider writing your subroutine to do that.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

accessing variables declared in another perl script

Hi all, I have a perl script which declares two variables and calls another perl script which accesses those variables. But I am unable to access the variables in the called script. My script is as follows: my $ENV{a}="20"; system("perl called.pl"); and my called.pl contains: print... (3 Replies)
Discussion started by: gurukottur
3 Replies

2. Shell Programming and Scripting

accessing ksh variables from awk

hi everybody! i am running this ksh script for replacing a set of strings by another set of new ones. i am getting both these from a file. also, the strings that i want to replace, are sub-strings(can occur more than once in each chunk) in a big chunk of data that i have bulk-copied(bcp utility)... (1 Reply)
Discussion started by: trupti wagh
1 Replies

3. Shell Programming and Scripting

Accessing files with perl

Hello i am new to Perl and i have a question. I am trying to read a file that has the following format: 14/4/2008 8:42:03 πμ|10800|306973223399|4917622951117|1||1259|1|126|492|433||19774859454$ 14/4/2008 9:13:08 πμ|10800|306973223399|306970097423|1||1264|1|126|492|878||19774859762$... (2 Replies)
Discussion started by: chriss_58
2 Replies

4. Shell Programming and Scripting

Accessing the Value of a parameter in KSH

Hi I am new to this forum. Please forgive me, If I am wrong anywhere. I am trying to understand the below code. Can anyone help in understanding what is ${#ST} here. Is that the value of the first parameter??:confused:...what is exit 1 mean. Any clarification is greatly appreciated. export... (3 Replies)
Discussion started by: suaven
3 Replies

5. Shell Programming and Scripting

[Perl] Accessing array elements within a sed command in Perl script

I am trying to use a script to replace the header of each file, whose filename are stored within the array $test, using the sed command within a Perl script as follows: $count = 0; while ( $count < $#test ) { `sed -e 's/BIOGRF 321/BIOGRF 332/g' ${test} > 0`; `cat 0 >... (2 Replies)
Discussion started by: userix
2 Replies

6. Shell Programming and Scripting

Accessing VSS through Perl

Hi All, can you please let me know how to copy entire files in a directory of VSS to a local folder. i am using PERL to access the VSS. Thanks in Advance regards, aditya Mahi (1 Reply)
Discussion started by: adityamahi
1 Replies

7. Shell Programming and Scripting

Accessing variables outside the function

I have the below code to find yesterdays date, In this I want to make MONTH, DAY and YEAR as global variableand use it outside the {}, but I am unable to do so , please assist: #!/usr/bin/ksh date '+%m %d %Y' | { read MONTH DAY YEAR DAY=`expr "$DAY" - $1` case "$DAY" in 0) ... (1 Reply)
Discussion started by: mohsin.quazi
1 Replies

8. Shell Programming and Scripting

Error during Accessing Global variable inside function

emailid=myemail@xyz.com taskName="DB-Backup" starttime=`date` email() { subject="$taskName" ": " $* " at `date` " mutt -s "$subject" $emailid < /dev/null } email "Starting" #do my stuff email "Finished" The above code gives following error ./dbbackup.sh: line 6: :... (5 Replies)
Discussion started by: nitiraj.rathore
5 Replies

9. Programming

design query: where to lock mutex for function accessing global value?

Hi, Suppose I have a function that accesses and increments a global variable . This function is run as part of thread. One locks mutex in the function and unlocks it after the processing is done. Is there any alternative way? Thanks in advance. (1 Reply)
Discussion started by: sanjayc
1 Replies

10. Shell Programming and Scripting

Perl: accessing reference to variable inside hash.

Below is hash which contains reference to variables: my %mandatoryFields = ( 1 => \$msgtype, 2 => \$switchtype, 3 => \$card_nbr, 4 => \$natv_tran_type_code, 5 => \$amt_1 ); This... (0 Replies)
Discussion started by: som.nitk
0 Replies
Gtk2::Helper(3pm)					User Contributed Perl Documentation					 Gtk2::Helper(3pm)

NAME
Gtk2::Helper - Convenience functions for the Gtk2 module SYNOPSIS
use Gtk2::Helper; # Handle I/O watchers easily, like Gtk 1.x did $tag = Gtk2::Helper->add_watch ( $fd, $cond, $callback, $data ) $rc = Gtk2::Helper->remove_watch ( $tag ) ABSTRACT
This module collects Gtk2 helper functions, which should make implementing some common tasks easier. DESCRIPTION
Gtk2::Helper->add_watch ( ... ) $tag = Gtk2::Helper->add_watch ( $fd, $cond, $callback, $data ) This method is a wrapper for Glib::IO->add_watch. The callback is called every time when it's safe to read from or write to the watched filehandle. $fd Unix file descriptor to be watched. If you use the FileHandle module you get this value from the FileHandle->fileno() method. $cond May be either 'in' or 'out', depending if you want to read from the filehandle ('in') or write to it ('out'). $callback A subroutine reference or closure, which is called, if you can safely operate on the filehandle, without the risk of blocking your application, because the filehandle is not ready for reading resp. writing. But aware: you should not use Perl's builtin read and write functions here because these operate always with buffered I/O. Use low level sysread() and syswrite() instead. Otherwise Perl may read more data into its internal buffer as your callback actually consumes. But Glib won't call the callback on data which is already in Perl's buffer, only when events on the the underlying Unix file descriptor occur. The callback subroutine should return always true. Two signal watchers are connected internally (the I/O watcher, and a HUP watcher, which is called on eof() or other exceptions). Returning false from a watcher callback, removes the correspondent watcher automatically. Because we have two watchers internally, only one of them is removed, but probably not both. So always return true and use Gtk2::Helper->remove_watch to disable a watcher, which was installed with Gtk2::Helper->add_watch. (Gtk2::Helper could circumvent this by wrapping your callback with a closure returning always true. But why adding another level of indirection if writing a simple "1;" at the end of your callback solves this problem? ;) $data This data is passed to the callback. $tag The method returns a tag which represents the created watcher. Later you need to pass this tag to Gtk2::Helper->remove_watch to remove the watcher. Example: # open a pipe to a ls command use FileHandle; my $fh = FileHandle->new; open ($fh, "ls -l |") or die "can't fork"; # install a read watcher for this pipe my $tag; $tag = Gtk2::Helper->add_watch ( $fh->fileno, 'in', sub { watcher_callback( $fh, $tag ); }); sub watcher_callback { my ($fh, $tag) = @_; # we safely can read a chunk into $buffer my $buffer; if ( not sysread($fh, $buffer, 4096) ) { # obviously the connected pipe was closed Gtk2::Helper->remove_watch ($tag) or die "couldn't remove watcher"; close($fh); return 1; } # do something with $buffer ... print $buffer; # *always* return true return 1; } Gtk2::Helper->remove_watch ( ... ) $rc = Gtk2::Helper->remove_watch ( $tag ) This method removes a watcher, which was created using Gtk2::Helper->add_watch(). $tag This is the tag returned from Gtk2::Helper->add_watch(). $rc The method returns true, if the watcher could be removed successfully, and false if not. SEE ALSO
perl(1), Gtk2(1) AUTHOR
Joern Reder <joern AT zyn.de> COPYRIGHT AND LICENSE
Copyright 2003 by Joern Reder This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. perl v5.14.2 2011-11-27 Gtk2::Helper(3pm)
All times are GMT -4. The time now is 02:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy