Perl IO vs GLOB symbols


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Perl IO vs GLOB symbols
# 1  
Old 07-03-2008
Error Perl IO vs GLOB symbols

Hi,

Can someone please clarify how we are able to use both IO and GLOB symbols of a package variable interchangeably?

Please consider the following code:
Code:
open(FH,"myfile") || die "Unable to open file myfile:$@";
my $glob_var = *main::FH{GLOB};
my $io_var = *main::FH{IO};
print $glob_var "From glob\n";
print $io_var "From IO\n";
close FH;

Now 'myfile' contains,
Code:
From glob
From IO

Thanks,
Srini
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Issue with user input including * (glob) and sed

Hello All, I have created a script that searches for different things and "sanitizes" the findings from files. Currently the user is required to put in a hostname (server.serverfarm.abc) one at a time to replace. I would like the user be able to use *.*.abc in grep and then pipe into sed to... (1 Reply)
Discussion started by: jvezinat
1 Replies

2. Shell Programming and Scripting

Use ./*glob*

I used this site to check a script. ShellCheck - shell script analysis tool Line 57: zip -u -q Desktop_Items.zip *.desktop ^-- SC2035: Use ./*glob* or -- *glob* so names with dashes won't become options. I do not understand what is wrong with my zip... (6 Replies)
Discussion started by: drew77
6 Replies

3. Shell Programming and Scripting

Using glob() in python script in Linux

Hi I need some suggestion on glob function. I am trying to write a python program to grep some specific files in a particular directory. In the directory i have some files like below abc.log abc.pid abc.tar gadd.tar gat.log gat.tar in this directory i need to grep onlu my hostname files,... (1 Reply)
Discussion started by: kumar85shiv
1 Replies

4. Shell Programming and Scripting

Python - glob () - How to grep same files with different extension files

Hi I Have a directory and i have some files below abc.txt abc.gif gtee.txt ghod.pid umni.log unmi.tar How can use glob function to grep abc files , i have created a variable "text" and i assigned value as "abc", please suggest me how can we use glob.glob( ) to get the output as below... (2 Replies)
Discussion started by: kumar85shiv
2 Replies

5. Shell Programming and Scripting

Need to extract only decimal numbers for a glob of text

If you have a look at this thread, you'll see that users have been posting the output a script which are numbers that range from 2 to 5 decimal places. If I dump this entire thread to txt file, how can I: 1) Delete everything except for numbers of the following formats (where 'x' is a digit and... (5 Replies)
Discussion started by: graysky
5 Replies

6. Shell Programming and Scripting

glob not matching all files in perl

I encountered a weird issue with globbing in perl not returning all files, while I was testing out a script for recursive dir-processing on my Synology NAS. Basically it didn't show (/match?) all the files in a specific directory. If I move the file to a different directory or even rename it, it... (2 Replies)
Discussion started by: odyssey
2 Replies

7. UNIX for Dummies Questions & Answers

Help with understanding the symbols '~#' and '~$'

I noticed that sometimes there is "~#" or "~$" in the terminal. What is that? I can't make any research in google because I don't know what are they called. I even tried reading pdf's or books but unfortunately, I wasn't lucky to find out. Maybe I was not persistent enough but I am really... (3 Replies)
Discussion started by: chams
3 Replies

8. Shell Programming and Scripting

Perl: How to Print symbols like " and ;

Hi, How do I print a line with symbols in a file? Exp: If I want to print line: Hi "Lisa;John" Command: print FILE "Hi "Lisa;John""; - will give me error Bareword found where operator expected... Can someone advise how can I print any line consiting symbols like example above. Thanks... (3 Replies)
Discussion started by: SSGKT
3 Replies

9. Programming

cc -- Unsatisfied symbols -- on HP-UX 10.2

Greetings, I am slowly learning a few things but am far from being an expert. I am at the point now that I would like to be able write some ANSI C code on HP-UX 10.2. Just a hobbie... I am just using cc, which came with the HP-UX 10.2 ... I don't have the manuals for the development... (7 Replies)
Discussion started by: Dirk_
7 Replies

10. Shell Programming and Scripting

redirecting symbols

Can anyone please tell me what the following do 1. < 2. << Thanks Calypso (1 Reply)
Discussion started by: Calypso
1 Replies
Login or Register to Ask a Question
Dancer::Plugin(3pm)					User Contributed Perl Documentation				       Dancer::Plugin(3pm)

NAME
Dancer::Plugin - helper for writing Dancer plugins DESCRIPTION
Create plugins for Dancer SYNOPSIS
package Dancer::Plugin::LinkBlocker; use Dancer ':syntax'; use Dancer::Plugin; register block_links_from => sub { my $conf = plugin_setting(); my $re = join ('|', @{$conf->{hosts}}); before sub { if (request->referer && request->referer =~ /$re/) { status 403 || $conf->{http_code}; } }; }; register_plugin; 1; And in your application: package My::Webapp; use Dancer ':syntax'; use Dancer::Plugin::LinkBlocker; block_links_from; # this is exported by the plugin PLUGINS
You can extend Dancer by writing your own Plugin. A plugin is a module that exports a bunch of symbols to the current namespace (the caller will see all the symbols defined via "register"). Note that you have to "use" the plugin wherever you want to use its symbols. For instance, if you have Webapp::App1 and Webapp::App2, both loaded from your main application, they both need to "use FooPlugin" if they want to use the symbols exported by "FooPlugin". METHODS register Lets you define a keyword that will be exported by the plugin. register my_symbol_to_export => sub { # ... some code }; register_plugin A Dancer plugin must end with this statement. This lets the plugin register all the symbols define with "register" as exported symbols (via the Exporter module). A Dancer plugin inherits from Dancer::Plugin and Exporter transparently. plugin_setting Configuration for plugin should be structured like this in the config.yml of the application: plugins: plugin_name: key: value If "plugin_setting" is called inside a plugin, the appropriate configuration will be returned. The "plugin_name" should be the name of the package, or, if the plugin name is under the Dancer::Plugin:: namespace (which is recommended), the remaining part of the plugin name. Enclose the remaining part in quotes if it contains ::, e.g. for Dancer::Plugin::Foo::Bar, use: plugins: "Foo::Bar": key: value AUTHORS
This module has been written by Alexis Sukrieh and others. LICENSE
This module is free software and is published under the same terms as Perl itself. perl v5.14.2 2011-11-30 Dancer::Plugin(3pm)